Skip to main content
Tool calling lets models request structured actions (for example, database lookups, weather checks, or internal API calls) instead of guessing answers. The Gateway supports tool payloads across these text endpoints:
  • /v1/chat/completions (OpenAI-style tools and tool_calls)
  • /v1/responses (Responses-style function_call output items)
  • /v1/messages (Anthropic-style tool_use blocks)

Request

curl https://api.phaseo.app/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5-nano",
    "messages": [
      { "role": "user", "content": "What is the weather in London?" }
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get current weather by city",
          "parameters": {
            "type": "object",
            "properties": {
              "city": { "type": "string" }
            },
            "required": ["city"]
          }
        }
      }
    ],
    "tool_choice": {
      "type": "function",
      "function": { "name": "get_weather" }
    },
    "stream": false
  }'

Response

{
  "id": "chatcmpl_...",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "finish_reason": "tool_calls",
      "message": {
        "role": "assistant",
        "content": null,
        "tool_calls": [
          {
            "id": "call_123",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": "{\"city\":\"London\"}"
            }
          }
        ]
      }
    }
  ]
}
Run your tool, then send the tool result back in the next request so the assistant can finish the answer.

Current limitation

At the gateway request-contract layer, stream: true with tools currently returns 400 invalid_request with: Streaming with tools is not supported. Set stream to false when tools are present. For now, run tool-calling requests with stream: false.

Next guides

  1. Tool Calling Patterns
  2. Tool Calling Safety and Validation
  3. Structured Outputs
Last modified on February 18, 2026