Skip to content

Function call is missing a thought_signature error (cc-switch)

Quick fix

Upgrade cc-switch. The Gemini API requires thought_signature in tool calls, which older versions did not add when forwarding requests.

Error output
CC Switch local proxy failed while handling Codex endpoint /responses. Provider: Gemini Native; model: gemini-3.5-flash; upstream_status: HTTP 400; cause: [{"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:get_goal` , position 3. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.","status":"INVALID_ARGUMENT"}}]

Google updated the Gemini API, particularly after introducing reasoning models, to require a field named thought_signature in the functionCall data structure. When Codex or Claude Code uses a Gemini model through the cc-switch local proxy and invokes tools, older versions of cc-switch did not automatically add or correctly forward this field during protocol conversion, causing the Gemini API to return an HTTP 400 error. Earlier versions also leaked the prompt_cache_key field to the Gemini upstream, causing a 400 error. This was fixed in v3.14.0.

  1. Upgrade cc-switch to the latest version (v3.14.0 or later). This version fixes the prompt_cache_key leak and improves forwarding for the Gemini native interface.

  2. If you use the Gemini Native API, select the Gemini format correctly in the Provider configuration instead of relying only on the OpenAI-compatible layer. Earlier versions had incomplete function calling support for the Gemini native format.

  3. Check that local routing (Needs Local Routing) is enabled and base_url is configured correctly. For the Gemini OpenAI-compatible layer, base_url must be https://generativelanguage.googleapis.com/v1beta/openai/.

    cc-switch provider 配置示例
    base_url: "https://generativelanguage.googleapis.com/v1beta/openai/"
ToolCodex
Version3.16.3 及以下版本(v3.14.0 修复了部分相关问题)
PlatformsWindowsmacOS
Why does the error occur as soon as the model starts reasoning?
After introducing reasoning models, Google required functionCall to include the thought_signature field. Older cc-switch versions did not add this field when forwarding requests, so the Gemini API rejected them.
How should Gemini be configured to avoid this error?
First, upgrade to cc-switch v3.14.0 or later. If you use the Gemini Native API, confirm that the correct provider type is selected. If you use the OpenAI-compatible layer, set base_url to https://generativelanguage.googleapis.com/v1beta/openai/ and enable local routing.
Is this the same issue as tool_calls[0] id cannot be empty on a New API relay?
No. Although both appear as invalid_argument, the tool_calls[0] id error is a message-format validation issue in a relay such as New API, while the thought_signature error is a specific requirement of the official Gemini API for function-call structures.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.