A key is both login and password to your balance. One key works with every model in the catalog; requests are billed from the same balance.
402.cai-xxxxxxxxxxxxxxxxxxxxxxxx.The same key works for the OpenAI-compatible endpoint (Authorization: Bearer cai-...) and for Anthropic-compatible clients (ANTHROPIC_AUTH_TOKEN). You don't have to create separate keys for different clients — but it's convenient: a per-project key is easier to revoke.
For the OpenAI-compatible API — the Authorization header:
curl
curl https://api.cheapai.io/v1/chat/completions \
-H "Authorization: Bearer cai-..." \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4o", "messages": [{"role": "user", "content": "Hello!"}]}'In SDKs — the same key in the api_key field together with base_url:
python
from openai import OpenAI
client = OpenAI(base_url="https://api.cheapai.io/v1", api_key="cai-...")For Claude Code and other Anthropic-compatible clients — via environment variables:
claude code · terminal
export ANTHROPIC_BASE_URL="https://api.cheapai.io"
export ANTHROPIC_AUTH_TOKEN="cai-..."Detailed client guides — Claude Code, Codex CLI, Cursor and others.
export CHEAPAI_API_KEY=...) or in a .env file added to .gitignore.Don't commit keys to git and don't show them in screenshots, logs, support chats or issues. If a key was exposed — revoke it and create a new one.
In the section a key can be revoked — after that, requests with it immediately return . Your balance is not affected: it's shared across the account, not tied to a specific key.
401Recommendations:
Next: OpenAI-compatible API · Error codes · Pricing and billing.