Errors and limits
The error shape, every status and code the API returns, and the rate limits behind them.
Errors use OpenAI’s shape, so SDKs raise them as they would OpenAI’s:
{
"error": {
"message": "Rate limit reached: up to 60 requests a minute per API key, 120 across one account's keys. Try again in a minute.",
"type": "rate_limit_error",
"param": null,
"code": "rate_limit_exceeded"
}
}
Status codes
| Status | code | Meaning | What to do |
|---|---|---|---|
| 400 | missing_required_parameter | model or messages is missing. | Send both. |
| 400 | invalid_value | A field is the wrong type or out of range, or the last message isn’t the user’s. | Read message and param. |
| 401 | invalid_api_key | No key, or not a key Heura Studios knows. | Use the model’s current key. |
| 403 | plan_required | The model’s owner is on a plan without the API. | The owner upgrades on the Plan page. |
| 404 | model_not_found | model isn’t the id of this key’s model. | Send the model’s id. |
| 429 | rate_limit_exceeded | Over the requests-a-minute limit. | Wait for Retry-After. |
| 429 | daily_limit_reached | The model’s answers for today are used. | Try again tomorrow, or raise the cap. |
| 429 | insufficient_quota | The account is out of credits. | The owner gets more on the Plan page. |
| 429 | concurrency_limit_reached | The model already has 4 answers in progress. | Retry after Retry-After. |
| 503 | warming_up | Heura Arche is loading after a restart, about a minute. | Retry after a minute. |
| 503 | not_serving | The model has no Deploy in its pipeline. | Add Deploy back. |
| 503 | engine_unavailable | The model’s outside engine can’t answer right now. | Check the connection. |
| 503 | overloaded | The server has all the answers in progress it takes. | Retry with backoff. |
Every 429, and a 503 for a busy or warming server, carries a Retry-After header in seconds.
Rate limits
| Limit | Value |
|---|---|
| Requests per key | 60 a minute |
| Requests across an account’s keys | 120 a minute |
| Answers in progress per model | 4 at once |
| Messages per request | 200 |
| Characters per message | 8,000 |
Answers also draw on the account’s credits, and a model can have a daily cap on answers, set in its settings.
Retrying well
- Retry
429and503with exponential backoff, and honorRetry-Afterwhen it’s there. - Don’t retry
400,401,403or404: the request needs changing. - A refused request takes no credit.