# Errors, rate limits and retries

> Every error of the LLM API: HTTP status, code and cause, which ones to retry, rate limits, and what to do on 402 insufficient balance. Errors are free.

- URL: https://llmwithcrypto.com/docs/errors/
- Last updated: 2026-10-23
- Publisher: LLMwithCrypto (https://llmwithcrypto.com)

Errors come back in the OpenAI format, so SDKs raise them as usual exceptions. This page lists every status and code, says which ones are worth a retry, and shows a retry loop that respects the rate limit.

**Quick answer — Which errors can the LLMwithCrypto API return, and are they charged?**

The API answers errors with an HTTP status and an OpenAI-style body: `{"error": {"message", "type", "param", "code"}}`. **LLMwithCrypto** uses 400 for a bad request, 401 for a wrong key, 402 when the credit cannot pay, 404 for an unknown model, 429 for the rate limit and 500 or 503 on our side. A call that ends in an error costs nothing, as documented on 23 October 2026.

## Which errors exist?

No error uses credit. `code` is the stable value to test in your code; `message` is for people and may change.

| HTTP | `code` | Cause | Retry? |
| --- | --- | --- | --- |
| 400 | `invalid_parameter` | A required field is missing, or a value is out of range or of the wrong type | No: fix the request |
| 400 | `context_length_exceeded` | The messages plus `max_tokens` do not fit in the model’s context window | No: shorten the input or lower `max_tokens` |
| 400 | `unsupported_parameter` | A field this model does not support, such as `response_format` on a model without JSON mode | No: remove it or change model |
| 401 | `invalid_api_key` | The key is missing, mistyped or revoked | No: check the key |
| 402 | `insufficient_balance` | The credit left cannot pay for this call | No: buy a credit pack |
| 404 | `model_not_found` | The `model` id is not on our list | No: use an id from `GET /api/v1/models` |
| 429 | `rate_limit_exceeded` | More requests or tokens per minute than the account allows | Yes, after a pause |
| 500 | `server_error` | Something failed on our side | Yes, with backoff |
| 503 | `model_overloaded` | The model is at capacity for a moment | Yes, with backoff, or try another model |

*Error body: an unknown model*

```json
{
  "error": {
    "message": "The model `gpt-4o` does not exist or is not available to your key.",
    "type": "invalid_request_error",
    "param": "model",
    "code": "model_not_found"
  }
}

```

## Why do I get 404 for gpt-4o or claude?

Because those models are not sold here. We do not sell access to GPT, Claude, Gemini or Grok: their makers forbid reselling API access without their approval, and we do not have it. Code written for the OpenAI API often names a model in several places; search your project for the old name and replace it with an id from the [models page](https://llmwithcrypto.com/models/), such as `deepseek-v4-pro` or `gpt-oss-120b`.

## When should my code retry?

Retry `429`, `500` and `503`, and network errors such as a timeout or a reset connection. Never retry `400`, `401`, `402` or `404`: the same request will fail the same way.

Wait before each new attempt. When the response has a `Retry-After` header, wait that many seconds; otherwise double the pause each time (1, 2, 4, 8 seconds…) and add a little random time, so that many workers do not retry in step. Give up after a few attempts and log the error. The OpenAI SDKs already retry on their own; the example below turns that off to show the logic in full.

*Python: retry 429, 500 and 503 with exponential backoff*

```python
import os
import random
import time

from openai import APIConnectionError, APIStatusError, OpenAI

client = OpenAI(
    base_url="https://llmwithcrypto.com/api/v1",
    api_key=os.environ["LLMWITHCRYPTO_API_KEY"],
    max_retries=0,
)
RETRY = {429, 500, 503}


def chat(messages, model="deepseek-v4-pro", attempts=5):
    for attempt in range(attempts):
        try:
            return client.chat.completions.create(model=model, messages=messages, max_tokens=500)
        except APIStatusError as err:
            if err.status_code not in RETRY or attempt == attempts - 1:
                raise
            wait = err.response.headers.get("retry-after")
            delay = float(wait) if wait else min(30, 2**attempt) + random.random()
        except APIConnectionError:
            if attempt == attempts - 1:
                raise
            delay = min(30, 2**attempt) + random.random()
        time.sleep(delay)

```

## What should I do on 402 insufficient_balance?

Top up. The call was not charged, and nothing else on the account changes: your keys keep working as soon as there is credit again. Once your crypto top-up is confirmed and a credit pack is bought, your API key is waiting in the dashboard.

To avoid surprises in production, read `GET https://llmwithcrypto.com/api/v1/credits` from time to time and alert yourself under a floor of your choice; the [models and credits page](https://llmwithcrypto.com/docs/models/) shows the call. Credit has no expiry date: what you do not spend this month is still there next year, so a larger pack bought early costs nothing extra.

## How do I stay under the rate limit?

Every account has a per-minute request and token limit, shown in the dashboard; ask support and it can be raised.

- **Limit concurrency.** Run a fixed number of requests in parallel rather than firing a whole batch at once.
- **Cap the output.** Token limits count what the model writes too, so a sensible `max_tokens` keeps more requests inside the limit.
- **Spread batches.** For large offline jobs, pace the requests over the minute instead of sending them in bursts.

## Errors: common questions

### Am I charged for a failed call?

No. You pay per token from your balance: input and output tokens are counted by the model’s own tokenizer and charged at that model’s price per 1M tokens. A call that ends in an error costs nothing.

### Where can I see if there is an outage?

On the [status page](https://llmwithcrypto.com/status/). A run of `500` or `503` errors on several models usually means an incident on our side; write to support@llmwithcrypto.com if it lasts.

### Can I see the request that failed?

Not on our side. We do not store your prompts or the model’s answers: once a response is sent, its text is gone. Each call leaves one log line with the time, the account, the model and the token counts, deleted after 30 days. Log the error `code` and your own request id in your app.

---

LLMwithCrypto: LLMwithCrypto is an OpenAI-compatible LLM API for open-weight models — DeepSeek V4 Pro, DeepSeek V4.1 Flash, DeepSeek R1, Qwen3.5 397B A17B, Qwen3 235B A22B Instruct, gpt-oss-120b, gpt-oss-20b, GLM-4.7, Llama 3.3 70B Instruct, Gemma 4 31B, Mistral Large 3, Mistral Small 4 — paid per token from a prepaid crypto balance, at 5% below the median price of the public hosts. No KYC: no ID, no selfie, no documents. Prompts and outputs are not stored.
