Skip to main content
Tool calling (also known as function calling) lets models request to execute functions you define. The model decides when to call a tool and what arguments to pass — your application executes the function and returns the result.
Tool calling requires the Basic plan or higher. Check shuttleai.com/models to see which models support tool calling.

How it works

1

Define your tools

Describe the functions the model can call, including their parameters.
2

Send the request

Include the tool definitions in your API request alongside the conversation.
3

Model decides to call a tool

If the model determines it needs to use a tool, it responds with a tool_calls array instead of a regular message.
4

Execute the function

Your application runs the requested function with the provided arguments.
5

Return the result

Send the function result back to the model as a tool message.
6

Model generates final response

The model incorporates the function result and produces a final answer.

Example: Weather lookup

1. Define the tool

2. Send the request

3. Handle the tool call

Full example

Here’s the complete flow in one script:

Parallel tool calls

Models can request multiple tool calls in a single response. For example, if the user asks “What’s the weather in Tokyo and New York?”, the model may return two tool calls at once. Always iterate over the full tool_calls array and return results for all of them before sending the next request.

Tool choice

Control when the model uses tools with tool_choice:

Streamed tool calls

Tool calls work with streaming too. When streaming, tool call arguments arrive incrementally across chunks. The OpenAI SDK handles this automatically.

Supported models

Tool calling is supported on models that have the Tools badge at shuttleai.com/models, including:
  • ShuttleAI Auto
  • GPT-5.2
  • Claude Opus 4.6
  • Claude Sonnet 4.6
  • Claude Haiku 4.5