API Documentation
One key, every model- with OpenAI-compatible and Anthropic-compatible endpoints that drop straight into the tools you already use.
Choose your tool
Claude Code
Anthropic · Terminal agent by Anthropic
Anthropic-compatible4 steps · About 2 min~/.claude/settings.json
Install Claude Code
Needs Node.js 18 or newer. Skip this if it is already on your machine.
Terminalnpm install -g @anthropic-ai/claude-codePoint it at Tokenly
Claude Code speaks the Anthropic protocol, so the base URL has no /v1. Set the three variables in the terminal you run it from.
$env:ANTHROPIC_BASE_URL = "https://www.tokenly.web.id/api" $env:ANTHROPIC_AUTH_TOKEN = "YOUR_API_KEY" $env:ANTHROPIC_MODEL = "auto"Variables only live for the current terminal session.
Make it permanent
Or persist the same values in ~/.claude/settings.json so every new terminal picks them up.
~/.claude/settings.json{ "env": { "ANTHROPIC_BASE_URL": "https://www.tokenly.web.id/api", "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY", "ANTHROPIC_MODEL": "auto" } }Run it
Start a session from any project folder.
Terminalclaude
Errors
Errors return { error: { message, type, code } } — match on code.
invalid_request_error
invalid_request_error
The request body could not be parsed as JSON, or the model rejected a parameter.
Check quotes, commas and the Content-Type: application/json header. The message field repeats the model's reason.
invalid_api_key
invalid_request_error
The key does not exist or was deleted.
Copy it again from this page, or use the key from your purchase email.
key_disabled
invalid_request_error
This API key has been disabled.
Contact support to re-enable it, or use another key.
key_expired
invalid_request_error
The key passed its expiry date.
Top up with a new token package; expiry cannot be extended.
insufficient_quota
insufficient_quota
The key's token quota is exhausted.
Top up in Dashboard → Billing, then retry.
rate_limit_error
rate_limit_error
Too many requests to the monitoring endpoints (GET /quota, GET /logs): max 3 per minute per key.
Cache the response for at least 20 seconds and retry after a pause.
gateway_unavailable
server_error
The AI gateway did not respond (502).
Retry with backoff; if it persists, check your request logs in the dashboard.
ledger_unavailable
server_error
Tokenly's key service is temporarily unavailable (503).
Retry shortly; contact support if it persists.
Get a key, call every model
Every token package includes an API key that works with the whole catalog and every tool above.