Skip to content
Documentation · API keys
Docs / Get started

API keys

Create, use and rotate credentials for your applications. A key charges requests to the account that created it.

On this page

Create a key

Open Dashboard → API keys and create a key for your app or agent. Copy the full value when it appears; it cannot be retrieved later. A separate key per client lets you track usage and revoke access independently.

Keys start with xk_live_. The next segment is the public key id shown in the dashboard. The remaining value is secret; only a keyed hash is stored.

Authenticate requests

terminal · replace the placeholder
export XINF_API_KEY="xk_live_REPLACE_WITH_YOUR_KEY"

# Include this header on inference requests:
# Authorization: Bearer $XINF_API_KEY
Client / formatKey setting
OpenAI Python / JavaScriptapi_key / apiKey
Codexenv_key = "XINF_API_KEY" in the provider configuration
Claude CodeANTHROPIC_AUTH_TOKEN set to your key
Anthropic MessagesAuthorization: Bearer or x-api-key
Gemini APIx-goog-api-key

The variable name is not the key value. Export the secret in the terminal that launches your client; use the complete coding-agent examples for provider configuration. MCP browser sign-in creates its own connection and does not set these variables.

Rotate or revoke a key

Create a replacement, update your application's secret and confirm a request succeeds. Then revoke the old key in the dashboard. Revocation takes effect within a minute. If a key is exposed, revoke it immediately.

Monthly spend limits and expiry

Set a monthly dollar limit and an optional UTC expiry when creating a key, or use its Limits button later. Changes apply within a minute. The monthly total includes model requests, uploads and marketplace calls made with that key.

Limits reset at the start of each UTC calendar month. In-flight requests reserve their estimated cost; usage belongs to the month when the request started. A final charge can slightly exceed its estimate.

ResultMeaning
402 key_limit_reachedThe request would exceed the key's monthly limit; it is refused before running.
401 key_expiredThe key has passed its expiry time.

Limit errors include limit_usd, spent_usd, required_usd and resets_at_ms. Failed marketplace calls are not charged. OAuth connections use their own monthly caps; a dashboard key's limits do not apply to them.

A sponsored key spends from an ecosystem team's balance, with its own monthly limit and expiry. It can read only its own usage, balance and uploads, cannot use marketplace tools, and can be revoked but not edited.

If the sponsor runs out of funds, requests return 402 sponsor_credits_exhausted. Contact the organiser; adding funds to a personal account does not refill the sponsor.

Rate limits and storage

Each key has a platform limit of 600 requests per minute. This cannot be changed per key. Handle 429 using Retry-After; see errors and retries.

Keep keys in a secret manager or environment variables. Do not commit them, embed them in frontend bundles, or include them in logs and screenshots. The dashboard key must come from the same environment as your API URL.