Skip to main content

API endpoint

All requests go to:
https://www.bettertoken.com/v1
BetterToken is compatible with both the Anthropic SDK and the OpenAI SDK — no code migration needed, just swap base_url and API Key.

Authentication

Pass your BetterToken API Key in the request:
import anthropic

client = anthropic.Anthropic(
    base_url="https://www.bettertoken.com/v1",
    api_key="YOUR_API_KEY",
)

Supported models

Claude series (Anthropic-compatible)

ModelDescription
claude-opus-4-5Most capable — best for complex reasoning
claude-sonnet-4-5Balanced — recommended for everyday use
claude-haiku-4-5Fastest — best for simple tasks

GPT series (OpenAI-compatible)

ModelDescription
gpt-4oOpenAI flagship model
gpt-4o-miniLightweight, faster responses
When using Claude Code or Codex CLI, you do not need to specify a model name in your config. BetterToken routes automatically. You only need to specify a model in tools like Cursor that require explicit model selection.

Environment variable reference

VariableValueUsage
ANTHROPIC_BASE_URLhttps://www.bettertoken.com/v1Anthropic-compatible tools (Claude Code, etc.)
ANTHROPIC_AUTH_TOKENYour API KeyClaude Code authentication
OPENAI_BASE_URLhttps://www.bettertoken.com/v1OpenAI SDK-compatible tools
OPENAI_API_KEYYour API KeyOpenAI SDK authentication
API_TIMEOUT_MS3000000Recommended — prevents long-task timeouts
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC1Claude Code only — reduces background requests