Docs
API referenceSign in

Tool calling

Send function definitions only to a model whose catalog metadata explicitly includes tool support.

Define a tool

Chat request
{
  "model": "YOUR_APPROVED_MODEL_ID",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather in Paris?"
    }
  ],
  "max_tokens": 256,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Look up weather for a city",
        "parameters": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string"
            }
          },
          "required": [
            "city"
          ]
        }
      }
    }
  ],
  "tool_choice": "auto"
}

Run the tool loop

  1. Read the assistant's tool_calls from the response.
  2. Validate the requested function and arguments in your own application.
  3. Obtain any authorization required for the action, then execute the tool.
  4. Send the tool result back with the matching tool_call_id.

The gateway relays tool definitions and results. It does not run tools. Treat model output and tool arguments as untrusted input.

Capability errors

A model without verified tool support returns an unsupported_capability error when tools or tool messages are supplied. Check the catalog before enabling a client's tool mode.