Tool 'image_generation' not supported when using non-OpenAI providers (e.g. MiMo)
Problem
When using a non-OpenAI provider that supports the OpenAI Responses API format (e.g. MiMo API at \https://token-plan-cn.xiaomimimo.com/v1\), Codex automatically injects the \image_generation\ tool into the request payload. However, these providers do not support this tool type, causing the request to fail with:
\\\
tool type 'image_generation' is not supported by this gateway phase
\\\
Root Cause
In \packages/opencode/src/provider/sdk/copilot/responses/openai-responses-prepare-tools.ts\, the \openai.image_generation\ provider tool is unconditionally converted to \{ type: 'image_generation' }\ and sent to the API, regardless of whether the target API supports it.
Expected Behavior
Codex should check if the target API supports \image_generation\ before including it in the request. For non-OpenAI providers, the tool should be excluded or the feature should be disableable via config.
Environment
- Codex CLI version: 0.142.0
- Model: mimo-v2.5-pro
- Provider: MiMo Token Plan
- wire_api: responses
Config Attempted
\\\ oml
[features]
image_generation = false
\\\
This does not prevent the tool from being injected into the API request.
3 Comments
A small clarification from current
main(80f54d1): the referencedpackages/opencode/...path is from a different project, but Codex has a similar capability-boundary question in the app-server extension/tool exposure path.Relevant Codex paths:
codex-rs/app-server/src/extensions.rsinstalls the image-generation extension unconditionally when thread extensions are built.modelProvider/capabilities/readalready reports provider capabilities, and tests showamazon-bedrockreturnsimage_generation: false.codex-rs/app-server/tests/suite/v2/imagegen_extension.rshas coverage for image-generation exposure/callability, including anopenai-customconfig path.The fix boundary should probably not be “remove image_generation globally.” It should be capability-gated:
image_generation: falseshould not expose or inject theimage_generationtool[features] image_generation = falseshould also be honored as a hard disable before request payload constructionRegression shape: configure a custom Responses-compatible provider whose capabilities report
image_generation: false, start a turn, and assert noimage_generationtool is advertised/sent.Same here. I use
Github Copilotas model provider for Codex Desktop App.The above config works for Codex CLI but not Codex Desktop app.
Update:
Running
codex logoutwill fix this issue when we are using third-party providers.