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.
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.
Same account, same key group, same model deepseek-v4.1-flash - on 2026-11-06 I captured three full responses with curl -D-:
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.
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.
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).
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.
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.
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.
code? If yes, judge by it; if no, check whether the message contains "限额" (quota/limit).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.
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.
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:
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.
No. A rejected request produces no tokens, and we have no billing record for it (the 6 429s above measured as 0).
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.
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 - wait (start at 30s, exponential backoff); 503 - switch (model or time). Judge by status code and code, not gut feel.
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 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
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
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
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
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