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-zen provider with free models, without defining a noVisionModels list.
- Send a Codex request that contains at least one message with an
image_url part (e.g. a screenshot or any image attachment).
- The proxy forwards the full message, including the
image_url part, to https://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
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 variantimage_url, expectedtextat line 1 column 2015840"}}Root cause: the
noVisionModelsmechanism (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-zenprovider config lists the 7 zen free models undernoVisionModelsand setsdefaultMaxOutputTokens: 32000. Text-only providers remain unsafe by default.Suggested fix: automatically strip (or describe) images whenever the model's
inputModalitiesdoes not include"image", even whennoVisionModelsis not configured. This would make text-only providers safe by default.Reproduction
opencode-zenprovider with free models, without defining anoVisionModelslist.image_urlpart (e.g. a screenshot or any image attachment).image_urlpart, tohttps://opencode.ai/zen/v1.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