DeepSeek API Rate Limits and 429 Errors
DeepSeek publishes account limits of 2,500 simultaneous requests for Flash and 500 for V4 Pro. If a model request returns HTTP 429, check how many requests are already in flight and slow your workers before retrying.
DeepSeek model limits by account
| Model ID | Published concurrent requests per account |
|---|---|
deepseek-flash |
2,500 |
deepseek-v4-pro |
500 |
A request occupies a slot from the moment it is sent until the model completes its response. All API keys on the account share that model’s quota. DeepSeek combines requests across user_id values for regular accounts. Accounts with approved increases also have per-user_id limits. Check the quota and expansion options in the official rate limits documentation.
Think of the figures in the table as slots, measured in active requests. Your throughput also depends on response time. With all 40 of your own worker slots busy, a two-second average response gives roughly 20 completions per second. If the average rises to eight seconds, the same pool completes about five per second. Both figures are illustrative. The model documentation specifies concurrency, and standalone Search and Fetch have their own requests-per-second limits. DeepSeek Search and Fetch rate limits
How to diagnose HTTP 429, 503 and timeouts
| What you see | What to check | What to do next |
|---|---|---|
HTTP 429 |
Which endpoint responded, which model it served and how many requests were active across your account. A standalone endpoint can have a separate rate limit. | Lower concurrency or pace requests. Delay the next attempt, especially if many workers failed together. |
HTTP 503 |
DeepSeek describes this as service overload. Check for a DeepSeek status incident and compare responses from a small number of calls. | Wait before trying again and pause repeated attempts if errors persist. |
| Client timeout | Check your SDK and gateway logs for the timeout that fired. The client may stop waiting after the server has already started work. | Check whether replay could duplicate work or output before sending the request again. |
An HTTP 504 is a gateway response. DeepSeek documents it for cases such as OCR or document upload requests that could not finish within the service’s time limit. Before retrying, check the affected endpoint’s guidance. For example, a smaller file may help at an upload endpoint. DeepSeek API error codes
If you parse the response yourself, handle blank lines on non-streamed calls and SSE comments on streamed calls while you wait for a response. DeepSeek says it closes the connection if inference has yet to begin after 10 minutes. Use a separate overall deadline for your own application, since receiving keep-alive bytes can keep a read timeout from firing. DeepSeek keep-alive behavior
Bound retries in Python
Install the OpenAI Python SDK with python -m pip install openai and set DEEPSEEK_API_KEY on your server. If you need to verify the key first, use the API key and first-request guide.
This example sends a short, non-streaming request. It makes up to three attempts on HTTP 429 or 503, using progressively longer randomized waits. SDK retries are disabled so there is one attempt budget. If the response provides Retry-After, the example raises the error for the caller so a queue can honor the suggested delay. Client timeouts and other errors surface immediately. OpenAI Python SDK retry and timeout options
import os
import random
import time
from openai import APIStatusError, OpenAI
client = OpenAI(
api_key=os.environ["DEEPSEEK_API_KEY"],
base_url="https://api.deepseek.com",
max_retries=0,
timeout=30.0,
)
def complete(prompt):
for attempt in range(3):
try:
return client.chat.completions.create(
model="deepseek-flash",
messages=[{"role": "user", "content": prompt}],
max_tokens=128,
extra_body={"thinking": {"type": "disabled"}},
)
except APIStatusError as error:
if error.status_code not in (429, 503) or attempt == 2:
raise
if error.response.headers.get("Retry-After"):
raise
time.sleep(random.uniform(0.25, 0.5) * (2 ** attempt))
result = complete("Name three uses for a paper notebook.")
print(result.choices[0].message.content)
Keep retries inside the same worker budget
Put a queue ahead of your workers and give each model a separate cap based on its own quota and response times. For example, if three processes share a 40-slot Flash budget, give them 15, 15 and 10 slots, or enforce all 40 with a shared queue. Retry attempts should go through the same cap as new work. Keep room for other services on the account.
Track in-flight requests, time spent in the queue, response latency and the rates of 429, 503 and client timeouts by model. If you already sent part of a streamed response to a user, end that response cleanly before offering to regenerate it. Once your concurrency is stable, use the pricing calculator to budget for the workload you expect to finish.
Frequently asked questions
Do extra API keys increase my DeepSeek concurrency limit?
Each account has one concurrency quota per model shared across its keys. Count requests from every service that uses the account when you plan capacity.
Does a streaming request use a concurrency slot?
Yes. The request remains in flight until the response ends. An event-stream connection can already be open while you are still waiting for the first token.
Can I request a higher DeepSeek concurrency quota?
DeepSeek provides a capacity expansion request in its official rate limit documentation. If your account has a higher quota, plan for both the account quota and the per-user_id limits.