All models, capabilities, and prices

Tool use

Function-calling on the Anthropic-native endpoint. The gateway normalizes tool_choice so legacy SDKs that emit {type:any} or {type:tool} keep working.

Request shape

Declare tools as an array. Each tool has a name, a description, and a JSON-Schema input_schema. The model emits a tool_use content block whenever it decides to call one.

json
{
  "model": "claude-sonnet-5-5",
  "max_tokens": 1024,
  "tools": [
    {
      "name": "get_weather",
      "description": "Return current weather for a city.",
      "input_schema": {
        "type": "object",
        "properties": {
          "city":  { "type": "string" },
          "units": { "type": "string", "enum": ["c", "f"] }
        },
        "required": ["city"]
      }
    }
  ],
  "messages": [
    { "role": "user", "content": "What's the weather in Berlin in celsius?" }
  ]
}

Response with a tool call

json
{
  "id": "msg_01...",
  "stop_reason": "tool_use",
  "content": [
    { "type": "text", "text": "Let me check that for you." },
    {
      "type": "tool_use",
      "id":   "toolu_bdrk_01...",
      "name": "get_weather",
      "input": { "city": "Berlin", "units": "c" }
    }
  ]
}

Continuing the loop

After your code executes the tool, send the result back as a user message containing a tool_result block. The model then either emits another tool call or a final text answer.

json
{
  "role": "user",
  "content": [
    {
      "type": "tool_result",
      "tool_use_id": "toolu_bdrk_01...",
      "content": "{\"city\":\"Berlin\",\"temp_c\":18,\"sky\":\"clear\"}"
    }
  ]
}

tool_choice — how we normalize

Anthropic accepts four tool_choice forms. The API-AI gateway accepts all four from your client, but rewrites two of them on the way out:

Reference data
Client sendsGateway forwardsWhy
{"type":"auto"} (or absent)unchangedModel decides — happy path.
{"type":"none"}unchangedForce text-only response.
{"type":"any"}{"type":"auto"} + system hintUpstream returns 502 on any; we hint the model "you MUST call a tool" instead.
{"type":"tool","name":"X"}{"type":"auto"} + system hintSame upstream issue; hint specifies the tool name.
Why this matters
Until 2026-05-09 the upstream returned 502 deterministically on tool_choice:any andtool_choice:tool. We verified this across a 72-request battery in our internal QA harness. Our shim recovers ~95% of these requests by rewriting to auto + a strong system hint. If you see a tool-call you expected get replaced with prose, the hint failed to nudge the model — tighten your user prompt or switch to a more capable model.

Parallel tool calls

A single response can contain multiple tool_use blocks — the model decides whether to fan out. Execute all of them, then send back one user message with multipletool_result blocks (one per tool_use_id). Order doesn’t matter.

Tool naming

  • Names are case-sensitive and pass through verbatim — the model echoes whatever you registered.
  • Both snake_case and PascalCase work. The Claude Code CLI uses PascalCase (Read, Bash, Edit); generic SDKs typically use snake_case.
  • Keep names <64 chars and ASCII [a-zA-Z0-9_].

OpenAI-style tool calling

On the /v1/chat/completions endpoint, use the standard OpenAI tools /tool_calls shape — we translate it to Anthropic tool_use blocks under the hood.

Last updated: October 2, 2026Found a bug? admin@minedom-france.fr