> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Phaseo Gateway base URL: https://api.phaseo.app/v1. Send `Authorization: Bearer $PHASEO_API_KEY` with every request.
> Model IDs look like `provider/model`, for example `openai/gpt-6-astra`. Do not guess IDs: list them with `GET /v1/models` or check https://phaseo.app/models. `phaseo/free` routes to an available free model and needs no wallet balance.
> For new text integrations prefer `POST /v1/responses`. `POST /v1/chat/completions` (OpenAI format) and `POST /v1/messages` (Anthropic format) suit existing code.
> The full API contract is https://phaseo.app/docs/openapi/v1/openapi.yaml. Official SDKs: `@phaseo/sdk` (TypeScript) and `phaseo` (Python), plus Go, C#, PHP, Ruby and Rust.
> Search these docs over MCP at https://phaseo.app/docs/mcp, and install Phaseo skills with `npx skills add https://phaseo.app/docs`. If a page is wrong or out of date, report it with the MCP `submit_feedback` tool.
> Manage Phaseo accounts with the `phaseo` CLI (`npm install -g @phaseo/cli`, then `phaseo login` or `phaseo login --device-code`), the `/v1` Management API or the MCP server at `https://mcp.phaseo.app/mcp?access=manage`. Do not send users to the dashboard for account tasks. A person is still needed for sign-up, approving a sign-in, paying the first top-up on the checkout link that `phaseo credits add` returns when no card is saved, confirming each saved-card top-up from the emailed link, and account security (password, MFA, passkeys). Create API keys with `phaseo keys create --name <name> --json`; never guess one. Credit top-ups need `phaseo login --scopes billing:write` first. Task map: https://phaseo.app/docs/v1/developers/manage-from-an-agent.md.

# Server Tools

> Let models call Phaseo-operated tools during a request.

Server tools are tools that Phaseo runs for you during a model request. The model decides when to call them, Phaseo executes the tool server-side, and the tool result is fed back into the model loop.

Use server tools when the model needs current time, web context, fetched page text, or a second model's advice without adding your own tool executor.

> [!NOTE]
>
> Server tools are in beta. Request shapes and result payloads may evolve as provider support changes.

## Available tools

| Tool | Type | Use it for |
| - | - | - |
| Datetime | `phaseo:datetime` | Current date and time in up to 5 timezones |
| Web Search | `phaseo:web_search` | Model-directed web searches during a request |
| Web Fetch | `phaseo:web_fetch` | Fetching and extracting text from specific URLs |
| Advisor | `phaseo:advisor` | Consulting another model mid-generation |
| Subagent | `phaseo:subagent` | Delegating focused work to a worker model |
| Fusion | `phaseo:fusion` | Parallel analysis followed by model synthesis |
| Search Models | `phaseo:search_models` | Finding suitable models from the live catalogue |
| Image Generation | `phaseo:image_generation` | Creating images from the model tool loop |
| Apply Patch | `phaseo:apply_patch` | Producing validated file patches on the Responses API |

## How server tools work

1. Add one or more server tools to the `tools` array.
2. The model decides whether it needs a tool and emits a tool call.
3. Phaseo intercepts the server-tool call, executes it, and sends the result back to the model.
4. The model continues and writes the final response.

Server tools can be used alongside your own function tools. Phaseo executes only the server tools; your application still handles regular `function` tool calls.

## Quick start

```bash theme={null}
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 are the latest AI policy updates this week?" }
    ],
    "tools": [
      { "type": "phaseo:web_search" },
      { "type": "phaseo:datetime", "parameters": { "timezones": ["Europe/London", "UTC"] } }
    ]
  }'
```

## Combining with function tools

```json theme={null}
{
  "model": "openai/gpt-5-nano",
  "messages": [
    { "role": "user", "content": "Find recent funding news and save the best item." }
  ],
  "tools": [
    { "type": "phaseo:web_search", "parameters": { "max_results": 3 } },
    {
      "type": "function",
      "function": {
        "name": "save_research_item",
        "description": "Save a selected research item",
        "parameters": {
          "type": "object",
          "properties": {
            "title": { "type": "string" },
            "url": { "type": "string" }
          },
          "required": ["title", "url"]
        }
      }
    }
  ]
}
```

If the model calls `phaseo:web_search`, Phaseo executes that call automatically. If it calls `save_research_item`, your application receives the function call and must return the function result in a follow-up request.

## Supported endpoints

Server tools are supported on:

* `/v1/chat/completions`
* `/v1/responses`
* `/v1/messages`

Streaming requests are supported. For gateway-managed server tools, Phaseo may materialize the upstream tool-call turn, execute the server tool, continue the loop, and emit a synthetic stream for the final response.

## Usage tracking

Server-tool usage is reported in `usage.server_tool_use`:

```json theme={null}
{
  "usage": {
    "input_tokens": 105,
    "output_tokens": 250,
    "server_tool_use": {
      "datetime_requests": 1,
      "web_search_requests": 2,
      "web_search_results": 8,
      "web_fetch_requests": 1,
      "advisor_requests": 1,
      "subagent_requests": 1,
      "fusion_requests": 1,
      "search_models_requests": 1,
      "image_generation_requests": 1
    }
  }
}
```

Pricing can also use server-tool meters such as `server_tool_web_search_requests`, `server_tool_web_search_extra_results`, `server_tool_web_fetch_requests`, `server_tool_advisor_requests`, `server_tool_image_generation_requests`, `native_web_search_requests`, and `native_web_fetch_requests` when configured on model price cards.

## Tool pages

> [card] [Datetime](https://phaseo.app/docs/v1/guides/server-tools/datetime.md)
>
> Give the model the current date and time.

> [card] [Web Search](https://phaseo.app/docs/v1/guides/server-tools/web-search.md)
>
> Let the model search the web when it needs current information.

> [card] [Web Fetch](https://phaseo.app/docs/v1/guides/server-tools/web-fetch.md)
>
> Let the model fetch and read specific URLs.

> [card] [Advisor](https://phaseo.app/docs/v1/guides/server-tools/advisor.md)
>
> Let one model consult another model for guidance mid-generation.

> [card] [Subagent](https://phaseo.app/docs/v1/guides/server-tools/subagent.md)
>
> Let the model delegate focused tasks to a worker model.

> [card] [Fusion](https://phaseo.app/docs/v1/guides/server-tools/fusion.md)
>
> Run parallel model analysis and synthesize the findings.

> [card] [Search Models](https://phaseo.app/docs/v1/guides/server-tools/search-models.md)
>
> Let the model search the live Phaseo catalogue for a suitable model.

> [card] [Image Generation](https://phaseo.app/docs/v1/guides/server-tools/image-generation.md)
>
> Let the model create images while answering.

> [card] [Apply Patch](https://phaseo.app/docs/v1/guides/server-tools/apply-patch.md)
>
> Generate a validated create, update, or delete patch.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.