# Errors

> HTTP status codes and error bodies returned by the Kurrens API.

Errors use the OpenAI error format. Every response carries a request id — include it when you contact support.

```json
{
  "error": {
    "message": "Your account balance is insufficient.",
    "type": "insufficient_quota",
    "code": "insufficient_quota"
  }
}
```

| Status | Code | When it happens | What to do |
|:--:|---|---|---|
| 400 | `invalid_request_error` | Malformed JSON, unknown parameter, or a value out of range | Fix the request; don't retry |
| 400 | `context_length_exceeded` | Prompt plus `max_tokens` exceeds the model's context window | Shorten input or lower `max_tokens` |
| 401 | `invalid_api_key` | Missing, malformed, or revoked key | Check the `Authorization` header |
| 402 | `insufficient_quota` | Credit balance exhausted | Add credits |
| 403 | `model_not_allowed` | The key can't use this model | Check the key's model permissions |
| 403 | `account_suspended` | The account is suspended | Contact support |
| 404 | `model_not_found` | Unknown model id | Check the [Model catalog](/docs/getting-started/models) |
| 404 | `model_retired` | The model passed its retirement date | Move to the replacement — see [Model lifecycle](/docs/models/lifecycle) |
| 413 | `request_too_large` | Request body too large | Send smaller payloads |
| 429 | `rate_limit_exceeded` | Over your rate limit, or the model is at capacity | Back off and retry — see [Rate limits](/docs/getting-started/rate-limits) |
| 500 | `server_error` | Unexpected error on our side | Retry with backoff |
| 503 | `service_unavailable` | Temporary overload or maintenance | Retry with backoff |

Errors that happen **after streaming has started** are delivered as a final SSE event with an `error` object, followed by
the stream closing.
