Documentation

Tool calling

Let a model call your functions.

Defining tools

Pass JSON Schema function definitions. Only type: "function" exists — there are no hosted or server-side tools yet, so a tool always runs on your side.

Not every model takes tools. Check supports_tools in the model list first: a model that refuses them returns 400 tools_not_supported before the request reaches it, rather than quietly answering without calling anything.

JSON
1{2  "model": "anthropic/claude-haiku-4-5-20251001-v1:0",3  "messages": [{ "role": "user", "content": "Weather in Istanbul?" }],4  "tools": [{5    "type": "function",6    "function": {7      "name": "get_weather",8      "description": "Current weather for a city",9      "parameters": {10        "type": "object",11        "properties": { "city": { "type": "string" } },12        "required": ["city"]13      }14    }15  }]16}

Server tools

Some tools run on our side instead of yours. You ask for one by putting its id in the same tools array and sending no schema, because the schema is ours:

JSON
1{2  "model": "anthropic/claude-haiku-4-5-20251001-v1:0",3  "messages": [{ "role": "user", "content": "Summarise https://example.com" }],4  "tools": [{ "type": "function", "function": { "name": "sothe:web_fetch" } }]5}

When the model calls it, the gateway runs the tool, feeds the result back and asks the model again — up to four rounds — so what you get is the finished answer, not a tool call to execute. Every round is billed, and the usage on the reply is the total for all of them.

ToolWhat it does
sothe:web_fetchReads a public http(s) page and returns its text, capped at 6,000 characters. Private and link-local addresses are refused, redirects are re-checked at every hop, and non-text responses come back as an error the model can react to.

Each tool has a switch under Tools. A request that asks for one that is turned off is refused with 403 tool_not_allowed, and one that asks for a tool we haven't built yet with 400 tool_unavailable — never silently ignored. Names beginning sothe: or sothe_ are reserved, so your own tools cannot be confused with ours.

Your tools and ours can be mixed

Send both kinds in one request if you like. If the model calls one of yours, the reply comes straight back to you with the tool call, exactly as it would without server tools — we only keep looping while every call in the turn is one of ours.

tool_choice

ValueEffect
"auto"The model decides. This is the default when tools are present.
"none"Tools are dropped from the request entirely.
"required"The model must call one of them.
{ "type": "function", "function": { "name": "..." } }The model must call that one.

The round trip

The reply comes back with finish_reason: "tool_calls". Run the function, then send the whole conversation again with the assistant message and a tool message answering it.

1"messages": [2  { "role": "user", "content": "Weather in Istanbul?" },3  { "role": "assistant", "tool_calls": [{4      "id": "call_1",5      "type": "function",6      "function": { "name": "get_weather", "arguments": "{\"city\":\"Istanbul\"}" }7  }] },8  { "role": "tool", "tool_call_id": "call_1", "content": "18C, clear" }9]

A request may define up to 128 tools. Tool results are text; a tool cannot return an image.