Repository navigation
Proxy forwards image_url parts to text-only zen models -> 400 invalid_request_error #1043
Description
Client or integration
Codex App
Area
Provider adapter
Summary
When a Codex message contains an image part (image_url), the proxy forwards it as-is to the zen API (https://opencode.ai/zen/v1). The zen API only accepts text and rejects the request with HTTP 400:
Provider error 400: {"error":{"param":null,"type":"invalid_request_error","code":"invalid_request_error","message":"Error from provider (Console): Upstream request failed: [invalid_request_error] Failed to deserialize the JSON body into the target type: messages[65]: unknown variant image_url, expected text at line 1 column 2015840"}}
Root cause: the noVisionModels mechanism (vision sidecar or fail-closed strip) is only applied when the provider is explicitly configured with that list. By default there is no protection for providers whose models are text-only (like the free zen models).
Current mitigation (works locally): the opencode-zen provider config lists the 7 zen free models under noVisionModels and sets defaultMaxOutputTokens: 32000. Text-only providers remain unsafe by default.
Suggested fix: automatically strip (or describe) images whenever the model's inputModalities does not include "image", even when noVisionModels is not configured. This would make text-only providers safe by default.
Reproduction
- Configure the
opencode-zenprovider with free models, without defining anoVisionModelslist. - Send a Codex request that contains at least one message with an
image_urlpart (e.g. a screenshot or any image attachment). - The proxy forwards the full message, including the
image_urlpart, tohttps://opencode.ai/zen/v1. - The zen API rejects the request with HTTP 400
invalid_request_error:Failed to deserialize the JSON body into the target type: messages[65]: unknown variant 'image_url', expected 'text'.
Version
Latest
Operating system
Windows 11
Provider and model
opencode-zen (free models)
Logs or error output
Provider error 400: {"error":{"param":null,"type":"invalid_request_error","code":"invalid_request_error","message":"Error from provider (Console): Upstream request failed: [invalid_request_error] Failed to deserialize the JSON body into the target type: messages[65]: unknown variant `image_url`, expected `text` at line 1 column 2015840"}}Screenshots and supporting files
No response
Redacted configuration
{
"providers": {
"opencode-zen": {
"noVisionModels": ["<the 7 zen free model ids>"],
"defaultMaxOutputTokens": 32000
}
}
}Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
github-actions commentedon Aug 5, 2026
Automated translation bookkeeping — detected language: unknown.
github-actions commentedon Aug 5, 2026
Issue reopened
The report now contains the information required by the automated check. Thanks for updating it.
[-]Codex App bug report[/-][+]Proxy forwards image_url parts to text-only zen models -> 400 invalid_request_error[/+]docs(devlog): triage every open bug issue and PR against dev
Merge pull request #1070 from lidge-jun/codex/1043-zen-text-only
lidge-jun commentedon Aug 6, 2026
Fixed on dev by PR #1070, merge commit 0803642. The proxy now strips image parts for the Zen models that reject them, with e2e regression coverage. Note: dev is ahead of the current npm release — ships with the next release train.
fix(zen): strip images for the Zen models that reject them (lidge-jun…
docs(devlog): triage every open bug issue and PR against dev
fix(zen): strip images for the Zen models that reject them (lidge-jun…
Merge pull request lidge-jun#1070 from lidge-jun/codex/1043-zen-text-…