Skip to content

[BUG] Gemini thinking models fail with 400 error: missing thought_signature in functionCall parts when using tool calls #2504

Description

@harkaranbrar7

OmniRoute Version

latest (Docker)

Installation Method

Docker / Docker Compose

Operating System

Linux

OS Version

Docker (Linux container)

Node.js Version

No response

Provider(s) Involved

Google Gemini

Model(s) Involved

gemini-2.5-pro-preview (and other Gemini thinking/reasoning models)

Client Tool

Claude Code

Description

When using OmniRoute (Docker) as a proxy between Claude Code and the Gemini API with a thinking/reasoning model (e.g. gemini-2.5-pro-preview), any agentic workflow that involves tool/function calls fails with the following 400 error from the Gemini API:

[400]: Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call `default_api:Bash`, position 6. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.

Root Cause:
Gemini's thinking/reasoning models embed a thought_signature field inside each functionCall part of their response. This field must be preserved and echoed back in the subsequent request's conversation history. OmniRoute's OpenAI-to-Gemini translation layer appears to strip this field when converting the response format, so when the tool result is sent back, Gemini rejects the request with INVALID_ARGUMENT.

Setup:

  • Claude Code → OmniRoute (Docker) → Gemini API
  • Model: gemini-2.5-pro-preview (any Gemini thinking model)
  • Error occurs on any multi-turn tool call sequence

Steps to Reproduce

  1. Run OmniRoute via Docker and configure it to route to Google Gemini
  2. Point Claude Code to OmniRoute as the API endpoint
  3. Select a Gemini thinking model (e.g. gemini-2.5-pro-preview)
  4. Start any agentic task in Claude Code that triggers a tool/function call (e.g. run a bash command, read a file)
  5. Observe the error returned on the first or subsequent tool call

Expected Behavior

OmniRoute should successfully proxy the tool call round-trip to Gemini, preserving all native Gemini fields (including thought_signature) so that multi-turn agentic workflows with thinking models complete without errors.

Actual Behavior

The request fails immediately with HTTP 400 INVALID_ARGUMENT:

[400]: Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance.

All tool calls are broken — Claude Code cannot complete any agentic task when routed through OmniRoute to a Gemini thinking model.

Test Impact

Needs a new unit test

Error Logs / Output

[400]: [{ "error": { "code": 400, "message": "Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call `default_api:Bash` , position 6. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.", "errors": [ { "message": "Function call is missing a thought_signature in functionCall parts...", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" } } ]

Screenshots

No response

Additional Context

_- Workaround: switching to a non-thinking model (e.g. gemini-1.5-pro or gemini-2.0-flash) avoids the error since those models do not emit thought_signature.

  • Disabling thinking mode on the Gemini side may also work if OmniRoute exposes a config option for this.
  • Reference: https://ai.google.dev/gemini-api/docs/thought-signatures
  • The fix would require OmniRoute to preserve the thought_signature field from each Gemini functionCall response part and include it when sending the conversation history back in subsequent requests._

Validation Plan

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions