open token

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:

shell
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.

header
Authorization: Bearer ot-...

Endpoints

POST/v1/chat/completionsCreate a chat completion (streaming or not).
GET/v1/modelsList models with pricing (USD per token) and context length.
GET/v1/keyInspect 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.

response.json
{
  "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" } }.

StatusTypeMeaning
400invalid_request_errorMalformed body, unknown parameter or unsupported content type.
401authentication_errorMissing, invalid or revoked API key.
402insufficient_quotaOut of credits, or the key reached its spending limit.
403permission_errorOrganization disabled, or the model requires your own key (BYOK).
404invalid_request_errorUnknown model ID.
429rate_limit_errorThe upstream provider is throttling. Retry with backoff.
502provider_errorThe 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).