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

# LLM Errors and Retry

> Troubleshoot LLM Gateway errors and choose safe retry behavior

LLM Gateway calls are direct provider-compatible requests, not async generation tasks. Use the HTTP status code and response body to decide whether to fix the request or retry.

## Common errors

| Status | Common cause                                                             | What to do                                                    |
| ------ | ------------------------------------------------------------------------ | ------------------------------------------------------------- |
| `400`  | Invalid request body, endpoint, model id, or provider-specific parameter | Fix the request before retrying                               |
| `401`  | Missing or invalid APIXO API key                                         | Check `APIXO_API_KEY` and the provider-compatible auth header |
| `403`  | Account or key cannot access the requested resource                      | Check account access, balance, or model availability          |
| `429`  | Rate limit, quota limit, or temporary capacity limit                     | Retry with exponential backoff                                |
| `500`  | Internal server error                                                    | Retry with backoff                                            |
| `502`  | Upstream provider error                                                  | Retry with backoff                                            |
| `504`  | Upstream timeout                                                         | Retry with backoff or reduce request size                     |

## Safe retry policy

Retry only transient failures such as `429`, `500`, `502`, and `504`.

```text theme={null}
1st retry: wait 1 second
2nd retry: wait 2 seconds
3rd retry: wait 4 seconds
then stop or hand off to a queue
```

Do not blindly retry:

* Authentication failures
* Invalid JSON or invalid request bodies
* Missing required provider headers
* Unsupported model names
* Requests that already produced a successful streamed response

## Debug checklist

1. Confirm the base URL matches the compatible API.
2. Confirm the API key is stored as `APIXO_API_KEY`.
3. Confirm the model name is supported by that API format.
4. Test the same request without streaming.
5. Save the response body and status code before contacting support.

<Tip>
  For generation task errors, use the general [Error Codes](/docs/api-reference/errors) page. This page is focused on direct LLM Gateway calls.
</Tip>
