Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ai-stats.phaseo.app/llms.txt

Use this file to discover all available pages before exploring further.

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.

Built-in server tool: datetime

The gateway currently exposes one built-in server tool:
  • gateway:datetime
Web-search tool types are temporarily disabled at the gateway request layer. This tool runs on the gateway side (no client-side executor required). The gateway rewrites it into an upstream tool/function call, executes it, and feeds the tool result back into the model loop. Supported request shape:
{
  "tools": [
    {
      "type": "gateway:datetime",
      "parameters": {
        "timezone": "Europe/London"
      }
    }
  ]
}
Notes:
  • parameters.timezone is optional and must be a valid IANA timezone.
  • timezone can also be provided as a top-level shortcut on the tool object.
  • The result contains ISO datetime plus the resolved timezone.
  • Usage includes usage.server_tool_use.datetime_requests.
  • Prefer tool_choice: "auto" so the model can decide when to call it.

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 April 1, 2026