Rate Limits
Default rate limits by plan, how to handle 429 errors, and exponential backoff implementation.
Rate Limits
QwenAPI enforces rate limits to ensure fair usage across all customers. Limits are applied per API key.
Default limits by plan
Limits apply across all models. A burst of requests toqwen3-max counts against the same RPM bucket as requests to qwen3.5-flash.
To upgrade your plan, visit the dashboard.
Rate limit headers
Every API response includes headers showing your current limit status:
Read these headers to implement proactive throttling before hitting a 429.Handling 429 errors
When you exceed a rate limit, the API returns HTTP 429 Too Many Requests. The response body includes a message field explaining which limit was hit.
The recommended approach is exponential backoff with jitter: wait, then retry, doubling the wait time on each failure up to a maximum.
Python
``python
import time
import random
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)
def chat_with_backoff(**kwargs):
max_retries = 6
base_delay = 1.0
for attempt in range(max_retries):
try:
return client.chat.completions.create(**kwargs)
except openai.RateLimitError:
if attempt == max_retries - 1:
raise
delay = base_delay * (2 ** attempt) + random.uniform(0, 1)
time.sleep(delay)
`
Node.js
`javascript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
});
async function chatWithBackoff(params, maxRetries = 6) {
let delay = 1000;
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
return await client.chat.completions.create(params);
} catch (err) {
if (err.status !== 429 || attempt === maxRetries - 1) throw err;
await new Promise((r) => setTimeout(r, delay + Math.random() * 1000));
delay *= 2;
}
}
}
`
Tips for staying under limits
- Batch non-urgent requests. Use the Batch API for workloads that don't need real-time responses — it's also 50% cheaper.
- Cache repeated prefixes. Context caching reduces token consumption on requests with long shared prefixes.
- Monitor headers proactively. Check x-ratelimit-remaining-requests` and slow down before you hit zero.
- Distribute load. If you're running parallel workers, add jitter to their start times to avoid synchronized bursts.
For sustained high-volume workloads, contact us about Enterprise limits.