Skip to main content
Errors use the OpenAI-compatible shape — an error object with message, type, code, and param. The same message and code are also mirrored at the top level, alongside a request_id for support:
That’s the zero-balance case. If you have some balance left but not enough to cover the request, the message is dynamic instead: "Insufficient credits. This request costs $0.012. Balance: $0.01".

Error reference

Validation errors

400 errors include a details array telling you exactly which fields are wrong:

Error handling code

Common mistakes

Proactive warnings

You don’t have to wait for a 402 error. Responses include a balance_warning when your balance drops below $5.00 — on every generated response, with one exception: a cache hit on /chat ("cached": true) skips it, since no new spend happened:
Check for balance_warning in responses and alert yourself before running out. See Pricing for details.

Quick debug