Endpoints
BetterToken now uses two different endpoints by protocol:
| Scenario | Base URL | Protocol |
|---|
Claude Code / ANTHROPIC_BASE_URL | https://www.bettertoken.ai | Anthropic |
Codex / OPENAI_BASE_URL / external tools | https://www.bettertoken.ai/v1 | OpenAI-style / OpenAI Responses |
Do not keep using one shared endpoint for every protocol.
Authentication and examples
Pass your BetterToken API Key with the request:
Claude Code / Anthropic
Codex / OpenAI Responses
Model selection rules
- Claude Code +
Claude_* keys: do not set model variables manually; only configure ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN
- Claude Code +
Codex_* keys: add model mappings through ANTHROPIC_DEFAULT_HAIKU_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, and ANTHROPIC_DEFAULT_OPUS_MODEL
- Codex: use a model ID copied from the Codex group in the model plaza (
https://www.bettertoken.ai/pricing)
- External tools: also use Codex group model IDs instead of fixed Claude model names
For external tools, you usually only need the Base URL, API key, and model specified by that tool’s official docs. Only add extra headers when the tool itself or your upstream gateway explicitly requires them.
Environment variable reference
| Variable | Value | Usage |
|---|
ANTHROPIC_BASE_URL | https://www.bettertoken.ai | Claude Code |
ANTHROPIC_AUTH_TOKEN | Your API Key | Claude Code auth |
OPENAI_BASE_URL | https://www.bettertoken.ai/v1 | Codex and other OpenAI-style tools |
OPENAI_API_KEY | Your API Key | OpenAI-style tool auth |
API_TIMEOUT_MS | 3000000 | Recommended for long tasks |
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC | 1 | Claude Code only |