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

# Introduction To The AI Gateway

> Get started with the AI Stats Gateway

## Getting started

The full OpenAPI description that powers this reference lives alongside the docs. You
can import it into Postman, Hoppscotch, or your favourite SDK generator to bootstrap a
client automatically.

<Card title="AI Stats Gateway OpenAPI" icon="list-bullet" href="https://github.com/AI-Stats/AI-Stats/blob/main/apps/docs/openapi/v1/openapi.yaml">
  View the specification file
</Card>

All production traffic should target **[https://api.phaseo.app/v1](https://api.phaseo.app/v1)**.

All endpoint paths in this page are relative to that `/v1` base URL.

## Authentication

Most endpoints require a standard gateway API key. Elevated administration APIs
require a management API key created in the dashboard. Supply credentials as an
`Authorization: Bearer` header. Keys use the format
`aistats_v1_sk_<kid>_<secret>` and map back to the teams you manage inside the
dashboard.

```http theme={null}
Authorization: Bearer aistats_v1_sk_<kid>_<secret>
```

If authentication fails you will receive a **401** error response.

## Endpoint overview

The table below outlines the main endpoints available in the AI Stats Gateway right now:

| Endpoint                                                                                                                                                                                                                                                                                | Description                                                                                                                                                                                                                                        |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `POST /chat/completions`, `POST /responses`, `POST /messages`                                                                                                                                                                                                                           | Text generation across OpenAI-compatible and Anthropic-compatible surfaces.                                                                                                                                                                        |
| `POST /embeddings`, `POST /moderations`                                                                                                                                                                                                                                                 | Embeddings and moderation checks.                                                                                                                                                                                                                  |
| `POST /audio/speech`, `POST /audio/transcriptions`, `POST /audio/translations`                                                                                                                                                                                                          | TTS, STT, and audio translations.                                                                                                                                                                                                                  |
| `POST /images/generations`, `POST /images/edits`                                                                                                                                                                                                                                        | Image generation and editing.                                                                                                                                                                                                                      |
| `POST /videos`, `GET /videos`, `GET /videos/models`                                                                                                                                                                                                                                     | Create, list, and discover video generation capabilities.                                                                                                                                                                                          |
| `GET /videos/{video_id}`                                                                                                                                                                                                                                                                | Poll the video job status until complete.                                                                                                                                                                                                          |
| `GET /videos/{video_id}/content`, `POST /videos/{video_id}/download_url`, `DELETE /videos/{video_id}`                                                                                                                                                                                   | Fetch completed video bytes, issue a signed download link, or delete a terminal job record.                                                                                                                                                        |
| `POST /videos/{video_id}/cancel`                                                                                                                                                                                                                                                        | Reserved public cancel route. Currently returns a structured `501 not_implemented_yet` error while provider cancellation is standardized.                                                                                                          |
| `POST /music/generate`, `GET /music/generate/{music_id}`                                                                                                                                                                                                                                | Create and poll music generation jobs.                                                                                                                                                                                                             |
| `POST /ocr`, `POST /batches`, `GET /batches/{batch_id}`, `POST /batches/{batch_id}/cancel`, `POST /files`, `GET /files/{file_id}`, `GET /files/{file_id}/content`                                                                                                                       | OCR is active. Batch endpoints are available in beta. File upload, owned file retrieval, and file content download are active in beta; `GET /files` currently returns `file_list_not_supported_with_shared_gateway_key` on the shared gateway key. |
| `GET /gateway/models`, `GET /gateway/models/me`, `GET /data/models`, `GET /providers`, `GET /endpoints`, `GET /organisations`, `GET /pricing/models`, `POST /pricing/calculate`, `GET /generations?id=...`, `GET /key`, `GET /keys`, `GET /workspaces`, `GET /credits`, `GET /activity` | Platform API discovery endpoints plus elevated administration endpoints.                                                                                                                                                                           |

Use the `endpoints` query parameter on `GET /gateway/models` to reproduce the per-surface catalogues (chat, moderations, embeddings, images, video, or audio) without bouncing between separate endpoints.

Responses include an optional `usage` and `meta` object with your usage, in both tokens and pricing, broken down into clear lines to
see what costs what, as well as detailed timing and performance metadata, such as throughput, latency, and generation time,
to support auditing and debugging.

## Rate limits & billing

We apply no rate limits directly on our platform. Any rate limits are upstream, applied by providers themselves.
We are working to get higher rate limits from upstream providers to ensure that users have a smooth experience.

We apply credit checks prior to all requests made, ensuring that you have a minimum of \$1.00 of credit in the team wallet.
We do this to ensure that users do not accidentally rack up large bills on their accounts. You can top up your team wallet
via the dashboard at any time, with payments typically going through within a few minutes.
