> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.kontinent.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.kontinent.ai/_mcp/server.

# Errors

Errors are always OpenAI-shaped:

```json
{ "error": { "message": "…", "type": "…", "code": "…" } }
```

## Status reference

| HTTP | `code`                  | `type`                  | Meaning / client action                              |
| ---- | ----------------------- | ----------------------- | ---------------------------------------------------- |
| 400  | `invalid_request`       | `invalid_request_error` | Malformed body, over 2 MiB, or missing `model`.      |
| 401  | `invalid_api_key`       | `invalid_request_error` | Bad or revoked key — **do not retry**.               |
| 402  | `insufficient_credits`  | `insufficient_quota`    | Balance ≤ 0 — top up, then retry.                    |
| 404  | `model_not_found`       | `invalid_request_error` | Unknown or disabled model id.                        |
| 429  | `rate_limit_exceeded`   | `rate_limit_error`      | Per-key RPM hit — back off (sliding 60 s window).    |
| 429  | `upstream_rate_limited` | `rate_limit_error`      | Provider throttled us — retry with backoff.          |
| 500  | `internal_error`        | `api_error`             | Gateway bug — retriable.                             |
| 502  | `upstream_auth_error`   | `api_error`             | Provider rejected **our** credentials — our problem. |
| 502  | `upstream_error`        | `api_error`             | Provider 5xx / connect failure — retriable.          |

## Passthrough errors

Upstream 4xx bodies that are already OpenAI-shaped (for example, provider-side
validation of your parameters) are **passed through with their original
status** rather than rewrapped.

## Retry guidance

#### Retriable

`429`, `500`, `502 upstream_error`. Use exponential backoff with jitter.

#### Not retriable as-is

`400`, `401`, `404`. Fix the request or the key first. `402` is retriable
only after a top-up.