What is function calling?

Function calling, also called tool calling, lets a language model ask your application to run a function. You describe each function with a JSON Schema, the model replies with a function name and arguments, your code runs it, and the model uses the result to continue or answer.

Concepts

How function calling works

A language model on its own only generates text. Function calling gives it a structured way to ask for something it cannot do alone, such as reading a database, checking an order or calling another API. One cycle looks like this:

  1. You send the conversation with tools. Each tool has a name, a description and parameters written as JSON Schema.
  2. The model decides whether a tool would help. If it would, the response carries tool_calls with the function name and JSON arguments, and finish_reason is tool_calls.
  3. Your code checks the arguments and runs the function.
  4. You send the conversation again with the result added as a message with the tool role.
  5. The model answers from the result, or calls another tool.

For example, with a get_order_status function that takes an order_id, the message Check the status of order 1042 produces a call to get_order_status with {"order_id": "1042"}. Your code looks up the order, returns its status, and the model turns that status into a reply.

The model never runs code itself. It proposes a call, and your application decides whether and how to run it, which keeps permissions and side effects under your control.

Controlling tool use

  • tool_choice sets how the model uses tools: auto lets it decide, none prevents calls, required makes it call a tool, and an object naming one function forces that function. Some models accept only auto, or auto and none; each model page lists what it accepts.
  • parallel_tool_calls, on models that offer it, lets the model request several calls in one turn. Run them, then return one result for each call.
  • Descriptions guide the choice. The model picks tools from their names and descriptions, so state what each function does and when to use it, and keep parameter schemas strict with required fields and enum values.
  • Definitions are input. Tool definitions are sent with every request and count as input tokens. Include only the tools a task needs, and keep the list identical between requests so prompt caching can apply on models that support it.

On some reasoning models, a request that forces a tool call runs without reasoning unless it also sets enable_thinking.

Function calling across endpoints

EmpirioLabs AI accepts tools in the shape of each API it is compatible with:

  • /v1/chat/completions takes tools and tool_choice as described above and returns tool_calls.
  • /v1/responses returns calls as function_call output items.
  • /v1/messages round-trips tool_use and tool_result content blocks.
  • Realtime voice models that support it call functions during a live conversation: you declare tools in session.update and return each result as a function_call_output item.

The Chat Completions reference includes a complete tool calling request.

Function tools and built-in tools

Some models also offer built-in tools, such as web search or a code interpreter, that run during the request without a round trip to your code. You turn them on with a model parameter such as tool_web_search, or with a web_search tool on /v1/responses and /v1/messages, on models that offer it. A built-in tool can add its own fee per call or per request, listed in the model's pricing, while a function tool runs in your own application.

On some models a built-in tool is not used when the same request also has function tools, so check the model page before you combine them. Browse text models to see which support function calling, or try a model in the Playground.

The models on EmpirioLabs AI

82 models, cheapest first where they share a billing unit. Each model's page has its full rate card, parameters and code.

Endpoints

POST /v1/chat/completions POST /v1/responses POST /v1/messages POST /v1/completions POST /v1/audio/speech POST /v1/audio/speech:stream WEBSOCKET /v1/realtime

Per 1M tokens, by input rate

ModelInputOutput
GLM 4.5 Flash Z.aiFreeFree
GLM 4.6V Flash Z.aiFreeFree
GLM 4.7 Flash Z.aiFreeFree
Qwen3.7 Flash Alibaba Cloud<=32K $0.03 32K-256K $0.10 256K-1M $0.20<=32K $0.13 32K-256K $0.40 256K-1M $0.80
Qwen3.5 4B Alibaba Cloud$0.04$0.07
Nova Micro 1.0 Amazon$0.040$0.16
GLM 4.6V FlashX Z.ai$0.04$0.40
Gemma 4 26B-A4B Google$0.15$0.05$0.50$0.29
Show all 70 models
ModelInputOutput
Qwen3.5 35B-A3B Alibaba Cloud$0.25 <=128K $0.057 $0.25 128K-256K $0.229$2.00 <=128K $0.459 $2.00 128K-256K $1.835
Nova Lite 1.0 Amazon$0.069$0.28
GLM 4.7 FlashX Z.ai$0.07$0.40
Qwen3.6 35B A3B Alibaba Cloud$0.248$0.07$1.485$0.42
GLM 5.3 Flash Z.ai$0.075$0.25
Qwen3.5 27B Alibaba Cloud$0.30 <=128K $0.086 $0.30 128K-256K $0.258$2.40 <=128K $0.688 $2.40 128K-256K $2.064
Qwen3.5 9B Alibaba Cloud$0.10$0.09$0.15$0.13
Qwen3.5 Flash Alibaba Cloud$0.10$0.090$0.40$0.368
Step 3.5 Flash StepFun$0.10$0.30
Step 3.5 Flash 2603 StepFun$0.10$0.30
MiniMax M3.1 Flash MiniMax$0.15$0.1125$0.60$0.45
Qwen3.5 122B-A10B Alibaba Cloud$0.40 <=128K $0.115 $0.40 128K-256K $0.287$3.20 <=128K $0.917 $3.20 128K-256K $2.294
Seed 2.0 Mini ByteDance<=128K $0.12 128K-256K $0.24<=128K $0.50 128K-256K $1.00
MiMo V2.6 Flash Xiaomi$0.14$0.28
Mistral Small 4 Mistral AI$0.15$0.60
Qwen3.8 Flash Alibaba Cloud$0.16$0.47
Qwen3.8 27B Alibaba Cloud$0.45$0.17$3.20$0.50
Qwen3.5 397B-A17B Alibaba Cloud$0.60 <=128K $0.172 $0.60 128K-256K $0.43$3.60 <=128K $1.032 $3.60 128K-256K $2.58
DeepSeek V4.1 Flash 1017 DeepSeek$0.20$0.80
Muse Glimmer 30B Meta AI$0.35$0.20$1.50$0.80
Step 3.7 Flash StepFun$0.20$1.15
MiniMax M3 MiniMax$0.30 <=512K $0.225 $0.60 >512K $0.45$1.20 <=512K $0.90 $2.40 >512K $1.80
Qwen3.6 Flash Alibaba Cloud<=256K $0.25 256K-1M $1.00<=256K $1.50 256K-1M $4.00
Qwen3.8 Omni Flash Alibaba Cloud$0.30$0.94
Seed 2.0 Lite ByteDance<=128K $0.31 128K-256K $0.62<=128K $2.50 128K-256K $5.00
Qwen3.5 Plus Alibaba Cloud$0.40 <=256K $0.36 $0.50 256K-1M $0.45$2.40 <=256K $2.21 $3.00 256K-1M $2.76
Nova Lite 2 Amazon$0.38$3.16
Qwen3.7 Plus Alibaba Cloud<=256K $0.40 256K-1M $1.20<=256K $1.60 256K-1M $4.80
Seed 2.0 Code ByteDance<=128K $0.40 128K-256K $0.80<=128K $2.40 128K-256K $4.80
Qwen3.6 27B Alibaba Cloud$0.60$0.412564$3.60$2.475384
DeepSeek V4 Flash 0731 DeepSeek$0.424$1.272
MiMo V2.6 Pro Xiaomi$0.435$0.87
Qwen3.6 Plus Alibaba Cloud<=256K $0.50 256K-1M $2.00<=256K $3.00 256K-1M $6.00
Seed 2.1 Turbo ByteDance$0.63$3.13
Seed 2.0 Pro ByteDance<=128K $0.63 128K-256K $1.26<=128K $3.79 128K-256K $7.58
Qwen3.5 Omni Flash Alibaba Cloud$0.80$4.40
GLM 5.1 Z.ai$1.40 <=32K $0.825 $1.40 32K-200K $1.10$4.40 <=32K $3.301 $4.40 32K-200K $3.851
Kimi K2.6 Moonshot AI$0.95$0.8939$4.00$3.7131
Kimi K2.7 Code Moonshot AI$0.95$4.00
Step 5 Preview StepFun$1.00$2.70
Muse Spark 1.1 Meta AI$1.25$4.25
Muse Spark 1.2 Meta AI$1.25$4.25
Muse Spark 1.3 Meta AI$1.25$4.25
DeepSeek V4 Pro 0813 DeepSeek$1.32$3.96
GLM 5.2 Z.ai$1.40$4.40
GLM 5.3 Z.ai$1.40$4.40
StepAudio 3 Chat StepFun$1.50$3.50
Qwen4 Max Alibaba Cloud$1.50$4.50
DeepSeek V4 Pro DeepSeek$1.74$1.65$3.48$3.30
Kimi K2.7 Code Highspeed Moonshot AI$1.90$8.00
Fugu Max Sakana AI$2.00$6.00
Qwen3.8 Max Alibaba Cloud$2.00$6.00
Qwen3.8 Max 0902 Alibaba Cloud$2.00$6.00
Kimi K3.1 Pro Moonshot AI$2.00$10.00
Nova Pro 1.0 Amazon$2.40$9.60
Qwen3.7 Max Alibaba Cloud$2.50$7.50
Qwen3.5 Omni Plus Alibaba Cloud$2.80$16.60
Kimi K3 Moonshot AI$3.00$15.00
MiMo V2.6 Pro UltraSpeed Xiaomi$4.35$8.70
Fugu Ultra v1.1 Sakana AI<=272K $5.00 >272K $10.00<=272K $30.00 >272K $45.00
Fugu Ultra v2.0 Sakana AI<=272K $5.00 >272K $10.00<=272K $30.00 >272K $45.00
Fugu Ultra v1.0 Sakana AI<=272K $7.50 >272K $15.00<=272K $45.00 >272K $67.50

Also available: Mistral Small 3.1, StepAudio 3 Realtime, StepAudio 2.5 Realtime, Qwen3.5 Omni Flash Realtime, Qwen3.5 Omni Plus Realtime, Qwen3.8 Omni Flash Realtime, Qwen Audio 3.1 Realtime Plus, Gemini 3.8 Live, Gemini 3.8 Live Extended Thinking, Qwen Audio 3.1 Realtime Flash, Qwen Audio 3.0 Realtime Plus, Qwen Audio 3.0 Realtime Flash

Frequently asked questions

Does the model run my functions?

No. The model returns the function name and arguments, and your application runs the function and sends back the result. Nothing runs unless your code runs it.

What is the difference between function calling and structured output?

Structured output returns JSON as the final answer. Function calling returns a request for your code to act, then continues once you send back the result.

Can a model call several functions at once?

Models that offer parallel_tool_calls can request several calls in one turn. Run each one and return a result for every call.

Do tool definitions cost tokens?

Yes. Tool definitions are part of the request and count as input tokens on every call, so include only the tools a task needs.

Ready to use better endpoints?

Check out our pricing or reach out if you want your own model deployed on our stack.