API reference
OpenAI-compatible chat / models endpoints + tokenroute management API.
tokenroute exposes two surfaces:
OpenAI-compatible (/v1/*)
Drop-in replacement for api.openai.com/v1. Same request/response shapes, just point your SDK at https://api.tokenroute.io/v1 and use an sk-tr-* key. See Quickstart for SDK snippets.
| Endpoint | Status |
|---|---|
POST /v1/chat/completions | Live (streaming supported) |
GET /v1/models | Live |
POST /v1/embeddings | Phase B |
Management API (/api/v1/*)
Account, key, balance, and top-up management. Two auth modes:
- Logto JWT (Bearer) — for user-facing endpoints (
/api/v1/me,/api/v1/balance,/api/v1/topup,/api/v1/me/keys). Obtained viatokenroute login(OAuth device-flow). - X-Internal-Secret — for the admin endpoints used by paradigx storefront / partner bridge. Not for end users.
The live OpenAPI schema is at https://api.tokenroute.io/openapi.json.
Discovery for agents
If you need to bootstrap OIDC without the CLI:
curl https://api.tokenroute.io/api/v1/auth/discoveryReturns {issuer, client_id, device_authorization_endpoint, token_endpoint, scopes, resource} — enough to run RFC 8628 device-flow yourself.
Rate limits
- Burst: 10 RPS / key
- Sustained: depends on tier (see
tokenroute modelsfor per-model pricing & limits) - Hitting the limit returns HTTP 429 with a
Retry-Afterheader
Errors
OpenAI-style error envelope:
{
"error": {
"message": "...",
"type": "authentication_error",
"code": 401
}
}| Code | Type | Meaning |
|---|---|---|
| 401 | authentication_error | Missing / bad / revoked key |
| 402 | insufficient_quota | Balance exhausted — top up |
| 429 | rate_limit_error | Slow down |
| 503 | service_unavailable | Try again shortly |