> ## 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.

# Cookbook

> Practical, scenario-driven recipes for building with Phaseo.

Use the cookbook when you know what you want to build and need a working path from setup to verification.

## Start with a working request

> [card] [Launch on the free router](https://phaseo.app/docs/v1/cookbook/free-router-first-deploy.md)
>
> Send a live request without choosing or funding a specific model first.

> [card] [Build a Next.js web chat app](https://phaseo.app/docs/v1/cookbook/build-a-nextjs-web-chat-app.md)
>
> Build a browser chat interface while keeping your Phaseo API key on the server.

> [card] [Build a Node REST smoke app](https://phaseo.app/docs/v1/cookbook/build-a-node-rest-smoke-app.md)
>
> Use raw HTTP to verify a backend integration with the smallest practical example.

> [card] [Build a Python gateway CLI](https://phaseo.app/docs/v1/cookbook/build-a-python-gateway-cli.md)
>
> Create a command-line workflow with the Python SDK.

> [!TIP]
>
> Want a coding agent to scaffold the project? Start with the [mini app starter prompts](https://phaseo.app/docs/v1/cookbook/mini-app-starter-prompts.md).

## Choose a recipe by outcome

> [card] [Build an application](https://phaseo.app/docs/v1/cookbook/build-a-nextjs-web-chat-app.md)
>
> Follow complete walkthroughs for browser apps, authenticated workbenches, backend scripts, and CLIs.

> [card] [Control routing and policy](https://phaseo.app/docs/v1/cookbook/preset-rollout-and-routing-debug.md)
>
> Roll out presets, choose providers, enforce residency requirements, and control API keys.

> [card] [Search and return structured data](https://phaseo.app/docs/v1/cookbook/sdk-typescript-managed-search.md)
>
> Ground requests with web search or fetch, then validate and recover structured output.

> [card] [Start with an Agent SDK](https://phaseo.app/docs/v1/cookbook/agent-sdk-durable-loop.md)
>
> Build a bounded tool loop in TypeScript, Python, Go, C#, Java, PHP, or Ruby.

> [card] [Build advanced agent workflows](https://phaseo.app/docs/v1/cookbook/agent-sdk-research-brief.md)
>
> Add research, human review, parallel tools, structured outputs, and coding workflows.

## Popular recipes

* [Sort providers by price, latency, or throughput](https://phaseo.app/docs/v1/cookbook/sort-providers-by-price-latency-or-throughput.md)
* [Route only to EU or ZDR providers](https://phaseo.app/docs/v1/cookbook/route-only-to-eu-or-zdr-providers.md)
* [Recover malformed structured JSON](https://phaseo.app/docs/v1/cookbook/response-healing-for-structured-json.md)
* [Research with agent-backed web search](https://phaseo.app/docs/v1/cookbook/agent-sdk-research-brief.md)
* [Fan out local agent tools concurrently](https://phaseo.app/docs/v1/cookbook/agent-sdk-parallel-tools.md)

## Related guides

* [Quickstart](https://phaseo.app/docs/v1/quickstart.md)
* [Examples](https://phaseo.app/docs/v1/guides/examples.md)
* [Routing and Fallbacks](https://phaseo.app/docs/v1/guides/routing-and-fallbacks.md)
* [Agent SDK overview](https://phaseo.app/docs/v1/sdk-reference/agent-sdk/overview.md)


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