Skip to main content
Once tools are declared (via tools), the model decides on its own whether the current turn needs a tool call. The tool_choice parameter gives you explicit control over this behavior: force a call, forbid calls entirely, or keep the default.

Force a tool call: "required"

Use this when your workflow must go through the tool path β€” for example, mandatory retrieval or a mandatory database lookup β€” and the model is not allowed to answer from memory:
The model must call at least one tool in this turn. Make sure the request declares at least one callable tool. A typical use is the tool-search pattern: set "required" on the first turn to force the model to call search_tools, then switch back to "auto" after retrieval β€” see Kimi K3 API Tool Calling Best Practices.

Forbid tool calls: "none"

Use this when the request only needs a plain-text answer and you don’t want the model to trigger a tool call by mistake:
The model replies with plain text and produces no tool_calls, which also reduces latency and token consumption.

Let the model decide: "auto" (default)

Omitting tool_choice is the same as "auto": the model decides based on the context whether to call a tool. This fits regular conversations.

Force a specific tool: pass a function object

Beyond the three enum values, tool_choice also accepts a function object that forces the model to call the specified tool:
Forcing a specific tool is currently incompatible with thinking: with thinking enabled, the request returns a 400 error (tool_choice 'specified' is incompatible with thinking enabled).

Full request example

The following example declares a weather tool and uses tool_choice: "required" to force the model to call it:

Notes

  • tool_choice is a request-level parameter: it takes effect independently for each request and only constrains tool selection for that generation;
  • Setting tool_choice (or not setting it) does not invalidate the prefix cache, so feel free to adjust it on a per-request basis.