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

# Errors

> Standard error categories returned by APIAny.AI.

Each chat endpoint returns errors in the **same shape as the API standard it is
compatible with** (OpenAI, Anthropic, or Gemini). Every error response also
includes an `X-Request-Id` header, and returns only the information you need to
debug your request.

## OpenAI — `/v1/chat/completions` (and image/video endpoints)

```json theme={null}
{
  "error": {
    "message": "Insufficient credits",
    "type": "insufficient_quota",
    "code": "insufficient_credits",
    "param": null
  }
}
```

## Anthropic — `/v1/messages`

```json theme={null}
{
  "type": "error",
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key"
  }
}
```

## Gemini — `/v1beta/models/{model}:generateContent`

```json theme={null}
{
  "error": {
    "code": 400,
    "message": "model is required",
    "status": "INVALID_ARGUMENT"
  }
}
```

## Status mapping

The error `type` / `status` is derived from the HTTP status:

| HTTP | OpenAI `type`           | Anthropic `type`               | Gemini `status`             |
| ---- | ----------------------- | ------------------------------ | --------------------------- |
| 400  | invalid\_request\_error | invalid\_request\_error        | INVALID\_ARGUMENT           |
| 401  | authentication\_error   | authentication\_error          | UNAUTHENTICATED             |
| 403  | permission\_error       | permission\_error              | PERMISSION\_DENIED          |
| 404  | not\_found\_error       | not\_found\_error              | NOT\_FOUND                  |
| 402  | insufficient\_quota     | invalid\_request\_error        | RESOURCE\_EXHAUSTED         |
| 429  | rate\_limit\_error      | rate\_limit\_error             | RESOURCE\_EXHAUSTED         |
| 5xx  | api\_error              | api\_error / overloaded\_error | SERVER\_ERROR / UNAVAILABLE |

## Minor-sensitive media prompts

Image and video requests are rejected with HTTP `400` and code
`content_policy` when a prompt clearly combines a minor with exposure or
emphasis of sensitive body areas, or with explicit sexual or nudity content.
This check happens before task creation and credit reservation, so no credits
are charged.

```json theme={null}
{
  "error": {
    "message": "Requests involving minors and exposure or emphasis of sensitive body areas are not allowed. Use an adult subject (18+), remove sensitive-body close-ups, and keep the subject fully clothed. No credits were charged.",
    "type": "invalid_request_error",
    "code": "content_policy",
    "param": null
  }
}
```

Ordinary child-safe scenes such as family, classroom, sports, and art prompts
are not blocked by this targeted preflight rule. Requests that pass preflight
remain subject to each model's general safety policy.
