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

# Errors

> What each status code and error message means, how to fix it, and when to retry.

## Error format

Errors come back as JSON with an `error` object:

```json theme={null}
{
  "error": {
    "message": "No available channel for model gpt-5 under group default (distributor) (request id: 20261201104512345678901...)",
    "type": "new_api_error",
    "code": "model_not_found"
  }
}
```

| Field | Meaning |
| - | - |
| `message` | What went wrong. The `request id` at the end identifies the request when you contact support |
| `type` | `new_api_error` means RefillAPI rejected the request; other values come from the model service |
| `code` | Error code; may be empty, in which case go by the status code and message |

On the Anthropic endpoint (`/v1/messages`), errors from the model may use the Anthropic error format.

## 400 — invalid request

| Message / code | Cause | Fix |
| - | - | - |
| `Model name not specified …` | No `model` field | Add the model ID |
| `invalid JSON request body` | Body is not valid JSON | Check quotes, commas and brackets |
| `Model … is an image, video or speech generation model and cannot be called on a text endpoint …` (`model_endpoint_unsupported`) | A video, image or audio model was used on a chat endpoint — often by picking it in a coding tool | Pick a text model in chat tools; call [video](https://docs.refillapi.com/api/videos/overview.md), [image](https://docs.refillapi.com/api/images.md) or [audio](https://docs.refillapi.com/api/audio/speech.md) endpoints for the others |
| Other parameter errors | The model does not accept a parameter or value | Start from a minimal request and add parameters one at a time |

## 401 — invalid key

| Message | Cause | Fix |
| - | - | - |
| `Invalid token` | The key is wrong or incomplete, missing, deleted, **disabled**, **expired**, or **out of its own quota** | Check the key's status, expiry and remaining quota on [API Keys](https://refillapi.com/keys) |

Send the key as `Authorization: Bearer YOUR_API_KEY`. The Anthropic endpoint also accepts `x-api-key: YOUR_API_KEY`.

## 403 — not allowed or no credit

| Message / code | Cause | Fix |
| - | - | - |
| `Insufficient user quota …` or `Not enough quota to pre-consume for this request …` (`insufficient_user_quota`) | Wallet balance is too low for this request | [Add credit](https://docs.refillapi.com/account/billing.md) |
| `token quota is not enough …` (`pre_consume_token_quota_failed`) | The key's own remaining quota cannot cover this request | Raise the key's quota or make it unlimited |
| `This token has no access to model …` | The key's model limits exclude this model | Add the model to the key, or use another key |
| `Your IP address is not on this token's allowlist` | The key has an IP allowlist | Add your IP or clear the allowlist |

## 404 — wrong URL

| Message | Cause | Fix |
| - | - | - |
| `Invalid URL (POST /v1/v1/chat/completions)` | `/v1` added twice | Set the SDK base URL to `https://refillapi.com/v1` and do not add `/v1` again |
| `Invalid URL (POST /chat/completions)` | `/v1` missing | Use `https://refillapi.com/v1` |
| `Invalid URL (POST /v1)` | The tool wants the full endpoint URL | Use `https://refillapi.com/v1/chat/completions` |

## 429 — too many requests

| Message | Cause | Fix |
| - | - | - |
| `You have reached the request limit …` | RefillAPI rate limit | Lower concurrency and retry with backoff |
| `You have reached the total request limit … including failed attempts` | A program is retrying a failing request in a loop | Fix the request instead of retrying |
| Rate-limit message from the model service | The model is busy | Retry with backoff, or try another model of the same family |

## 5xx — server or model errors

| Status / code | Cause | Fix |
| - | - | - |
| 503 `model_not_found` | The model ID does not exist, or the model is temporarily unavailable. **A trailing space in the ID also causes this** | Copy the exact ID from [List models](https://docs.refillapi.com/api/list-models.md). If the ID is right, retry a little later |
| 500 `convert_request_failed` | The model does not support this endpoint format | Use `/v1/chat/completions` |
| 500 / 502 / 504 `do_request_failed`, `bad_response_status_code`, … | The model service failed or timed out | Retry a few times; contact support with the `request id` if it persists |

## Succeeded but looks wrong

| Symptom | Cause | Fix |
| - | - | - |
| 200 with empty `content` and `finish_reason: "length"` | A reasoning model used all of `max_tokens` on thinking | Raise `max_tokens` |
| Video poll returns 200 but no video | The task `status` is `failed` | Read `error.message` — see [Video generation](https://docs.refillapi.com/api/videos/overview.md#2-poll) |

## Should I retry?

| Status | Retry? |
| - | - |
| 400, 401, 403, 404 | No. Fix the request, key or setup first. Repeating a bad request can also trigger 429 |
| 429 | Yes, with backoff (1 s, 2 s, 4 s …) and lower concurrency |
| 5xx | A few times (at most 3); then contact support |

Every successful request is billed. Cap automatic retries so a request that actually succeeded is not sent again.

## Contact support

Email [support@refillapi.com](mailto:support@refillapi.com) with the time, model ID, endpoint, the `request id` from the error, and the error message. Never send your full API key or `Authorization` header.


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