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

# Roll out presets and debug routing

> Use presets to standardize prompt and routing defaults, then inspect request details to understand why Phaseo routed a request the way it did.

Use this recipe when you want one reusable preset for multiple services instead of copying the same prompt, model, and routing defaults everywhere.

## Goal

* Standardize prompt and parameter defaults.
* Limit which providers can be used for a rollout or compliance boundary.
* Keep enough request context to explain why a request routed the way it did.

## 1. Create the preset

In **Dashboard -> Settings -> Presets**, create a preset with:

* a clear name and slug
* a system prompt
* approved models
* provider preferences
* default parameter values such as `temperature`

Use the preset slug in your calling code so the same request policy can be reused across environments.

## 2. Keep the request body small

The main advantage of presets is that the caller no longer needs to repeat the same routing and prompt defaults in every request.

```bash cURL theme={null}
curl https://api.phaseo.app/v1/responses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4-5",
    "input": "Generate a release summary for the last 24 hours.",
    "preset": "release-summary"
  }'
```

```typescript TypeScript SDK theme={null}
import Phaseo from "@phaseo/sdk";

const client = new Phaseo({ apiKey: process.env.PHASEO_API_KEY! });

const response = await client.generateResponse({
  model: "anthropic/claude-sonnet-4-5",
  input: "Generate a release summary for the last 24 hours.",
  preset: "release-summary",
});

console.log(response.output_text);
```

```python Python SDK theme={null}
from phaseo import Phaseo

client = Phaseo(api_key="YOUR_API_KEY")

response = client.generate_response(
    {
        "model": "anthropic/claude-sonnet-4-5",
        "input": "Generate a release summary for the last 24 hours.",
        "preset": "release-summary",
    }
)

print(response.get("output_text"))
```

## 3. Understand what the preset changes

The preset is applied before provider routing:

* missing request parameters are filled from the preset
* the preset prompt is prepended to the system layer
* provider preferences narrow the list of available providers before ranking
* model restrictions are checked early instead of silently rerouting

## 4. Debug the routing outcome

When a request does not route the way you expected, open the request in **Gateway -> Usage** and inspect:

* providers considered
* ranked candidates
* routing factors attached to each candidate
* workspace-policy or guardrail blocks

This is the fastest way to answer:

* why a provider was skipped
* why a request was blocked
* why a lower-cost or lower-latency target won the ranking

## 5. Operational pattern

Use this rollout pattern when changing routing behavior:

1. Create a new preset slug for the new policy.
2. Move one low-risk caller to the new preset.
3. Inspect request details and activity trends.
4. Expand the rollout only after the routing outcomes match expectations.

## Related guides

* [Presets](https://phaseo.app/docs/v1/guides/presets.md)
* [Routing and Fallbacks](https://phaseo.app/docs/v1/guides/routing-and-fallbacks.md)
* [Error Handling](https://phaseo.app/docs/v1/api-reference/errors.md)


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