Quickstart
From key to first request in under a minute. If your tool speaks the OpenAI or Anthropic API, it works here — just change the base URL.
1. Get your key
- Sign up — new accounts get 1.3M+ free tokens.
- Top up your USD balance when you need more.
- Your API key appears in the dashboard as soon as there is a balance — copy it right away, it is shown once.
2. Make a request
https://api.cheaptokens.dev/v1curl https://api.cheaptokens.dev/v1/chat/completions \
-H "Authorization: Bearer $CHEAPTOKENS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "zai-org/GLM-5.3-Flash",
"messages": [{"role": "user", "content": "Hello"}]
}'OpenAI-compatible clients use the /v1 suffix; Anthropic clients use the root URL.
Tool names are trademarks of their owners. Not affiliated with or endorsed by them.
All examples
Ready-to-copy snippets for GLM-5.3-Flash. To switch the model or insert your key, use the configurator above.
curl
curl https://api.cheaptokens.dev/v1/chat/completions \
-H "Authorization: Bearer $CHEAPTOKENS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "zai-org/GLM-5.3-Flash",
"messages": [{"role": "user", "content": "Hello"}]
}' Python · OpenAI
from openai import OpenAI
client = OpenAI(
base_url="https://api.cheaptokens.dev/v1",
api_key="YOUR_CHEAPTOKENS_KEY",
)
resp = client.chat.completions.create(
model="zai-org/GLM-5.3-Flash",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content) Node · OpenAI
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.cheaptokens.dev/v1",
apiKey: process.env.CHEAPTOKENS_API_KEY,
});
const resp = await client.chat.completions.create({
model: "zai-org/GLM-5.3-Flash",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content); Python · Anthropic
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.cheaptokens.dev",
api_key="YOUR_CHEAPTOKENS_KEY",
)
msg = client.messages.create(
model="zai-org/GLM-5.3-Flash",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text) Claude Code
Claude Code — export the variables below (the address has no /v1) and run claude.
# Claude Code → cheaptokens (Anthropic-compatible)
export ANTHROPIC_BASE_URL="https://api.cheaptokens.dev"
export ANTHROPIC_API_KEY="YOUR_CHEAPTOKENS_KEY"
export ANTHROPIC_MODEL="zai-org/GLM-5.3-Flash"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="zai-org/GLM-5.3-Flash" Cursor
Cursor — in Cursor Settings → Models, paste your key into OpenAI API Key, turn on Override OpenAI Base URL and add the model ID as a custom model. Per Cursor's documentation, own keys work with chat models only; Tab completion keeps using Cursor's models.
# Cursor Settings → Models → API Keys
OpenAI API Key: YOUR_CHEAPTOKENS_KEY
Override OpenAI Base URL: https://api.cheaptokens.dev/v1
# Models list → add this ID as a custom model:
Model: zai-org/GLM-5.3-Flash Cline
Cline — choose an OpenAI-compatible provider, set base URL and key.
# Cline → Settings → API Provider: OpenAI Compatible
Base URL: https://api.cheaptokens.dev/v1
API Key: YOUR_CHEAPTOKENS_KEY
Model ID: zai-org/GLM-5.3-Flash Aider
Aider — pass --openai-api-base and --openai-api-key (or env vars).
export OPENAI_API_BASE="https://api.cheaptokens.dev/v1"
export OPENAI_API_KEY="YOUR_CHEAPTOKENS_KEY"
aider --model openai/zai-org/GLM-5.3-Flash OpenClaw
OpenClaw — add the provider entry below to ~/.openclaw/openclaw.json. On a fresh install, openclaw onboard with the Custom provider choice writes the same entry.
// ~/.openclaw/openclaw.json — add cheaptokens as a provider
{
models: {
providers: {
cheaptokens: {
baseUrl: "https://api.cheaptokens.dev/v1",
apiKey: "YOUR_CHEAPTOKENS_KEY",
api: "openai-completions",
models: [{ id: "zai-org/GLM-5.3-Flash", name: "GLM-5.3-Flash" }],
},
},
},
agents: {
defaults: { model: { primary: "cheaptokens/zai-org/GLM-5.3-Flash" } },
},
}
// Anthropic-style requests instead? In the provider entry use:
// api: "anthropic-messages", baseUrl: "https://api.cheaptokens.dev" Kilo Code
Kilo Code — choose the OpenAI-compatible provider, set base URL, key, and model id.
# Kilo Code → Settings → API Provider: OpenAI Compatible
Base URL: https://api.cheaptokens.dev/v1
API Key: YOUR_CHEAPTOKENS_KEY
Model ID: zai-org/GLM-5.3-Flash Endpoints
POST https://api.cheaptokens.dev/v1/chat/completions— OpenAI-compatible chat completions, streaming and tool callsPOST https://api.cheaptokens.dev/v1/messages— Anthropic-compatible messages; Anthropic SDKs and Claude Code take the root address https://api.cheaptokens.dev and add the path themselvesGET https://api.cheaptokens.dev/v1/models— models you can call, with context and output limits
Capabilities and limits
Supported for every model in the catalog: tool_calling, streaming, json_mode, structured_outputs
| Model | Context | Max output per answer | Default max_tokens (non-streaming) |
|---|---|---|---|
GLM-5.3-Flashzai-org/GLM-5.3-Flash | 390K | 8,192 | 3,000 |
DeepSeek-V4-Flashdeepseek-ai/DeepSeek-V4-Flash-0731 | 380K | 32,768 | 1,500 |
MiniMax-M2.7MiniMaxAI/MiniMax-M2.7 | 180K | 8,192 | 1,500 |
Without max_tokens, a non-streaming answer stops at the default above. Set max_tokens for longer answers, up to the model's maximum.
Rate limit: 120 requests per minute per API key. Request body: up to 16 MB.
Also available: /v1/responses, /v1/completions, /v1/models/{model}, /v1/capabilities
Guides
- Your first API request with CheapTokens
- Streaming responses in Python
- Common connection errors and how to fix them
- "Not enough tokens" error: what it means and how to fix it
- Why does an AI answer stop mid-sentence? max_tokens, the context window and finish_reason explained
- How to connect Claude Code to CheapTokens
- How to connect Cursor to CheapTokens
- How to connect Cline to CheapTokens
- How to connect Aider to CheapTokens
- How to connect OpenClaw to CheapTokens and what it costs
- How to connect Kilo Code to CheapTokens
- How to connect Hermes Agent to CheapTokens
- How to connect Open WebUI to CheapTokens
Limits & errors
390K context. Errors follow the standard OpenAI/Anthropic JSON shape. A 402 means the balance is used up or the request carries no API key — top up or add the key.
Ready to build?
Get your key and swap the base URL.
Get started