Rate limits
The Mira API enforces rate limits to ensure fair access and service stability. Limits depend on your subscription plan and are applied per API key.
Per-tier limits
Current per-tier allowances live on the pricing page, which is the single source of truth for plan limits and rates.
Retry-After header
When the limit is exceeded, the 429 response includes a Retry-After header with the number of seconds until the next allowed request:
429 response example
HTTP/1.1 429 Too Many Requests
Retry-After: 120
Content-Type: application/json
{
"detail": "Daily request limit exceeded."
}Handling 429 errors
Python
import time, os, requests
def call_with_retry(messages, max_retries=3):
for attempt in range(max_retries):
response = requests.post(
"https://api.vmira.ai/v1/chat/completions",
headers={"Authorization": f"Bearer {os.environ['MIRA_API_KEY']}"},
json={"model": "mira", "messages": messages},
)
if response.status_code == 429:
retry_after = int(response.headers.get("Retry-After", 60))
time.sleep(retry_after)
continue
return response.json()
raise Exception("Max retries exceeded")Best practices
- Respect Retry-After — On 429 responses, always check the Retry-After header and wait the specified number of seconds.
- Implement exponential backoff — For 500 errors, use increasing delays: 1s, 2s, 4s, 8s...
- Cache responses — Cache identical requests client-side.
- Upgrade your plan — If you regularly hit rate limits, consider upgrading.
Compare plans on the pricing page.