Skip to main content
MESH forwards tools[] and tool_choice to tool-capable models and returns OpenAI-shaped tool_calls in the response. Streaming responses include tool-call deltas. The Models catalogue marks which models support tool calling. Anthropic Claude, Llama 3.x / 4.x, Mistral / Ministral / Pixtral, Qwen, Kimi, GLM 4.7+, and the MESH house tier all accept tool definitions.

Request a tool

Response

When the model calls a tool, finish_reason is tool_calls and the assistant message carries a tool_calls[] array.

Send the result back

Append the assistant message and a role: "tool" message keyed to the tool_call_id for a follow-up turn:

Disabling tools

tool_choice: "none" disables calls for that request. tool_choice: "auto" (the default) lets the model decide. Pin a specific function with { "type": "function", "function": { "name": "get_weather" } }.

Billing

Tool definitions count toward prompt_tokens (input). Tool-call output tokens count toward completion_tokens. Both are billed at the model’s standard rate — receipts on every response include the breakdown via x-mesh-upstream-cost-usd, x-mesh-margin-usd, x-mesh-total-usd.