Errors are plain JSON with an error string and an honest status code. Nothing is charged for a request that does not produce a completed generation.
{ "error": "model and prompt are required" }| Field | Type | Description |
|---|---|---|
400 | Bad request | Missing model or prompt, or no provider can serve the model under your routing rules — including a provider pin that does not offer it. Fix the request; retrying unchanged will not help. |
401 | Unauthorized | The bearer token is missing, malformed or deleted. See API tokens. |
402 | Payment required | Balance below the quoted cost. The message includes what is needed and what you have; top up and retry the same request. |
404 | Not found | No generation with that id on this account. Ids are scoped to the account that created them. |
502 | Bad gateway | The provider refused the submission — bad parameters for that model, or an upstream outage. Nothing is charged. Retry, or pin a different provider. |
A generation that was accepted and later failed is not an HTTP error: the poll returns 200 with "status": "failed" and an errorfield carrying the provider's reason. Handle it in your polling loop rather than in your HTTP error branch.