Errors
Errors come back with an HTTP status and a JSON body in the same shape as OpenAI's, so the OpenAI SDKs raise their usual exceptions.
json
{"error": {"message": "Your account has no credit left. Add credit at https://www.continuumlabs.ai/console", "type": "insufficient_quota", "code": "insufficient_quota"}}Every error
| Status | code | What it means | What to do |
|---|---|---|---|
| 400 | invalid_request_error | The body is not valid JSON. | Check the request body. |
| 401 | invalid_api_key | The key is missing, malformed, deleted or unknown. | Send Authorization: Bearer cl-.... Create a new key in the console if needed. |
| 401 | key_disabled | The key has been switched off in the console. | Ask your account owner to switch it back on. |
| 402 | insufficient_quota | Your account has no credit left. | Add credit. Requests work again straight away. |
| 402 | allowance_reached | The key's or the workspace's allowance for this period is used up. The message says which. | Wait for the reset, or raise the allowance in the console. |
| 403 | permission_error | A management key was used to call a model, or an ordinary key to manage. | Use the right kind of key. |
| 404 | model_not_found | The model ID is not one we offer. The message lists the IDs that are. | Use an ID from models. |
| 404 | not_found | The endpoint or the ID does not exist. | Check the path against these docs. |
| 413 | request_too_large | The request is over 4 MB. | Send less text, or split the work across requests. |
| 429 | rate_limited | The model is busy. | Wait and retry, with backoff. |
| 502 | upstream_error | The model returned an error. | Retry. If it keeps happening, tell us. |
| 502 | upstream_unavailable | The model could not be reached. | Retry after a few seconds. |
| 503 | service_unavailable | The service is not open, or is down for maintenance. | Check our status, then retry later. |
If the model rejects a request because of something in it, such as a parameter it does not support, you get its original status with a short explanation in message.
Retrying safely
Retry 429, 502 and 503 with exponential backoff: wait about one second, then two, then four, and stop after a few tries. Do not retry 400, 401, 402, 404 or 413, because they will fail the same way.
The OpenAI SDKs retry some errors for you. You can set how many times:
python
client = OpenAI(base_url="https://api.continuumlabs.ai/v1", api_key="cl-your-key", max_retries=3)Failed requests are not charged.
