# Errors

Source: https://mr-note.com/en/developers/ai-api/errors

What each status means and what to do.

## Status codes

| Status | Meaning | What to do |
| --- | --- | --- |
| 404 | No key, or a wrong or revoked key (the same answer as an address that does not exist) | Check the key and the base URL. |
| 402 insufficient_credits | The free allowance is used up and the credits don't cover the request | Buy credits or redeem a code, then retry. |
| 403 plan_required | API keys come with Plus | Upgrade to Plus. |
| 400 invalid_request | The request or the model refused it | Read the message; fix the request. |
| 429 | The model is busy upstream | Wait a moment and retry. |
| 5xx | The model could not answer | Retry later. |

402 on /v1/messages:

```json
{"type": "error", "error": {"type": "billing_error", "code": "insufficient_credits",
  "message": "Your free allowance is used up and your credit balance is too low for this request. Top up credits to go on.",
  "details": {"balance_credits": 0.42, "estimated_credits": 3.1}}}
```

/v1/chat/completions answers errors in OpenAI's shape ({"error": {"message", "type", "code"}}), /v1/messages in Anthropic's.
