tools format for most text models, so switching models only means changing model.
Which endpoint each model needs
Results from running the same weather function through a full call → result → final answer round trip. GPT-6 and GPT-5.6 models were checked on November 4, 2026, Claude on November 10, and the rest on October 14:
Use Chat Completions for models marked ”—”, and whenever you’re unsure. Gemini also supports
functionDeclarations in native generateContent; see the Gemini protocol.
For tool calling with Claude models, use the Claude protocol at /v1/messages with the base URL https://api.laozhang.ai, as shown in Use tools. If you stay on Chat Completions, the assistant message you send back must have non-empty text in content, or the second turn fails with a 400. See the FAQ entry.
OpenAI’s own Chat Completions API doesn’t let GPT-6 or GPT-5.6 use function tools while reasoning. Since November 4, 2026, LaoZhang API handles these requests, so clients that only speak Chat Completions, such as Cline and Cherry Studio, can use GPT-6 with tools. See the GPT-6 Chat Completions tool calling announcement.
Chat Completions example
Install the SDK (python -m pip install openai) and set the LAOZHANG_API_KEY environment variable first.
message.tool_calls in the first reply holds the function name and its arguments as a JSON string. The second request sends back the model’s message plus one tool message per call, and each tool_call_id must match the id of its call.
To use another model from the Chat Completions column, change MODEL; nothing else changes. With GPT-6 models:
- You can pass
reasoning_effort, such as"high", in both requests. gpt-6.1-solandgpt-6-astradon’t accept"none".
Responses example
In Responses, a tool definition drops the nestedfunction object, and results go back as function_call_output items:
Send history back to Responses
Rebuild eachfunction_call item from its call_id, name, and arguments, as the example does. Don’t rely on conversation state stored on the server:
- Don’t continue with
previous_response_id. - Don’t paste the first response’s
outputback intoinputunchanged.
The requested item was created under a different Azure OpenAI resourcePrevious response with id '...' not found
FAQ
Why does gpt-6.1-sol return 400 when I pass tools?
The error reads Function tools with reasoning_effort are not supported. OpenAI doesn’t allow function tools together with reasoning in Chat Completions, and gpt-6.1-sol doesn’t accept reasoning_effort: "none".
Since November 4, 2026, LaoZhang API handles these requests, and the same code returns tool_calls. If you still get this 400:
- Check that the base URL is
https://api.laozhang.ai/v1, not OpenAI’s or another provider’s. - Send support the time of the error, the model, and the full error message.
Why does Claude return 400 on the second tool-calling turn?
When you call a Claude model through Chat Completions and send back anassistant message whose content is null or an array of content parts, its tool_calls are dropped and the request fails with HTTP 400:
- Switch to the Claude protocol at
/v1/messages(recommended). Use the base URLhttps://api.laozhang.ai, aClaude Code-group token, and return results astool_resultblocks as shown in Use tools. - Stay on Chat Completions and set that
assistantmessage’scontentto a non-empty string, such as"Checking.", leavingtool_callsunchanged.
What if the model returns several function calls at once?
Run each one and send each result back with its owntool_call_id (Chat Completions) or call_id (Responses). Both examples above already loop over every call.
What if the arguments aren’t valid JSON?
Validate them withjson.loads. If parsing fails, send the error back as the function result so the model can try again. In Responses, "strict": true on the tool plus "additionalProperties": false in parameters keeps arguments within the schema.
Is function calling billed separately?
No. Tool definitions and function results count as input tokens, and the generated arguments count as output tokens, at the model’s price. Server-side tools such as web search add a per-search fee.Related documentation
- Let the model search the web and cite sources: Web search
- Choosing between Chat Completions and Responses, and GPT-6 parameter rules: OpenAI models
- Function calling in the native Gemini format: Gemini protocol
References
- OpenAI: Function calling
- Google: Function calling with the Gemini API