# CentRouter > CentRouter is a prepaid AI gateway. Customers buy a USD Balance and call every model in the Catalog through one OpenAI- and Anthropic-compatible API with one API Key. Prices are below OpenRouter's prices for the same models; each request deducts tokens x sell price from the Balance. The Balance never expires. ## Base URL - OpenAI format: https://api.centrouter.com/v1 - Anthropic format: https://api.centrouter.com (clients add /v1/messages) ## Authentication Send the API Key (starts with gsk_) as "Authorization: Bearer " or "x-api-key: ". Create keys at https://dashboard.centrouter.com/api-keys. Never print or commit the key; read it from the CENTROUTER_API_KEY environment variable. ## Endpoints - POST /v1/chat/completions: OpenAI Chat Completions (streaming supported) - POST /v1/messages: Anthropic Messages (streaming supported; used by Claude Code) - POST /v1/messages/count_tokens: free estimate of input tokens (about 4 characters per token), not an exact count; charges use the usage the model reports - POST /v1/responses: OpenAI Responses (used by Codex CLI) - POST /v1/embeddings: OpenAI Embeddings, for models that support them - GET /v1/models: every Catalog model with the prices this API Key is charged (pricing, USD per 1M tokens) and what it supports (vision, tools, reasoning) - GET /v1/balance: Balance in USD: total, available, reserved ## Errors Errors use the format of the endpoint called (OpenAI: error.code; Anthropic: error.type) and include a message that says how to fix the problem. Causes and fixes for every code: https://dashboard.centrouter.com/docs#troubleshooting - invalid_api_key (HTTP 401; Anthropic type authentication_error) - account_blocked (HTTP 403; Anthropic type permission_error) - route_not_found (HTTP 404; Anthropic type not_found_error) - model_not_found (HTTP 404; Anthropic type not_found_error) - model_not_allowed (HTTP 403; Anthropic type permission_error) - spend_limit_exceeded (HTTP 403; Anthropic type permission_error) - insufficient_balance (HTTP 402; Anthropic type invalid_request_error) - rate_limit_exceeded (HTTP 429; Anthropic type rate_limit_error) - invalid_request (HTTP 400; Anthropic type invalid_request_error) - upstream_error (HTTP 502; Anthropic type api_error) - upstream_rate_limited (HTTP 429; Anthropic type overloaded_error) - request_too_large (HTTP 413; Anthropic type request_too_large) Once a request is accepted, its response has an x-request-id header (req_ plus 32 hex characters), also on streams and on failures at the model. It is the Request ID shown in Activity; quote it to support. Requests rejected earlier (invalid key, blocked account, invalid body, unknown route or model, limits, low Balance) have none. ## Spend Limits Each API Key can have a daily, monthly and total Spend Limit and a model allowlist (set at https://dashboard.centrouter.com/api-keys). A request beyond a limit fails with spend_limit_exceeded; beyond the Balance with insufficient_balance. ## Models - gpt-6-luna: GPT-6 Luna. $0.001 input / $0.0001 cache read / $0.005 output per 1M tokens, 99% below the OpenRouter price; context 1000000 tokens ## CLI - npx centrouter login --portal-url https://dashboard.centrouter.com: approve in the browser; stores an API Key in ~/.config/centrouter/credentials.json - npx centrouter setup claude|codex|opencode: writes the tool's config - npx centrouter balance, npx centrouter models ## FAQ https://dashboard.centrouter.com/faq answers common questions in English and Bahasa Indonesia. In short: the Balance is prepaid in USD and has no expiry date; a request is charged for the tokens the model reports times the Sell Price per 1M tokens, and a rejected or unanswered request costs nothing; while a request runs the gateway holds its worst-case cost (the prompt plus max_tokens) and releases the unused part when it ends, so a Balance never goes below zero; Saved is measured against the same model's price on OpenRouter; Rupiah amounts are estimates at the current Exchange Rate; the gateway does not store or log prompt or response content, only each request's tokens, prices, charge, status and timing. ## Docs - https://dashboard.centrouter.com/docs - https://dashboard.centrouter.com/docs#troubleshooting - https://dashboard.centrouter.com/faq - https://dashboard.centrouter.com/pricing (prices and a cost calculator) - https://dashboard.centrouter.com/status - https://dashboard.centrouter.com/terms (Terms of Service) - https://dashboard.centrouter.com/privacy (Privacy Policy) ## Prompt for a coding agent Copy this into your coding agent to configure it: ``` Configure this machine to use CentRouter as the model provider. 1. Run "npx centrouter login --portal-url https://dashboard.centrouter.com" and ask me to approve the code it prints in my browser. If you cannot run it, ask me for an API Key from https://dashboard.centrouter.com/api-keys and export it as CENTROUTER_API_KEY. Never write the key into files in a repository. 2. For Claude Code run "npx centrouter setup claude"; for Codex CLI "npx centrouter setup codex"; for OpenCode "npx centrouter setup opencode". For any other OpenAI-compatible tool, set its base URL to https://api.centrouter.com/v1 and its API key to $CENTROUTER_API_KEY; for Anthropic-compatible tools use https://api.centrouter.com. 3. Verify with: curl https://api.centrouter.com/v1/models -H "Authorization: Bearer $CENTROUTER_API_KEY" 4. Use the model gpt-6-luna unless I name another one from the list above. ```