Skip to content

fix: omit thinkingConfig for Gemini Flash Image models without thinking support #4233

Description

@aheritier

Problem

google/gemini-2.5-flash-image rejects the no-thinking request shape used by Docker Agent in some paths. A minimal text request succeeds when thinkingConfig is omitted, but the same request with thinkingConfig: {"thinkingBudget": 0} returns HTTP 400 INVALID_ARGUMENT: Thinking is not enabled for this model.

Docker Agent's WithNoThinking / MCP sampling path can serialize this shape, causing requests to fail for Gemini Flash Image.

Evidence

Isolated gateway probes on 2026-09-10 reproduced the behavior:

  • thinkingConfig omitted: accepted.
  • thinkingConfig: {"thinkingBudget": 0}: rejected with the 400 above.

Sanitized reproduction

The following is illustrative and contains no credentials:

{
  "model": "google/gemini-2.5-flash-image",
  "contents": [{"role": "user", "parts": [{"text": "Reply with OK"}]}],
  "thinkingConfig": {"thinkingBudget": 0}
}

Send the JSON to the configured Gemini-compatible gateway with a redacted bearer credential, for example:

curl -sS -X POST "https://<gateway>/v1beta/models/google%2Fgemini-2.5-flash-image:generateContent" \
  -H "Authorization: Bearer <REDACTED>" \
  -H "Content-Type: application/json" \
  --data @request.json

Expected behavior

Omit thinkingConfig for models that do not support thinking. Retain the existing disable-thinking semantics for models that do support thinking.

Scope

This issue covers the confirmed Gemini Flash Image incompatibility only. The unconfirmed Gemini 3.8 failure is explicitly out of scope.

Related epic: #3996

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/mcpMCP protocol, MCP tool servers, integrationarea/modelsLLM model integrations and model providersarea/providers/geminiGoogle Gemini provider supportarea/toolsFor features/issues/fixes related to the usage of built-in and MCP tools

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions