GET /v1/credits
Returns the credit balance of the account that owns the API key, and the credits spent by the calling key. The call is free: it charges nothing and places no hold.Response
A
200 is returned even when available is 0, so you can alert and pause
before your next request fails with 402 insufficient_credits.
balance counts paid credits only. Free promo credits and subscription plan
allowances are not included, so a request can still succeed on a plan or
promo model while available is 0. A promo model is billed to promo
credits only: it never spends balance or a plan allowance, and returns
402 once the account has no promo credits left for it.Per-key spend
balance is shared by every key on the account. To reconcile one key, read
key_spent. Pass since (Unix seconds, UTC) to count only requests started
at or after that time:
Avoiding cut-off streams
Every request holds its worst-case cost (prompt plusmax_tokens) before it
starts. When available is below that, the hold shrinks max_tokens to fit,
and a stream can end early with an insufficient_credits error event. Check
available before starting long generations, and top up or lower
max_tokens when it runs low.
Errors
Errors use the standard error shape.