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

# Errors

> Status codes and error bodies.

A `null` answer from Sage is a 200, not an error: don't retry it.

## Status codes

| Status | Meaning | What to do |
| - | - | - |
| `400` | Invalid request, or over a [limit](https://docs.levanto.ai/decision-model/limits.md) | Fix the request |
| `401` | Missing or invalid API key | Check the key |
| `402` | This period's included usage is used up | Upgrade, or wait for the next period |
| `413` | Extraction: the document is too long | Split it |
| `422` | [SystemOne](https://docs.levanto.ai/systemone.md): unknown model, or a question or option it can't read | Fix the request |
| `429` | Busy | Retry after the seconds in the `Retry-After` header |
| `502` | LLMs: every model tried failed | Retry |
| `503` | Loading or temporarily unavailable | Retry |

## Sage

Decisions and extraction return a `detail`:

| Status | Example body |
| - | - |
| `400` | `{"detail": "content: Field required"}` |
| `401` | `{"detail": "API key required. Provide a valid Levanto API key."}` |
| `402` | `{"detail": "This period's included usage is used up. Upgrade your plan at https://platform.levanto.ai or wait for the next period."}` |
| `413` | `{"detail": "content plus field definitions exceed 16384 tokens; split the content"}` |
| `503` | `{"detail": "Service is still loading."}` |

[SystemOne](https://docs.levanto.ai/systemone.md) answers a `422` with a list that says where the problem is:

```json theme={"theme":"github-light"}
{"detail": [{"loc": ["body", "model"], "msg": "unknown model 'jev-latest'; GET /v1/models lists the accepted names (levanto-sage-2, sage-latest)", "type": "value_error"}]}
```

A [stream](https://docs.levanto.ai/stream.md) reports errors as `error` frames and close codes.

## OpenRouter Extractions

[`/api/alpha/extractions`](https://docs.levanto.ai/openrouter-extractions) answers errors in OpenRouter's shape:

```json theme={"theme":"github-light"}
{"error": {"code": 400, "message": "fields['total']: type 'estimate' is not supported by this model; supported types: text, number, date, time, datetime, duration, list"}}
```

## LLMs

Levanto's errors come as `application/problem+json`, with a `code` to branch on:

```json theme={"theme":"github-light"}
{
  "type": "about:blank",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Invalid API key.",
  "code": "invalid_api_key"
}
```

| Status | `code` | Meaning |
| - | - | - |
| `400` | `invalid_request` | The body is malformed, or names a model Levanto doesn't serve |
| `400` | `context_length_exceeded` | No model's context can hold the request |
| `400` | `unsupported_modality` | The model can't take this input, such as an image |
| `401` | `invalid_api_key` | Missing or invalid API key |
| `402` | `payment_required` | This period's included usage is used up |
| `429` | `rate_limited` | Too many requests: retry after `Retry-After` |
| `502` | `provider_error` | Every model tried failed |
| `503` | `no_supply` | No model is available right now: retry after `Retry-After` |

An error from the model itself is relayed in the format of the endpoint you called, OpenAI's or Anthropic's, so SDKs raise their usual error.


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