Inference API reference
Routes of the inference API, with the base URL, authentication, team scoping, and rate limits that apply to them.
The inference API serves chat completions and audio transcriptions from your Managed Inference endpoints, and reports model details, usage statistics, and health. This page describes the base URL, authentication, team scoping, and rate limits of the API, and lists its routes. Each route page lists the route's parameters, request body, and example requests.
Base URL
Every path in this reference is relative to your inference URL, which is the INFERENCE_APP_NODE_URL value that cosmicac config show prints. The example requests on the route pages use https://your-inference-url in its place.
Authentication
CosmicAC reads the API key from the Authorization header as a Bearer token. A key must start with the csm_live_ prefix.
Authorization: Bearer csm_live_xxxxxxxxxxxxxxxxxxxxxxxxThe routes use the following authentication modes.
| Mode | Behavior | Used by |
|---|---|---|
| None | The route runs no authentication. | GET /v1/health |
| API key | The request needs a valid API key. | GET /v1/auth/validate |
| API key for the endpoint's team | The request needs a valid API key that belongs to the team that owns the endpoint. | POST /v1/endpoints/<endpoint-name>/v1/chat/completions, POST /v1/endpoints/<endpoint-name>/v1/audio/transcriptions |
| Team token | The request needs a team token that cosmicac-app-node issues to a signed-in user. | GET /v1/models, GET /v1/models/<endpoint-name>, GET /v1/models/stats, GET /v1/models/stats/<endpoint-name>, POST /v1/models/health-check |
Team scoping
Team scoping limits an API key to the endpoints of its team, and a team token to the endpoints of the teams that it lists. The following checks apply.
- Chat completions and audio transcriptions: the API key must belong to the team that owns the endpoint. A key or an endpoint with no team fails this check with a
403status code. - Routes that take a team token: the route returns or checks only the endpoints of the token's teams. An endpoint outside those teams returns the same error as an unknown endpoint.
Routes that take a team token read the following request headers.
| Header | Required | Description |
|---|---|---|
ttr-team-token | Yes | The team token from cosmicac-app-node. |
X-Team-Id | No | Narrows the scope to one of the token's teams. |
Rate limits
CosmicAC limits chat completion and audio transcription requests for each API key. Each route has its own limit. The following table lists the default limits.
| Route | Requests per minute |
|---|---|
POST /v1/endpoints/<endpoint-name>/v1/chat/completions | 60 |
POST /v1/endpoints/<endpoint-name>/v1/audio/transcriptions | 30 |
A deployment can change these limits. CosmicAC applies the limits only if cosmicac-proxy-inference can reach Redis. For more information, see Rate limit settings.
A request over the limit returns a 429 status code, and the code is rate_limit_exceeded. The response includes the following headers.
| Header | Description |
|---|---|
retry-after | The number of seconds to wait before you retry. |
x-ratelimit-limit | The maximum number of requests in the window. |
x-ratelimit-remaining | The number of requests left in the window. |
x-ratelimit-reset | The number of seconds until the window resets. |
Route pages
Endpoints
| Method | Path | Route page |
|---|---|---|
POST | /v1/endpoints/<endpoint-name>/v1/chat/completions | Inference routes |
POST | /v1/endpoints/<endpoint-name>/v1/audio/transcriptions | Inference routes |
GET | /v1/models | Model routes |
GET | /v1/models/<endpoint-name> | Model routes |
GET | /v1/models/stats | Model routes |
GET | /v1/models/stats/<endpoint-name> | Model routes |
GET | /v1/health | Health routes |
POST | /v1/models/health-check | Health routes |
GET | /v1/auth/validate | Authentication routes |