Base URL and API keys
Every API request goes to this base URL:
https://api.indorouter.ai/v1You create API keys on the API Key page in the console. A key starts with ir_ and is shown only once, when you create it. API keys covers creating and configuring them.
Sending your API key
Section titled “Sending your API key”Send the key in the Authorization header:
curl https://api.indorouter.ai/v1/chat/completions \ -H "Authorization: Bearer $INDOROUTER_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "hello"}]}'An x-api-key: <key> header is accepted on every endpoint too, so clients built for Anthropic’s format work unchanged. If you send both, Authorization is used.
The model list at GET /v1/models is available without an API key.
A console session token doesn’t work on the API. A request carrying one is refused with 401 invalid_api_key.
Key types
Section titled “Key types”| Kind | What it’s for | Endpoints |
|---|---|---|
| API key | Sending requests to models. Usage is charged to your balance. | Every model endpoint, plus /v1/files, /v1/batches, /v1/key, /v1/credits and /v1/generation |
| Admin key | Creating and revoking API keys through the API, and reading your organization’s usage reports. It can’t send requests to models. | /v1/keys, /v1/organization/usage, /v1/organization/costs, plus /v1/files, /v1/key, /v1/credits and /v1/generation |
Create admin keys on the Admin Key page in the console. You need the API Key permission and can only grant permissions you already have. Error messages and the API call an admin key a provisioning key. Using an admin key for a model request gets 403 provisioning_key_cannot_spend. Using an ordinary API key on /v1/keys gets 403 inference_key_cannot_provision.
Response headers
Section titled “Response headers”| Header | What it carries |
|---|---|
x-request-id |
The request’s ID, for example req_.... Include it when you contact us, or use it to look up what the request cost with GET /v1/generation?id=. |
request-id |
The same ID, on /v1/messages only, because Anthropic’s clients read this header. |
x-indorouter-max-output-tokens |
The output cap actually used for a text request. |
x-indorouter-max-output-tokens-lowered-from |
Only present when we lowered the output cap because your balance didn’t cover it. It carries the cap you asked for. See How billing works. |
Headers we drop
Section titled “Headers we drop”Any header you send that starts with x-indorouter-, along with x-request-id and other headers that try to pick an account, a provider or an upstream model, is dropped before the request is handled. No header can choose a provider.
indoRouter picks the provider
Section titled “indoRouter picks the provider”For each model we choose the provider (the route) that serves your request, and we move to the next route if one fails before the answer starts. That’s why these body fields are refused with 400 refused_request_field:
provider,providers,route,routes,fallbacks,credential,credential_alias,api_key,api_base,base_urlservice_tier,inference_geo,speed, because they change what the provider charges without changing what it reports
Idempotency-Key
Section titled “Idempotency-Key”If you send an Idempotency-Key header (up to 255 bytes), requests with the same key on the same account are treated as one request. This keeps a request you retry after a dropped connection from running, and being charged, twice.
- The same key with a different body is refused with
409 idempotency_key_mismatch. - The same key with the same body, once the first request has run, is refused with
409 idempotency_key_in_use. The first request’s answer isn’t stored, so it can’t be sent again. You can still see what it cost withGET /v1/generation?id=. - A request that failed also counts as having run. If you got an error back and want to retry, use a new key.
- A request sent with an
Idempotency-Keyhas an ID starting withidem_.