Tool 'image_generation' not supported when using non-OpenAI providers (e.g. MiMo)

Open 💬 3 comments Opened Jun 29, 2026 by fzwns

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.

View original on GitHub ↗

3 Comments

wgu9 · 1 month ago

A small clarification from current main (80f54d1): the referenced packages/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.rs installs the image-generation extension unconditionally when thread extensions are built.
  • modelProvider/capabilities/read already reports provider capabilities, and tests show amazon-bedrock returns image_generation: false.
  • codex-rs/app-server/tests/suite/v2/imagegen_extension.rs has coverage for image-generation exposure/callability, including an openai-custom config path.

The fix boundary should probably not be “remove image_generation globally.” It should be capability-gated:

  • OpenAI providers that support image generation keep the tool
  • custom/non-OpenAI providers with image_generation: false should not expose or inject the image_generation tool
  • [features] image_generation = false should also be honored as a hard disable before request payload construction

Regression shape: configure a custom Responses-compatible provider whose capabilities report image_generation: false, start a turn, and assert no image_generation tool is advertised/sent.

fondoger · 1 month ago

Same here. I use Github Copilot as model provider for Codex Desktop App.

[features]
image_generation = false

The above config works for Codex CLI but not Codex Desktop app.

fondoger · 1 month ago

Update:

Running codex logout will fix this issue when we are using third-party providers.