Join our community of builders on Discord!

Errors

Errors on /v1 keep OpenAI's shape, so OpenAI SDKs raise their usual errors:
CodeJSON
Branch on error.code. Some codes add fields inside error: accepts (how to pay) on a payable 402, spend_cap_wei on spend_cap_exceeded. A 429 carries a retry-after header. The OpenAI SDKs have no 402 class: a 402 arrives as a plain API error with status 402. OpenAI SDKs retry 429 and 5xx by themselves, up to their retry count. A retry is a new call: on a call paid per call, it signs and pays a new payment.

By code

StatuscodeMeansWhat to do
400nullThe request is invalid: a missing field, an unsupported role or content type, or the last message is not the user's.Fix the request; message says what is wrong.
400context_length_exceededThe system messages and the last turn alone don't fit one job (about 124 KiB once encrypted).Shorten them. Older turns are dropped by themselves: see Limits.
400invalid_payload, invalid_x402_version, invalid_network, invalid_payment_requirementsA PAYMENT-SIGNATURE is malformed, or its accepted is not the current entry (the fee changed).Rebuild it from the answer's PAYMENT-REQUIRED.
400unsupported_schemeThis server takes no per-call payments.Send the call without the header, with an API key.
401invalid_api_keyThe key is missing, unknown or revoked; or a call with no key went to a server that takes no per-call payments.Send a valid key, or no Authorization header at all on a call paid per call.
402delegate_not_authorizedThe wallet behind the key has not authorized the API's signer.Send the transaction in accepts: see Payment.
402insufficient_balanceThe prepaid balance cannot cover the job.Send the accepts transaction again to top up.
402allowance_exhaustedThe API has spent everything the wallet allowed it.Send it again: it adds balance and allowance.
402spend_cap_exceededThe key reached its lifetime cap (error.spend_cap_wei).Raise or remove the cap: see API Keys.
402payment_requiredA call with no API key carried no payment.Pay the accepts entry per call, or send an API key.
402insufficient_fundsThe per-call payer's balance cannot cover the fee.deposit() from the payer's wallet.
402invalid_prepaid_debit_payload_expiredThe payment's deadline has passed.Sign a new one.
402invalid_prepaid_debit_payload_nonce_usedThe payment was already used.Sign a new one with a fresh nonce.
402invalid_prepaid_debit_payload_signatureThe signature does not recover to payer over this chain and JobRegistry.Sign with the payer's key over the entry's domain.
402invalid_prepaid_debit_payload_over_capThe job's fee is above the payment's maxAmount.Set maxAmount to the entry's amount.
402invalid_prepaid_debit_payload_facilitator_mismatch, invalid_prepaid_debit_payload_recipient_mismatchThe payment names another facilitator or payTo than the entry.Copy both from the entry.
402invalid_prepaid_debit_facilitator_not_authorizedThe server's per-call setup is incomplete.Pay with an API key meanwhile.
402invalid_transaction_stateThe chain refused the settlement.Retry shortly.
404model_not_foundNo model by that name, or no worker serves it now.Pick an id from GET /v1/models, verbatim.
429rate_limit_exceededToo many calls this minute: per key, per payer, or per address for bad keys.Wait retry-after seconds.
429concurrency_limit_exceededToo many calls in flight for the key or payer.Wait retry-after seconds, or run fewer at once.
429session_open_limit_exceededThe server opens only so many new sessions a minute.Wait retry-after seconds.
500nullThe server failed to answer.Retry with backoff.
502job_failedThe worker failed or took too long; the API had already retried once in a new session, if nothing had streamed.Retry.
502unexpected_verify_error, unexpected_settle_errorThe per-call payment could not be checked or settled.Send the same PAYMENT-SIGNATURE again: a payment that did settle is then refused as used, so it is never charged twice.
503no_worker_availableNo worker took on a new session within the claim window.Retry shortly.
503blob_fee_too_highThe chain's blob fee is above what the server pays to submit a prompt.Retry later.
503not_configuredCompletions are off on this server.Use another network, or ask its operator.
402 codes for a call with an API key are in Payment: the delegate path; codes for a call paid per call are in Payment: pay-per-call codes.

Key management

The /api routes answer errors as { "error": "<code>", "message": "…" }, not in OpenAI's shape.
StatuserrorMeansWhat to do
401unauthorizedThe sign-in token is missing, invalid or expired (it lasts an hour).Sign in again: see API Keys.
409api_key_revokedPATCH on a revoked key: its cap no longer changes.Mint a new key.
409api_key_activeDELETE on an active key.Revoke it first.

In a stream

Before the first chunk, a streamed call fails like any other: the status and body above. After the first chunk the status is already 200, so the stream ends with an error event instead of [DONE]:
CodeTEXT
codeMeansWhat to do
job_failedThe job failed after it started streaming.Send the request again.
stream_divergedThe worker restarted its answer after the first chunks went out, so the text received is not the answer it committed on chain.Discard the text and send the request again.
See Streaming.