Tool calling

Tool calling patterns

Tool calling lets models respond with structured function names and arguments your application can execute.

Overview

Tool calling (also called function calling) lets models respond with structured function names and arguments that you can execute in your application. It enables models to interact with external systems, retrieve real-time data, and power agentic AI workflows.

Pass function descriptions to the tools parameter, and the model returns tool_calls when it determines a function should be used. You then execute these functions and optionally pass the results back to the model for further processing.

  1. Your app
    sends a request
    messages + tools
  2. Model
    returns tool_calls
    tool_calls
  3. Your app
    runs the functions
    results appended to messages
  4. Model
    evaluates the results
    more tool_calls, or a final answer
  5. Final response
    returned to your app
    no more tool_calls

Steps 2–4 repeat while the model keeps returning tool_calls; the loop ends when a response has none.

Patterns

Tool calling fits a handful of common shapes. Pick the one that matches what you’re building, then follow the link for runnable Python, TypeScript, and cURL examples.

PatternDescriptionUse casesPage
SimpleOne function, one callBasic utilities, simple queriesCall functions
MultipleChoose from many functionsMany tools, model has to chooseCall functions
ParallelSame function, multiple calls in one turnComplex prompts, batched lookupsParallel calls
Parallel multipleMultiple functions, parallel callsSingle requests that need many toolsParallel calls
Multi-stepSequential tool calling in one turnData-processing workflowsAgentic patterns
Multi-turnConversational context plus functionsAgents with humans in the loopAgentic patterns

Supported models

Native tool calling is declared on deepseek4-flash, deepseek-v4-pro, glm5.3, glm5.3-flash, qwen3.8-27b and reka-edge-2603. reka-flash-3 does not declare tools: sending them is not an error, but it returns 200 with no tool_calls and reasons about the request in reasoning_content instead. reka-edge-2603, glm5.3-flash and qwen3.8-27b also accept image inputs alongside tools, so you can extract structured data from pictures through function calls.

The feed at GET /v1/models is authoritative. See the model catalog for the current list.

Next steps