Quick start

  1. Create an account and top up your balance.
  2. Create an API key under Dashboard → API keys. It starts with ct_live_ and is shown once.
  3. Set the base URL to https://cheaptokens.pw/v1 in your SDK or tool and send a request.
from openai import OpenAI

client = OpenAI(
    base_url="https://cheaptokens.pw/v1",
    api_key="YOUR_API_KEY",
)

reply = client.chat.completions.create(
    model="gpt-6-luna",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(reply.choices[0].message.content)

Authentication

Send your key as a bearer token. The Anthropic-style x-api-key header is also accepted.

Authorization: Bearer ct_live_...

Keep keys on your server. Don't put them in browser code, mobile apps or public repositories. If a key leaks, disable it in the dashboard and create a new one.

Endpoints

EndpointFormatUse it for
POST /v1/chat/completionsOpenAI Chat CompletionsEvery text model
POST /v1/responsesOpenAI ResponsesGPT models, Codex, agent tools
POST /v1/messagesAnthropic MessagesClaude models, Claude Code
POST /v1/images/generationsOpenAI ImagesCreate an image
POST /v1/images/editsOpenAI Images (multipart)Edit images
GET /v1/modelsOpenAI ModelsList available model IDs

Which endpoints each model supports is listed on the models page.

Claude Messages

Claude models can be called in the native Anthropic format. Point the Anthropic SDK at https://cheaptokens.pw (without /v1).

Python
import anthropic

client = anthropic.Anthropic(
    base_url="https://cheaptokens.pw",
    api_key="YOUR_API_KEY",
)

message = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content[0].text)

Streaming

Set "stream": true. Responses are sent as server-sent events in the same format as the original API. For Chat Completions we add a final usage chunk to the stream so the request can be billed exactly; the official SDKs handle it automatically.

Images

cURL
curl https://cheaptokens.pw/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-image-2.5-sunburst", "prompt": "A lighthouse at dawn, watercolor"}'

Images are billed at a flat price per image, shown on the models page. The response contains a PNG as base64 in data[0].b64_json. To edit an image, send multipart/form-data to /v1/images/edits with model, prompt and one or more image files (up to 16 files, 25 MB each).

Tool setup

Every tool needs the same three things: the base URL, your API key and a model ID. Pick your tool for exact steps, or use the setup wizard to get snippets for your operating system and model.

SettingValueUsed by
OpenAI base URLhttps://cheaptokens.pw/v1Codex, Cursor, Cline, Roo Code, Continue, OpenCode, Aider and most others
Anthropic base URLhttps://cheaptokens.pwClaude Code and other tools that speak the Claude Messages format
API keyct_live_...All tools

Billing

Rate limits

Each API key can send a limited number of requests per minute. Above the limit you get HTTP 429 with rate_limit_exceeded; wait a few seconds and retry. Contact [email protected] if you need a higher limit.

Errors

HTTPCodeWhat to do
400invalid_requestThe model rejected the request. Check the parameters and message format.
400context_length_exceededShorten the input or lower max_tokens.
401invalid_api_keyCheck the key and that it is enabled.
402insufficient_quotaTop up your balance.
402key_limit_reachedRaise or remove the key's spend limit.
404model_not_foundUse a model ID from /v1/models.
429rate_limit_exceededSlow down and retry.
502upstream_errorThe model provider failed. Retry.
503provider_unavailableThe model is temporarily unavailable. Retry shortly.

Errors on /v1/messages use the Anthropic error format; all other endpoints use the OpenAI format. Include the x-request-id response header when you contact support.