> ## Documentation Index
> Fetch the complete documentation index at: https://nemonist.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors and retries

> What each status means and when to retry.

Errors come back as JSON with a status code and a message:

```json theme={null}
{ "error": { "code": 401, "message": "This API key is not valid" } }
```

| Status | Meaning | What to do |
| - | - | - |
| `400` | The request is malformed or has invalid parameters. | Fix the request. |
| `401` | The key is missing, invalid or disabled. | Check the key; see [Troubleshooting](https://nemonist.com/docs/troubleshooting.md). |
| `402` | Over a spending cap, or out of credits. | [Buy credits](https://nemonist.com/docs/concepts/credits.md) or raise the cap. |
| `403` | The key may not do this, or a [guardrail](https://nemonist.com/docs/concepts/guardrails.md) blocked the request. | Check the key's rules and guardrails. |
| `404` | No such model or endpoint, or no endpoint for this model takes the request (for example tools). | Pick a model whose page lists what you send. |
| `408`, `504`, `524` | The request or the provider timed out. | Retry. |
| `413` | The request is too large. | Send less. |
| `429` | Rate limit reached. | Wait, then retry: see [Rate limits](#rate-limits). |
| `500`, `502`, `503`, `529` | nemonist or the provider failed or is overloaded. | Retry with backoff. |

Unlike OpenRouter, the body has no top-level `user_id` and no provider or routing details in `error.metadata`; when nemonist knows the kind of error, `error.metadata` holds only `error_type`. A model the key's allowed models exclude is `403`, where OpenRouter answers `404`. See [Migrating from OpenRouter](https://nemonist.com/docs/migrating-from-openrouter.md#what-is-different).

## Rate limits

A `429` carries the wait in its headers, when it knows one:

* `Retry-After`: seconds to wait. nemonist's own limits (open streams, requests a minute) send it, and so does a provider that sends it.
* `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`: the window's limit, what is left, and when it resets, in milliseconds since the epoch (not seconds). Endpoints with a fixed per-key limit, such as the datasets endpoints (30 a minute), send these and no `Retry-After`, the same as OpenRouter.

When neither is present, back off as below.

## Retries

Retry `408`, `429` and `5xx` with exponential backoff and jitter. Do not retry `400`, `401`, `402`, `403` or `413` unchanged.

Every endpoint's own errors are listed in the [API Reference](https://nemonist.com/docs/api-reference/overview.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.