Skip to content

invalid_request_error Kimi For Coding Claude Code

Quick fix

Set ENABLE_TOOL_SEARCH=false in the Kimi configuration in cc-switch.

Error output
{"error":{"type":"<nil>","message":"{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\"\n    ,\"message\":\"***.***.content.2.tool_use.id: Field required\"},\"request_id\":\"req_vrtx_011CWar3KndbH2tutuEY6z78\"} (request id: 20251229184758483111549vDuwIJ0i)"},"type":"error"}

The issue is caused by the global common configuration in CC Switch (common_config_claude). When `ENABLE_TOOL_SEARCH=true` is set globally, this environment variable is injected to all provider configurations.

Claude Code (version ≥ v2.1.238) supports the Tool Search mechanism by default only on the official Anthropic endpoint. When using a non-official endpoint such as Kimi For Coding with this switch forced on, Claude Code tries to use the tool deferral mechanism and sends requests containing `tool_reference` content blocks to the third-party API. Third-party providers such as Kimi do not support this `tool_reference` format, so they return HTTP 400 with `invalid_request_error`.

  1. Open the cc-switch configuration file and locate the Kimi For Coding provider section.

  2. Under that provider configuration, explicitly add the environment variable `ENABLE_TOOL_SEARCH` and set it to `false` to override the global setting.

ToolClaude Code
Version≥ v2.1.238
PlatformsmacOSWindowsLinux
Why does the error persist even though Tool Search is disabled globally?
Because `ENABLE_TOOL_SEARCH=true` in the CC Switch global common configuration (common_config_claude) is forced into every provider. You must explicitly set it to false in the specific provider configuration, such as Kimi, to override it.
Is this error a Kimi bug?
It is not a Kimi bug. Claude Code is using its `tool_reference` mechanism on a non-official endpoint, and the Kimi API is incompatible with that format, causing a protocol conflict.

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.