Open Token API
An OpenAI-compatible API for every model in the catalog. Point your existing SDK at https://getopentoken.com/v1 and use your Open Token key.
Quickstart
Create an API key in your dashboard, export it as OPEN_TOKEN_API_KEY, then:
curl https://getopentoken.com/v1/chat/completions \
-H "Authorization: Bearer $OPEN_TOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "amazon/nova-lite",
"messages": [{"role": "user", "content": "What is the meaning of life?"}]
}'Authentication
Send your key as a bearer token. Keys start with ot-, are shown once at creation and stored only as a hash.
Authorization: Bearer ot-...Endpoints
| POST | /v1/chat/completions | Create a chat completion (streaming or not). |
| GET | /v1/models | List models with pricing (USD per token) and context length. |
| GET | /v1/key | Inspect the current key: usage, limit and remaining credits. |
Supported parameters: model, messages (text content), stream, max_tokens, temperature, top_p, stop. Responses include usage.cost in USD.
{
"id": "gen_...",
"object": "chat.completion",
"model": "amazon/nova-lite",
"choices": [{ "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" }],
"usage": { "prompt_tokens": 14, "completion_tokens": 120, "total_tokens": 134, "cost": 0.0000297, "is_byok": false }
}Streaming
Set "stream": true to receive server-sent events. The final chunk carries usage (including cost), followed by data: [DONE]. If the client disconnects, only tokens generated so far are billed.
Errors
Errors follow the OpenAI shape: { "error": { "message", "type", "code" } }.
| Status | Type | Meaning |
|---|---|---|
| 400 | invalid_request_error | Malformed body, unknown parameter or unsupported content type. |
| 401 | authentication_error | Missing, invalid or revoked API key. |
| 402 | insufficient_quota | Out of credits, or the key reached its spending limit. |
| 403 | permission_error | Organization disabled, or the model requires your own key (BYOK). |
| 404 | invalid_request_error | Unknown model ID. |
| 429 | rate_limit_error | The upstream provider is throttling. Retry with backoff. |
| 502 | provider_error | The upstream provider failed or denied access. |
Bring your own key
Connect an AWS IAM access key with bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream permissions under Integrations. Once connected, every request runs on your AWS account, BYOK-only models (Claude, gpt-oss) become available, and Open Token charges a 5% fee on list price. Secrets are encrypted at rest with AES-256-GCM and never shown again.
Billing
Open Token uses prepaid credits. Each request is priced at the model's list price per token and deducted from your organization's balance; requests fail with 402 when the balance reaches zero. Credit purchases carry a 5.5% platform fee (minimum $0.80).