# API reference

> TokRouter endpoints, common headers and error conventions.

Every endpoint shares the origin `https://api.tokrouter.dev` and the same `sk-` token.

## Endpoints

| Method and path | Description |
| --- | --- |
| `POST /v1/chat/completions` | OpenAI Chat Completions, the most common entry point |
| `POST /v1/responses` | OpenAI Responses API |
| `POST /v1/messages` | Anthropic Messages |
| `POST /v1beta/models/{model}:generateContent` | Native Gemini (`:streamGenerateContent` for streaming) |
| `POST /v1/services/aigc/text-generation/generation` | Native DashScope (official `/api` prefix removed) |
| `POST /v1/systemone` | Jev decision model passthrough (no streaming) |
| `GET /v1/models` | Models available to this token |
| `POST /v2/rerank` | Reranking |
| `GET /health` | Health check |

## Common headers

| Header | Required | Notes |
| --- | --- | --- |
| `Authorization: Bearer sk-…` | OpenAI / DashScope protocols | `x-api-key` also accepted |
| `x-api-key: sk-…` | Anthropic protocol | |
| `x-goog-api-key: sk-…` | Gemini protocol | |
| `Content-Type: application/json` | Yes | |
| `anthropic-version` | Recommended for Anthropic | e.g. `2023-06-01` |

## Errors

- The HTTP status indicates the class (`401` auth, `402/403` quota or permission, `429` rate limit,
  `5xx` upstream)
- The body is JSON, and its shape follows the inbound protocol (OpenAI:
  `{"error":{"message":…,"type":…}}`, Anthropic: `{"type":"error","error":{…}}`)
- Failed requests are not billed

<Callout type="warn" title="Error details belong to the upstream">
The gateway aggregates vendors, so the `type` / `code` values come from each vendor. This page does not
enumerate them — any enumeration would go stale. Read the `error` field in the response body and the
vendor's docs.
</Callout>

## Machine-readable spec

`/openapi.yaml` serves an OpenAPI 3.1 description, suitable for code generators and agent tooling.
