Skip to Content
CosmicAC Logo
API referenceInference API

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_xxxxxxxxxxxxxxxxxxxxxxxx

The routes use the following authentication modes.

ModeBehaviorUsed by
NoneThe route runs no authentication.GET /v1/health
API keyThe request needs a valid API key.GET /v1/auth/validate
API key for the endpoint's teamThe 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 tokenThe 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 403 status 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.

HeaderRequiredDescription
ttr-team-tokenYesThe team token from cosmicac-app-node.
X-Team-IdNoNarrows 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.

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.

HeaderDescription
retry-afterThe number of seconds to wait before you retry.
x-ratelimit-limitThe maximum number of requests in the window.
x-ratelimit-remainingThe number of requests left in the window.
x-ratelimit-resetThe number of seconds until the window resets.

Route pages

Endpoints

MethodPathRoute page
POST/v1/endpoints/<endpoint-name>/v1/chat/completionsInference routes
POST/v1/endpoints/<endpoint-name>/v1/audio/transcriptionsInference routes
GET/v1/modelsModel routes
GET/v1/models/<endpoint-name>Model routes
GET/v1/models/statsModel routes
GET/v1/models/stats/<endpoint-name>Model routes
GET/v1/healthHealth routes
POST/v1/models/health-checkHealth routes
GET/v1/auth/validateAuthentication routes

What's next

On this page