API Key Not Working? Fix 401, 402, 403 and 429 Errors
Why an AI API key stops working: what 401, 402, 403 and 429 mean, which code each provider uses for an empty balance, and how to fix each one.
- When an AI API key "isn’t working", the error number tells you why: 401 means the key itself is wrong, 402 usually means your balance or credits have run out, 403 means the key isn’t allowed to do that, and 429 means too many requests or, with some providers, an empty balance.
- Providers don’t agree on the code for an empty balance. DeepSeek, OpenRouter, Mistral, Together, Fireworks and Gemini’s prepaid billing use 402; OpenAI, Kimi and Z.ai use 429; Alibaba Cloud’s Qwen uses 403. Read the message, not just the number.
- Balance errors don’t go away if you wait; rate limits usually do. The table below lists each provider’s official error page, checked on 18 November 2026.

What does "API key not working" actually mean?
An API key is the secret code an app sends with each request so the AI provider knows it’s you and whose account to charge. When something goes wrong, the provider replies with an error: a three-digit number called an HTTP status code, plus a short message.
The number tells you what kind of problem it is; the message gives the detail. Oriveo turns the common ones into plain titles such as "Invalid API Key" or "Provider Quota Reached", explained further down this page.
Quick guide: 401, 402, 403, 429 and 5xx
Start here. Find your number, then read the matching section below. This summary follows the error pages of OpenAI, Anthropic and other providers as of 18 November 2026.
| Code | What it usually means | Will waiting fix it? | What to do |
|---|---|---|---|
| 401 | The key is wrong: a missing character, an extra space, a deleted key, or a key from another provider or region | No | Copy the key again or create a new one; check the provider and region |
| 402 | Payment needed: your prepaid balance or credits ran out, or there’s a billing problem | No | Top up, or fix the payment method on the provider’s billing page |
| 403 | The key works but isn’t allowed: unsupported country or region, no access to that model, or a verification step | No | Check supported regions, the key’s permissions and any verification |
| 404 | The model name or address is wrong | No | Pick another model or check the address |
| 429 | Too many requests in a short time or, with some providers, an empty balance or a spending limit | Often, if it’s a rate limit | Wait and retry; if the message mentions quota, balance, credit or spend limit, top up or raise the limit |
| 500–504, 529 | A fault or overload on the provider’s side | Usually | Try again later or switch models |
Why does it say insufficient balance or quota?
Most providers need prepaid credit or an active billing method before the API works, and each one reports an empty balance in its own way. A new key won’t fix any of these; adding credit will.
This is the code each of Oriveo’s 15 built-in providers documents when your balance or credit runs out. "Not stated" means the provider’s documentation, checked on 18 November 2026, doesn’t give an HTTP code for this case.
| Provider | Code when your balance runs out | What the message says | Official page |
|---|---|---|---|
| OpenAI | 429 | credit_balance_exhausted (the error type may still read insufficient_quota) | developers.openai.com/api/docs/guides/error-codes |
| Anthropic (Claude) | Not stated | "Your credit balance is too low to access the Anthropic API"; payment problems return 402 billing_error | platform.claude.com/docs/en/api/errors (codes); platform.claude.com/docs/en/about-claude/api-credits-for-subscribers (message) |
| Google Gemini | 402 (prepaid billing) | payment_required; 403 can also mean an unpaid Cloud Billing balance | aistudio.google.com/docs/api-errors |
| OpenRouter | 402 | Your account or API key has insufficient credits | openrouter.ai/docs/api-reference/errors |
| DeepSeek | 402 | Insufficient Balance | api-docs.deepseek.com/quick_start/error_codes |
| xAI (Grok) | Not stated | Requests are rejected once prepaid credits run out | docs.x.ai/console/billing |
| Mistral AI | 402 | Payment required | docs.mistral.ai/resources/error-glossary |
| Groq | Not documented | Groq bills after use; its error page lists no balance error | console.groq.com/docs/errors |
| Together AI | 402 | Payment Required | docs.together.ai/docs/error-codes |
| Fireworks AI | 402 | Payment Required | docs.fireworks.ai/guides/inference-error-codes |
| MiniMax | Not stated (business code 1008) | insufficient balance | platform.minimax.io/docs/api-reference/errorcode |
| Z.ai (GLM) | 429 (code 1113) | Insufficient balance or no resource package. Please recharge. | docs.z.ai/api-reference/api-code |
| Qwen (Alibaba Cloud) | 403 | Arrearage or isv.OUT_OF_SERVICE (account in arrears) | alibabacloud.com/help/en/model-studio/error-code |
| Kimi (Moonshot AI) | 429 | exceeded_current_quota_error | platform.kimi.ai/docs/api/errors |
| SiliconFlow | Not documented | No balance error listed | docs.siliconflow.com/en/faqs/error-code |
401: invalid API key or authentication failed
A 401 means the provider doesn’t recognise the key. Typical messages are "Incorrect API key provided" (OpenAI), "authentication_error" (Anthropic), "Authentication Fails" (DeepSeek) and "Invalid API key: this is not an OpenRouter API key" (OpenRouter).
- Copy the key again from the provider’s site, and check for missing characters or spaces at either end.
- Make sure the key belongs to the provider you chose. An OpenAI key won’t work as an OpenRouter key, and the other way round.
- Kimi, MiniMax and Qwen run separate regional platforms, and a key from one doesn’t work on another. In Oriveo, choose the matching region in the "Official Endpoint" selector ("Official Request URL" on iPhone).
- If the key was deleted, revoked or has expired, create a new one.
402: payment required or insufficient balance
A 402 is about money: the prepaid balance is empty, or the payment method failed. Top up or update your payment details on the provider’s billing page, then send again. Waiting doesn’t help.
In Oriveo this appears as "Provider Quota Reached": "The provider reports that the quota or credit for this API key is used up. Check your billing with the provider, or switch models."
403: forbidden or permission denied
A 403 means the provider recognised the key but won’t allow the request. The reason depends on the provider:
- OpenAI returns "Country, region, or territory not supported" when the API is used from a country it doesn’t support. Each provider publishes its list of supported countries.
- Gemini returns 403 when a free-tier project needs verification (FREE_TIER_VERIFICATION_REQUIRED), when the linked Cloud Billing account has an unpaid balance, or when Google has blocked a key reported as leaked.
- Anthropic returns permission_error when the key can’t use the resource; check your organisation and workspace settings.
- OpenRouter returns 403 when a request is blocked by permissions, moderation, a guardrail or a budget limit.
- SiliconFlow requires identity verification for some models.
- Qwen uses 403 for an account in arrears, and for AllocationQuota.FreeTierOnly when the free quota is used up and the "Free Quota Only" setting is on.
429: too many requests, rate limit or quota exceeded
Most of the time, 429 means you sent too many requests or tokens in a short time. That is a rate limit, and it clears if you wait a few tens of seconds. If the reply includes a Retry-After time, wait that long.
Several providers also use 429 for an empty balance or a spending limit, and waiting won’t fix those: OpenAI (credit_balance_exhausted, or a spend limit you set), Kimi (exceeded_current_quota_error), Z.ai (code 1113), and Anthropic when an organisation reaches its monthly spend limit (enforced_spend_limit_reached), which lasts until the next month unless you request a higher tier.
Free tiers are tighter. Gemini’s free tier and OpenRouter’s free models have per-minute and per-day limits.
In Oriveo, a rate limit appears as "Rate Limited" on the web or "Provider Rate Limited" on iPhone and Android. If the message mentions quota or credit, Oriveo shows "Provider Quota Reached" instead.
What do Oriveo’s error messages mean?
These are the messages you may see in Oriveo, in its English wording:
| What Oriveo shows | What it means | What to do |
|---|---|---|
| Saved, but the key looks invalid. You can verify it later in provider settings. | Oriveo saved the provider, but the provider rejected the key during the check | Copy the key again and update it in that provider’s settings |
| Invalid API Key | The provider returned 401 or 403 | Check or replace the key; for 403, check region and permissions |
| Provider Quota Reached | The provider says the credit or quota for this key is used up (402, or 429 mentioning quota) | Top up with the provider, or switch to another model |
| Rate Limited / Provider Rate Limited | Too many requests for now (429) | Wait a moment and try again |
| Free Quota Reached | Today’s Oriveo Free allowance is used up; this has nothing to do with your own key | Add your own API key, or wait for the reset at 00:00 UTC |

Using a custom endpoint, relay or gateway?
If you connect through a custom endpoint, the error can come from that service or from the provider behind it. When Oriveo says "This connection could not reach its upstream provider", the service’s own account with the provider may be invalid, out of credits or rate-limited. That isn’t your configuration; switch to another connection or contact whoever runs the service.
Check these before you create a new key
A new key fixes a 401 and little else. Go through this list first:
- You chose the right provider and, for Kimi, MiniMax, Qwen, SiliconFlow and Z.ai, the right region.
- You copied the whole key, with no spaces.
- There is credit in the account, or an active billing method.
- Your country or region is on the provider’s supported list.
- The model you picked is available to your account or tier.
Common app questions
Why is my API key not working?
What does a 401 error mean for an API key?
What is a 402 Payment Required error?
Is a 429 error a rate limit or a quota problem?
Why does my OpenAI API key say insufficient_quota?
Why doesn’t my new API key work when I copied it correctly?
Related reads
From the blog
See plain-language errors for every key
Open the web app or download Oriveo for iPhone or Android, add keys from 15 providers, and get a clear reason when a request fails.
No API key yet? Oriveo Free lets you start without one.