You are using OpenRouter and hit:
Error: Rate limit exceeded. Please wait 60 seconds.
Or your free tier ran out. Here is how to fix it.
Fix 1: Check your current limits
# Check rate limit headers
curl -I https://openrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTER_API_KEY"
# Headers show:
# X-RateLimit-Requests-Remaining: 10
# X-RateLimit-Tokens-Remaining: 50000
Free tier limits:
- 20 requests/minute
- 200 requests/day
- 50,000 tokens/day
Fix 2: Upgrade to paid tier
Free tier is limited. Add credits:
- Go to openrouter.ai/credits
- Add $5-10 credit
- Limits increase significantly
Paid tier limits:
- 200 requests/minute
- No daily limit
- Pay only for usage
Fix 3: Use cheaper models
Some models have lower rate limits:
# Expensive, lower limits
model = "anthropic/claude-sonnet-5" # $3/$15
# Cheaper, higher limits
model = "deepseek/deepseek-chat" # $0.14/$0.28
# Free models
model = "meta-llama/llama-3-8b:free" # $0
Fix 4: Implement exponential backoff
Handle rate limits gracefully:
import time
import random
def call_with_retry(prompt, max_retries=3):
for attempt in range(max_retries):
try:
response = client.chat.completions.create(
model="anthropic/claude-sonnet-5",
messages=[{"role": "user", "content": prompt}]
)
return response
except openai.RateLimitError:
wait = (2 ** attempt) + random.uniform(0, 1)
print(f"Rate limited, waiting {wait:.1f}s...")
time.sleep(wait)
raise Exception("Max retries exceeded")
Fix 5: Cache responses
Cache similar requests to reduce API calls:
import hashlib
import json
cache = {}
def cached_request(prompt):
key = hashlib.md5(prompt.encode()).hexdigest()
if key in cache:
return cache[key]
response = client.chat.completions.create(
model="anthropic/claude-sonnet-5",
messages=[{"role": "user", "content": prompt}]
)
cache[key] = response
return response
Fix 6: Use multiple API keys
Rotate between keys for higher limits:
api_keys = ["key1", "key2", "key3"]
current_key = 0
def get_next_key():
global current_key
key = api_keys[current_key]
current_key = (current_key + 1) % len(api_keys)
return key
client = openai.OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=get_next_key()
)
Fix 7: Batch requests
Combine multiple small requests into one:
# Instead of 10 separate requests
for item in items:
process(item)
# Send one batch request
batch_prompt = f"Process these items: {json.dumps(items)}"
response = client.chat.completions.create(
model="anthropic/claude-sonnet-5",
messages=[{"role": "user", "content": batch_prompt}]
)
Still hitting limits?
- Check model-specific limits β Some models have lower quotas
- Use direct API β Anthropicβs API may have higher limits
- Wait for reset β Rate limits reset every minute/hour
- Contact support β OpenRouter can increase limits for paid users
FAQ
What are OpenRouterβs rate limits?
Free tier: 20 requests/minute, 200 requests/day, 50,000 tokens/day. Paid tier: 200 requests/minute, no daily limit. Limits vary by model and tier. Check your dashboard for current limits.
How much does OpenRouter cost?
Pay only for what you use. Pricing varies by model. For example: Claude Sonnet 5 is $3/$15 per 1M tokens, DeepSeek V4 Flash is $0.435/$1.74. See our AI API Pricing guide for comparisons.
Can I use OpenRouter for free?
Yes, with the free tier. Some models like Llama 3 and Mistral 7B are always free. The free tier has lower limits but is sufficient for testing and light use.
Related: OpenRouter Complete Guide Β· AI API Pricing Compared 2026 Β· Claude Code API Rate Limit Fix Β· Best Free AI APIs 2026