Tool calling is a two-stage, client-driven process: the model first returns tool_calls, the client executes the function and sends back the role="tool" result, and the model then generates the final answer. When strict beta is enabled, the beta endpoint must be used, every function must set strict: true, and the submitted JSON Schema must fall within the range supported by the service; Chat Completion does not support inserting tool calls that the model did not generate into the middle of the history.
Suitable tasks: Agent workflows that require the model to call weather, database, search, or business functions while requiring function parameters to conform strictly to a Schema.
Unsuitable tasks: Scenarios that require dynamically inserting tool calls and results into the middle of a Chat Completion history; use the Anthropic API or Responses API instead.
Applicable model version: deepseek-flash, corresponding to DeepSeek-V4.1-Flash.
Applicable client, Agent, or API: OpenAI-compatible Chat Completion API; strict mode supports both thinking and non-thinking mode.
Recommended reasoning tier and parameters: Not specified; this article only defines tool-call and Schema configuration.
The following is a tool definition that can be placed in the request's tools array. It is not a complete API request or a runnable Python script:
{
"type": "function",
"function": {
"name": "get_weather",
"strict": true,
"description": "Get weather of a location.",
"parameters": {
"type": "object",
"properties": {
"location": { "type": "string" }
},
"required": ["location"],
"additionalProperties": false
}
}
}Strict mode also requires setting the client endpoint to:
https://api.deepseek.com/betaEvery function in the request must set strict: true. The service validates the function Schema; if the Schema does not meet the requirements or contains unsupported types, the request returns an error.
Supported types or combinations include: object, string, number, integer, boolean, array, enum, and anyOf. The page also explains that $def can define reusable modules and $ref can reference modules or express recursive structures.
Objects must satisfy both requirements at the same time:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" }
},
"required": ["name", "age"],
"additionalProperties": false
}In other words, every property must be listed in required, and additionalProperties must be set to false. Strings support pattern and format; the currently supported format values are email, hostname, ipv4, ipv6, and uuid, while minLength and maxLength are not supported. Numbers and integers support const, default, minimum, maximum, exclusiveMinimum, exclusiveMaximum, and multipleOf; arrays do not support minItems or maxItems.
Define the function and parameter Schema in tools; in strict mode, set each function's strict to true and use https://api.deepseek.com/beta.
Send the user message and tools to deepseek-flash, and read the tool_calls in the returned assistant message.
Based on the function name and arguments in tool_calls, have the client execute the real function. The model only proposes the call; it does not execute the specific function on the client's behalf.
Append the complete assistant message to the history, then append the corresponding tool result:
{ "role": "tool", "tool_call_id": "<corresponding call ID>", "content": "<client function result>" }Send the message history again until the assistant no longer returns tool_calls, then read the natural-language answer.
The protocol boundary for inserting content during tool calling is as follows:
sequenceDiagram
participant U as User
participant M as Model
participant C as Client
participant T as External tool
U->>M: messages + tools
M-->>C: assistant.tool_calls
C->>T: Execute function
T-->>C: Result
C->>M: Complete assistant + role=tool
M-->>C: Final answerThe Anthropic API (/messages) and Responses API support putting client-dynamically inserted tool calls and results into the middle of a conversation, and also support inserting a system message in the middle.
Chat Completion supports inserting a system message in the middle, but does not support inserting tool calls in the middle. When this capability is required, use one of the two APIs above instead.
The official page's Non-thinking Mode section gives a get_weather example: the model returns get_weather({location: 'Hangzhou'}); after the client provides a result, the model returns a natural-language answer, “The current temperature in Hangzhou is 24°C.”
The example's "content": "24℃" is a fixed simulated result written directly in the code. It represents a client tool return, not a real weather tool or real-time weather data.
The page explicitly states that the specific functionality of get_weather must be provided by the user; the model does not execute the function itself.
The requirements for strict beta are: use the https://api.deepseek.com/beta endpoint, set strict: true for every function, and have the service validate the JSON Schema submitted by the user.
Strict mode supports both thinking and non-thinking mode; the page does not provide a thinking switch or reasoning-tier configuration.
The page places the example in a section titled “Non-thinking Mode,” but the example request does not explicitly pass a thinking field. The current model homepage defaults to thinking enabled, so the title alone cannot prove that the code explicitly disables thinking; when reproducing, confirm the actual mode against the current API's thinking configuration.
Strict is a beta capability, and not every JSON Schema will pass the service's validation. In particular, check required and additionalProperties: false for nested objects.
Tool results must be generated by the client and returned with the corresponding tool_call_id; a function call returned by the model cannot be treated as an executed result.
The JSON in this article is only a minimal tool definition fragment. It does not include an API key, complete client initialization, exception handling, or a real tool implementation.
On 2026-09-16, the DeepSeek Tool Calls page was read in full through the Tabbit browser; no real API request was executed. To reproduce the strict configuration, use the beta endpoint, strict: true, and a complete Schema as required by the page; treat the weather example's 24℃ as a fixed simulated client return.
DeepSeek V4.1 Flash