Skip to main content

Credits API

Check your credit balance and spend credits on AI chat completions through the credits gateway.

Credits gateway

Send an AI chat completion request using your credits. Each call costs 1 credit, debited from your referral credits balance. If the upstream AI gateway is unavailable or returns an error, the credit is automatically refunded. Only free-tier models are available through this endpoint:
  • openrouter/xiaomi/mimo-v2-pro (default)
  • openrouter/google/gemini-2.0-flash-001
  • openrouter/openai/gpt-4o-mini
If you request a model not in this list, the gateway falls back to openrouter/xiaomi/mimo-v2-pro.

Request body

The request body follows the OpenAI chat completions format. You can include any standard chat completion parameters.

Response

On success, the response contains the AI completion along with a _credits object showing the cost and remaining balance.
The response also includes an X-Credits-Remaining header with your updated balance. When stream is true, the response is a server-sent event stream with Content-Type: text/event-stream. The X-Credits-Remaining header is still included.

Response fields

Response headers

Errors

Credits are debited before the AI call is made to prevent double-spend. If the call fails for any reason — connection error, upstream 4xx/5xx, or internal error — credits are refunded automatically. Check the X-Credits-Refunded header to determine whether a refund occurred.

Check balance (v1)

Returns your current credit balance, plan, cost per call, and the list of models available through the credits gateway.

Response

Response fields

Errors


Get credit balance

Returns the authenticated user’s credit balance, referral code, referral count, and current plan. Requires session authentication.

Response

Response fields

Errors

Credits from token holder claims (see Claim API) are added to the same credits balance returned by these endpoints. Use the Referrals API for a detailed breakdown of referral-specific statistics.