Quickstart
The endpoint is OpenAI-compatible. Point your existing client at https://cheap-tokens.vercel.app/v1 and send your Cheap Tokens key as the bearer token.
Change two lines
Keep your prompt formats, streaming logic and tool calls. Only the base URL and the key change.
from openai import OpenAI
client = OpenAI(
base_url="https://cheap-tokens.vercel.app/v1",
api_key="ct_live_...",
)
response = client.chat.completions.create(
model="llama-3.1-8b-instruct",
messages=[{"role": "user", "content": "Summarize this in two sentences: ..."}],
)Streaming
Set stream: true and read standard OpenAI SSE chunks. The final chunk carries usage.
curl -N https://cheap-tokens.vercel.app/v1/chat/completions \
-H "Authorization: Bearer ct_live_..." \
-H "Content-Type: application/json" \
-d '{
"model": "llama-3.1-8b-instruct",
"stream": true,
"messages": [{"role": "user", "content": "Summarize this in two sentences: ..."}]
}'A model list is available at GET https://cheap-tokens.vercel.app/v1/models with the same bearer key.
Region rules
- Each key is pinned to one region, us or eu, chosen when the key is created.
- A job only ever runs on a host inside the key's region.
- If no host in the region claims the job within 8 s, same-region backstop capacity serves it and the receipt says so.
- Sandbox keys get 25 lifetime test calls with at most 512 output tokens each, at no charge.
Error codes
| Code | HTTP | What it means |
|---|---|---|
| invalid_api_key | 401 | The bearer key is missing, revoked or unknown. |
| model_not_found | 404 | Slug not in the catalog, or a closed model (gpt-*, claude-*, gemini-*). The response lists the active slugs. |
| sandbox_limit | 402 | The sandbox key passed 25 test calls, or max_tokens is above 512. |
| insufficient_balance | 402 | Balance is below the job's maximum possible cost. |
| key_cap_reached | 402 | The key's monthly cap is reached. The response carries the cap and the reset date. |
| plan_inactive | 402 | A production key with no active paid plan. |
| concurrency_limit | 429 | Too many calls in flight for the plan. Retry-After: 2. |
| no_capacity_in_region | 503 | No host in the key's region picked the job up within 8 s and no backstop was configured. You are not charged. |
First time here? Run a test call in the playground with a sandbox key, or browse the model prices.