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.
Symptom
Section titled “Symptom”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.
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.
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.
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/"
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 7 real issues
- #1786使用New API的中转api代理claude code时提示tool_calls[0]
- #2206Google ai studio配置claude code报错 prompt_cache_key和404,已开启整流器
- #4112谷歌api接入Codex,思考的时候会报错
- #4286希望可以尽快适配gemini3.5
- #4457Gemini模型function calling会报错
- #5415当 Codex 应用通过 cc-switch 调用 Gemini API 的工具时缺少 thought_signature 导致 HTTP 400 错误
- #84274.0.14版本Gemini 4 Argon的官方API在codex中接入时仍然存在问题
- 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.
Related problems
Section titled “Related problems”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.