Skip to main content

Error format

Errors use OpenAI’s shape:
Use code to handle errors in your client. param names the field when known (for example, messages[0].role) and is null otherwise. A 402 has type insufficient_quota, other 4xx errors have type invalid_request_error, and 5xx errors have type api_error.

Status and error codes

When you poll an async image job, HTTP 200 can contain status: "failed". Read the job’s error.code. The code interrupted means the network restarted while the job was queued or running. You can submit it again. You aren’t charged for the interrupted job. The API checks the path and method before requiring a token. The bare /v1 path also returns the API’s 404.

Errors in a stream

With stream: true, a refusal at submission still returns an HTTP error with a JSON body. This includes invalid input (400), insufficient credits (402), the account limit (429), and no online machine (503). Once the API accepts the job and opens the stream with HTTP 200, a later failure arrives as one error event. Its status gives the equivalent HTTP status. The stream then closes without data: [DONE]. For example, if the machine leaves after sending part of its reply, the partial answer ends here and the job is refunded.

Concurrency

An account can have 4 job calls in flight across all its tokens. A submission takes a slot before the API reads the body. A synchronous call holds it until the call or stream ends. An async job holds it until the job finishes. A fifth submission gets 429 rate_limit_exceeded immediately and costs nothing. Polling and cancellation do not take a slot. The x-ratelimit-limit-concurrent and x-ratelimit-remaining-concurrent headers give the limit and remaining slots. There is no per-minute call limit.

No machine for a model

If the machines have already tried the job, the message can read “Every machine that runs this model tried and couldn’t finish it.” Check current supply with the model catalogue. If your account is pinned to specific machines and none offers the model, the no_provider message says “None of the machines this account may use is running this model right now.” The network hands out waiting jobs oldest first and prefers machines with the model already loaded. A running job can continue while its machine reports progress. If the machine leaves or goes silent for 3 minutes, the network can try another machine, up to 3 machines in all. Once a chat stream has sent part of the reply, a machine failure ends the stream.

Retrying

  • Skip automatic retries when x-should-retry: false. A 402 needs more credits, and a content policy error needs a different request. For no_provider, wait at least the 30 seconds in Retry-After and check for an eligible machine before sending a new job.
  • For a 429, wait at least the 1 second in Retry-After. If all four account slots are in use, wait for a call to finish. For a transient 502 network_error, back off before trying again.
  • For other 4xx errors, fix the cause first. In an open stream, use the error event’s code and status to decide whether to start a fresh call.
  • Set a timeout for how long you can wait. Closing a synchronous call or stream cancels and refunds unfinished work. To stop an async job, use its cancel endpoint.

Refused requests

Prompts and text are checked before a job is priced or sent to a machine. Pictures are checked on the machine before they are sent back. Requests for sexual content are refused. Refused requests count against the account. Repeated refusals, or the most serious kind, suspend it until a person has reviewed it. See the terms.

Limits