API

Errors

API errors are OpenAI-shaped. Payment errors are x402-shaped. Both are JSON.

API errors

shape
{ "error": { "message": "...", "type": "invalid_request_error", "code": "model_not_found" } }
StatusCodeMeaning
400invalid_max_tokensmax_tokens must be a positive integer
400invalid_amountDeposit outside the allowed range
401invalid_api_keyUnknown, revoked or wrong-mode key
402insufficient_balanceKey balance cannot cover this call. Top up.
404model_not_foundNot in the catalog
429model_overloadedModel at capacity. Retry in a few seconds.
502upstream_errorTemporarily unavailable. You are not charged.

Payment errors

A rejected payment returns 402 with a code and an empty accepts:

shape
{ "x402Version": 2, "error": "client amount=1200 does not match required 1310", "code": "terms_mismatch", "accepts": [] }

When a paid call fails

The error body includes an x402 receipt stating what happens to your money. Failed calls are refunded in full.