anonrouterdocs

API reference

The public HTTP surface for AnonRouter integrations.

The production API base URL is:

https://api.anonrouter.ai/v1

Requests authenticate one of three ways, depending on the endpoint:

  • Inference key (ar_) in Authorization: Bearer to issue tickets and, in compatibility mode, to call inference directly.
  • Management key (arm_) in Authorization: Bearer to read balance and usage.
  • Inference ticket in the x-anonrouter-ticket header to run a single ticketed request.

Some account and billing operations require an authenticated session and are performed from the dashboard rather than with an API key.

Inference

MethodEndpointCredentialDescription
GET/modelsInference or management keyList enabled models and capabilities
GET/catalog/modelsNonePublic, cacheable catalog with privacy metadata
GET/models/uptimeNonePassive success-rate and latency series
POST/inference/ticketsInference keyIssue a single-use inference ticket
POST/chat/completionsTicketCreate a streaming or non-streaming chat completion
POST/embeddingsTicketCreate vector embeddings
POST/images/generationsTicketGenerate an image (when enabled)
POST/audio/speechInference keySynthesize speech (when enabled)
GET/capabilitiesNoneReport enabled feature flags

In compatibility mode, /chat/completions and /embeddings accept an inference key directly instead of a ticket.

Routing

MethodEndpointCredentialDescription
GET/routing/effectiveInference keyList models the saved preferences allow
GET/routing/preferencesSessionRead saved routing preferences
PUT/routing/preferencesSessionReplace saved routing preferences
POST/routing/previewSessionPreview a routing decision
POST/routing/eligible-modelsNoneList models eligible for draft preferences

Account

MethodEndpointCredentialDescription
GET/balanceManagement keyRead available and reserved balance
GET/usageManagement keyRead recent usage metadata

Workspaces

MethodEndpointCredentialDescription
GET/workspacesSessionList workspaces
POST/workspacesSessionCreate a workspace
PATCH/workspaces/:idSessionEdit a workspace
DELETE/workspaces/:idSessionDelete a workspace

Billing

MethodEndpointCredentialDescription
GET/billing/catalogSessionPackages, limits, fee, and terms
GET/billing/ordersSessionList purchase orders
GET/billing/orders/:orderIdSessionPoll one order
GET/billing/receiptsSessionList receipts
GET/billing/receipts/:receiptNumberSessionFetch one receipt

Response headers

Successful inference responses include:

  • x-anonrouter-selected-model: the chosen provider/model.
  • x-anonrouter-routing: auto or exact.
  • x-ratelimit-limit-requests, x-ratelimit-remaining-requests, x-ratelimit-reset-requests, and the matching -tokens variants.

Errors

Errors use an OpenAI-style envelope with a machine-readable type and a request_id:

{
  "error": {
    "message": "Inference ticket is invalid or expired",
    "type": "invalid_ticket",
    "request_id": "req_..."
  }
}

Common cases:

StatustypeMeaning
401ticket_requiredA ticket is required and none was sent
401invalid_ticketThe ticket is invalid, expired, or already used
403insufficient_scopeThe credential lacks the required scope
402insufficient_balanceNot enough prepaid balance
404model_not_foundThe model is unknown or not enabled
409ticket_model_mismatchThe request model differs from the ticket
409ticket_reasoning_mismatchThe reasoning selection differs from the ticket
429rate_limitedRate limit exceeded; see retry-after
503media_disabledImage or speech is not enabled on this deployment

A 429 response also sets a retry-after header. During streaming, a mid-stream provider failure is delivered as an inline SSE error frame rather than an HTTP status, because the response headers have already been sent.

On this page