Errors
Errors
Every code the API can answer with, what it means and what to do.
There are two places an error can appear. Neither one costs credits.
Refused at once
The call answers with an HTTP error, and nothing started:
{
"error": {
"code": "invalid_parameter",
"message": "gpt-image-2 doesn't support aspect ratio 5:4.",
"path": "input.aspect_ratio",
"hint": "Use one of: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9.",
"retryable": false,
"request_id": "req_01a1b37b65dc7dcd8c060f296add5cf8",
"docs_url": "https://docs.nocamclub.com/errors/invalid_parameter"
}
}| Field | What it is |
|---|---|
code | Stable, safe to write code against |
message | What happened, for people and agents |
path | The field at fault |
hint | What to do about it |
retryable | Whether the same request can work, after any wait the error names |
request_id | Quote this if you contact us |
docs_url | A page about this code |
Some codes add fields, such as credits, balance and top_up_url on insufficient_credits, or limit on rate_limited.
| Code | HTTP | Meaning | Worth retrying? |
|---|---|---|---|
invalid_request | 400 | The request can't be read | After a change |
invalid_parameter | 400 | A field is wrong | After a change |
unknown_model | 400 | That model isn't on sale | After a change |
input_refused | 400 | Refused by content rules | After a change |
invalid_api_key | 401 | The key isn't valid | No |
expired_api_key | 401 | The key has expired | No |
insufficient_credits | 402 | Not enough credits | No |
account_suspended | 403 | The account is paused | No |
ip_not_allowed | 403 | Not from this address | No |
missing_scope | 403 | The key can't do this | No |
model_not_allowed | 403 | The key can't use this model | No |
origin_not_allowed | 403 | Not from this page | After a change |
spend_limit_reached | 403 | A spend limit is reached | No |
not_found | 404 | Not found | After a change |
idempotency_conflict | 409 | This key was used with another request | After a change |
no_route | 409 | No route can do this right now | After a change |
not_cancelable | 409 | Too late to cancel | After a change |
not_finished | 409 | Still in progress | Yes |
not_for_sale | 409 | Not on sale with these settings | After a change |
upload_not_found | 409 | The file isn't there yet | Yes |
file_too_large | 413 | The file is too big | After a change |
unsupported_media | 415 | We can't read this file | After a change |
rate_limited | 429 | Too many requests | Yes |
too_many_active | 429 | Too many in progress | Yes |
internal | 500 | Something went wrong on our side | Yes |
platform_paused | 503 | The API is paused | Yes |
On a failed generation
The call was accepted, and later the generation ended with status: "failed". The credits are already back.
{
"status": "failed",
"price": {
"credits": 4,
"usd": "0.04",
"charged": false
},
"error": {
"code": "content_refused",
"message": "The model refused this request under its content rules. Your credits came back. Change the prompt or the files before trying again.",
"hint": "Change the prompt or the files. Trying the same again can't help, and refusals count toward a pause of the account.",
"retryable": false,
"docs_url": "https://docs.nocamclub.com/errors/content_refused"
}
}It has the same hint and retryable as a refused call. To try again, send the same request with a new Idempotency-Key.
| Code | Meaning | Worth retrying? |
|---|---|---|
content_refused | The model or our check refused it | After a change |
bad_input_file | The model couldn't read a file | After a change |
unsupported_request | The model can't do this combination | After a change |
prompt_too_long | The prompt is too long | After a change |
output_limit | The answer didn't fit | After a change |
timed_out | The model didn't finish in time | Yes |
provider_unavailable | No route could run it | Yes |
generation_failed | The generation failed | Yes |
sandbox_failure | The sandbox failed it on request | After a change |
canceled | Canceled | After a change |
input_refused can also arrive here, when a model refuses one of your files after the start.
Retrying a failed generation needs a new Idempotency-Key: the old one returns the same failure.