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

# Migrating from Cloudflare AI Gateway

> Replace a Cloudflare AI Gateway route with Phaseo while preserving your application request flow.

Use this guide when your application already sends OpenAI-compatible requests through Cloudflare AI Gateway. Move the gateway boundary first, then recreate only the routing, caching, and observability behavior your production traffic actually needs.

## What changes

| Setting | Before | After |
| - | - | - |
| Gateway URL | Account and gateway-specific Cloudflare URL | `https://api.phaseo.app/v1` |
| Authentication | Cloudflare and provider credentials | `PHASEO_API_KEY` |
| Routing policy | Cloudflare gateway configuration | Phaseo routing settings and presets |
| Request visibility | Cloudflare analytics | Phaseo activity and request details |

**1. Inventory the current gateway configuration**

Record the Cloudflare gateway URL, provider routes, custom headers, cache rules, retry behavior, and analytics your application relies on. This separates required behavior from settings that no longer need to move.

**2. Replace the endpoint and credentials**

Keep the request payload unchanged where possible and update the OpenAI-compatible client boundary.

```typescript TypeScript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.PHASEO_API_KEY,
  baseURL: "https://api.phaseo.app/v1",
});

const response = await client.chat.completions.create({
  model: "openai/gpt-4.1-mini",
  messages: [{ role: "user", content: "Reply with: migration ready" }],
});
```

```python Python theme={null}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["PHASEO_API_KEY"],
    base_url="https://api.phaseo.app/v1",
)
```

```bash cURL theme={null}
curl https://api.phaseo.app/v1/chat/completions \
  -H "Authorization: Bearer $PHASEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4.1-mini",
    "messages": [{"role": "user", "content": "Reply with: migration ready"}]
  }'
```

**3. Recreate routing and shared defaults**

Move stable provider restrictions, prompt defaults, and generation parameters into [Presets](https://phaseo.app/docs/v1/guides/presets.md). Configure provider ranking and fallback behavior through [Routing and Fallbacks](https://phaseo.app/docs/v1/guides/routing-and-fallbacks.md).

Cloudflare cache and analytics settings do not transfer automatically. Decide explicitly whether each behavior belongs in Phaseo, your application, or your edge layer.

**4. Validate before cutover**

Test non-streaming, streaming, errors, tools, and structured outputs as applicable. Compare latency, output, token usage, and cost before moving traffic gradually.

## Migration checklist

* Cloudflare-specific gateway URLs and headers have been removed.
* Production model IDs are verified against `GET /v1/models`.
* Required cache behavior has been deliberately recreated or retired.
* Activity and request details provide the visibility your team needs.
* Rollback remains a configuration-only endpoint and key change.

## Next steps

* [Presets](https://phaseo.app/docs/v1/guides/presets.md)
* [Routing and Fallbacks](https://phaseo.app/docs/v1/guides/routing-and-fallbacks.md)
* [Observability](https://phaseo.app/docs/v1/guides/integrations/observability.md)


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