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

Rate limits are applied per-user (not per-model). All models share a single daily limit:

TierRequests per dayPrice
Free20Free
Pro500199 ₽ / mo
MaxUnlimited990 ₽ / mo
The mira-pro model requires the Pro plan or higher. The mira-max model requires the Max plan.

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))
            print(f"Rate limited. Waiting {retry_after}s...")
            time.sleep(retry_after)
            continue
        return response.json()
    raise Exception("Max retries exceeded")

Best practices

  • Respect Retry-AfterOn 429 responses, always check the Retry-After header and wait the specified number of seconds.
  • Implement exponential backoffFor 500 errors, use increasing delays: 1s, 2s, 4s, 8s...
  • Cache responsesCache identical requests client-side.
  • Upgrade your planIf you regularly hit rate limits, consider upgrading to a higher tier.
For high-traffic applications, the Max tier is recommended. When the limit is exceeded, requests are automatically charged from your balance.

Next steps