LONG AI
Home › Blog › Getting 429 Errors? 5 Real Causes and th

Getting 429 Errors? 5 Real Causes and the Order to Check Them

Category:问题解答 · 8 min read · 2026-11-06

Conclusion first: 429 doesn't mean "your code is wrong" - it means "there's no resource for you right now." But the same 429 has five completely different causes behind it. The first two clear up on their own if you wait; the last three need you to change settings in the dashboard. Can't tell them apart and just crank up retries, and you'll wait forever.

I reproduced three kinds of 429 with a real key on our site, and pulled 30 days of error logs for attribution. Raw responses, stats, and backoff code are all below. The same method applies to any API relay.

1. First, the numbers: 70% of 429s aren't your fault

Over 30 days (2026-10-07 to 11-06), we logged 1,458 429s, against 77,291 successful billed calls in the same window. Split by source: platform-side gating 1,024 (70.2%), upstream returns 434 (29.8%).

A second number matters even more: of those 1,458 429s, the ones carrying a Retry-After response header totaled 0. So don't write code that "reads Retry-After to decide how long to wait" - it'll never arrive. You have to compute the backoff yourself.

30-day attribution of 1,458 429s: platform-side gating 1,024 (70.2%), upstream throttling 434 (29.8%), broken into five causes

2. Three raw 429 responses that look nothing alike

Same account, same key group, same model deepseek-v4.1-flash - on 2026-11-06 I captured three full responses with curl -D-:

Three real 429 responses: 5-hour limit with no code field, API_KEY_QUOTA_EXHAUSTED on total quota, gateway_concurrency_limit on concurrency

The nastiest is the first kind: the body has no code field at all - just a Chinese message and a generic type. If you branch on error.code, this case silently falls through and you misjudge it as "upstream flaking" and start retrying blindly.

3. Five real causes, matched one by one

Cause 1: you hit the platform account pool (518 occurrences)

The raw text is "All available accounts are currently rate-limited." It means the batch of upstream accounts we can use all got throttled at once - nothing to do with your code. Try a different time window, or a same-priced model, and it usually clears instantly.

Cause 2: every seller for this model is saturated (506 occurrences)

The raw text is "All upstream providers for this model are rate-limited." Peak-hour normal for hot models; it's a supply shortage. The three most concentrated in our data: kimi-k2.6 (77x), claude-fable-5 (60x), claude-opus-5-5 (25x).

Cause 3: the key's window quota is used up

A key can have three window quotas - 5-hour, 1-day, 7-day - and hitting any one returns 429, worded "api key 5小时限额已用完" (5-hour limit exhausted). This one is easiest to misread: it has nothing to do with account balance, and topping up won't fix it. You must change this key's quota settings.

Cause 4: the key's total quota is used up

The code is API_KEY_QUOTA_EXHAUSTED. Same story - the quota is a ceiling set on that one key, and topping up won't loosen it automatically. Seeing this code, don't add retries; go adjust the quota in the dashboard.

Cause 5: concurrency slots are full - it queues first, and only 429s if you can't wait

This one is the most counter-intuitive. Measured: with an account concurrency cap of 1, I fired 6 requests at once and all 6 returned 200 - they queued and ran serially, the slowest waiting 14.0s. At 12 concurrent, 11 succeeded and the last one sat in place for 30.1s before getting gateway_concurrency_limit. A sibling code is gateway_queue_full, meaning the queue itself is full.

So "10 concurrent gives me 429" and "100 concurrent is fine" can both be true - it depends on whether you can get a slot that second.

4. Two-minute triage: check four places in this order

  1. Does the body have a code? If yes, judge by it; if no, check whether the message contains "限额" (quota/limit).
  2. Is the message Chinese or English? Chinese is usually our gate (quota, concurrency); English is usually from upstream.
  3. Check this key's quotas in the dashboard: 5-hour, 1-day, 7-day, and total - if any is empty, that's it.
  4. Check your concurrency at that moment: how many requests were in flight.

One command grabs the first three of those four at once:

curl -D- -o body.txt -X POST https://ai.dijinlong.com/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer $KEY"   -d '{"model":"deepseek-v4.1-flash","max_tokens":8,"messages":[{"role":"user","content":"hi"}]}'

By the way, if the status is 401, 404, or 502, that's not throttling - don't look for answers here; see who owns those three errors instead.

5. How to write retries without shooting yourself

One premise: quota-type 429s won't recover no matter how many times you retry. So classify first, then back off:

import random, time, requests

QUOTA_CODES = {"API_KEY_QUOTA_EXHAUSTED"}          # only changing quota helps
CONC_CODES  = {"gateway_concurrency_limit", "gateway_queue_full"}

def call(payload, key, tries=4):
    for i in range(tries):
        r = requests.post("https://ai.dijinlong.com/v1/chat/completions",
                          json=payload, headers={"Authorization": "Bearer " + key}, timeout=120)
        if r.status_code != 429:
            return r
        err = r.json().get("error", {})
        code = err.get("code") or ""
        msg  = err.get("message", "")
        if code in QUOTA_CODES or "限额" in msg:   # quota: stop now, fix in dashboard
            raise RuntimeError("quota exhausted, retrying is pointless: " + msg)
        if code in CONC_CODES:                            # concurrency: lower it, then back off
            time.sleep(1)
            continue
        time.sleep(min(60, 2 ** i) + random.uniform(0, 1))   # else exponential backoff + jitter
    return r

One measured detail: a request rejected with 429 is not billed. My three probe keys ate 6 429s total, and none appeared on the bill; of the 19 successful calls, the cheapest cost only ¥0.000041. So don't skip retries "to save money" - the cost pressure isn't there.

6. When to switch models instead of retrying

Here's a line you can act on: three consecutive 429s on the same model, each more than 30 seconds apart, switch models. Still 429ing at 30-second intervals means it's not transient jitter - it's a capacity problem, and more waiting is wasted time.

Switch to what? Check the model plaza for live prices and seller counts per model; at the same price tier you can usually find 2-3 substitutes. Right now the plaza shows 185 models and 924 listings:

LONG AI model plaza: 185 models, 924 listings, filterable by vendor, capability, context, and price

Conversely, 503 means switch even more. The same period had 13,625 503s - over 9x the 429s. 503 means "this model has no available upstream this moment," and waiting won't conjure one.

7. Common questions

Do 429s cost money?

No. A rejected request produces no tokens, and we have no billing record for it (the 6 429s above measured as 0).

I topped up, why still 429?

Most likely the quota wasn't changed: balance belongs to the account, quota belongs to the key. Raise this key's four quota fields in the dashboard, or just clear the limits.

Works fine in Postman, but my code 429s constantly?

Check concurrency first. Measured: 6 concurrent on a cap-1 account get serialized into a queue, the slowest waiting 14s. Throttle concurrency with a semaphore in your loop - more effective than adding backoff.

429 vs 503: wait or switch?

429 - wait (start at 30s, exponential backoff); 503 - switch (model or time). Judge by status code and code, not gut feel.

What should I give support for the fastest resolution?

The x-request-id in the response header. The curl above already prints it - paste that one line when reporting, and it pins the exact request.

One last line: 429 means "temporarily no resource," not "you've been banned." Telling those apart beats writing ten lines of retry code. Prices and availability follow the model plaza in real time; this article's data was captured on 2026-11-06.

相关文章

GPT-6.2 Cuts Prices 20%: What the AI Price War Means

GPT-6.2 cuts list prices 20%, yet platform discounts run deeper: gpt-6-astra trades at under 1% of list. What this week's AI price war means for buyer

What Is Prompt Caching? How Cache Tokens Cut API Bills

Prompt caching stores a repeated prompt prefix and bills cache reads at 5-12% of normal input. Real prices, hit conditions, and how to cut your API bi

All 12 Claude Models Compared: Price and Best Use

Twelve Claude versions are on sale. The newest opus-5-5 costs $8.91 a month; the oldest opus-4-6 costs $49.50. Full table and a pick for each workload

Which AI Model Writes Code Best? Speed and Price Tested

gpt-5.6-terra and deepseek-v4.1-flash win on price and reliability; gemini-3.8-flash is fastest. Effective prices, measured speed, and a three-tier pi

One API Key, Every Model: How to Integrate a Multi-Model Marketplace

Point your base URL at the platform and one key covers all 138 on-sale models across 51 vendors, in both OpenAI and Anthropic request formats. Copy-pa