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

# Request Labels

> Attribute gateway requests to code-defined teams, features, or environments and slice spend by label.

Use request labels when application code needs a stable cost dimension that is more specific than an API key or application. Labels are captured with the request audit and can be filtered in analytics without changing the model request.

To label requests automatically from their content, use [request classifiers](https://phaseo.app/docs/v1/guides/request-classifiers.md). Their answers are stored as request labels and filter the same way.

## Send labels

Set `X-Phaseo-Metadata` to a JSON object containing up to 32 unique key/value labels:

```bash theme={null}
curl https://api.phaseo.app/v1/responses \
  -H "Authorization: Bearer $PHASEO_API_KEY" \
  -H "Content-Type: application/json" \
  -H 'X-Phaseo-Metadata: {"labels":[{"key":"team","value":"support"},{"key":"environment","value":"production"}]}' \
  -d '{
    "model": "openai/gpt-5-nano",
    "input": "Summarize this ticket."
  }'
```

The TypeScript and Python SDKs accept custom headers, so the same header can be configured on the client. Labels are not forwarded to providers.

## Slice spend

Use the analytics endpoint with both `label_key` and `label_value`:

```text theme={null}
GET /v1/analytics?label_key=team&label_value=support
```

The response uses the same grouped spend format as unfiltered analytics, but only includes requests carrying that exact label pair.

## Contract

* Keys use letters, numbers, `_`, `.`, `:`, or `-` and are limited to 64 characters.
* Values are strings limited to 256 characters.
* A request may contain up to 32 labels and the header is limited to 8 KiB.
* Duplicate keys or malformed metadata are rejected with `400 invalid_request`.
* Do not put prompts, secrets, email addresses, or other personal data in labels.


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