Rate Limits

Rate limits protect the API from abuse and ensure fair usage for all users. Limits are applied per API key.

Default Limits

Limit TypeDefault ValueDescription
Requests per minute100 RPMMax API calls per minute per key
Tokens per minute500,000 TPMMax tokens processed per minute
Concurrent requests10Max simultaneous requests per key

Need higher limits? Contact supportwith your use case and we'll adjust them.

How Rate Limiting Works

Rate limits are enforced using a sliding window algorithm. Each API key has a counter that resets every minute. When a limit is exceeded, the API returns a 429 Too Many Requests response.

Headers

Every response includes these headers for rate limit tracking:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87
X-RateLimit-Reset: 1700000060

Handling Rate Limits

When you receive a 429 response, use these strategies:

Exponential Backoff

Wait increasingly longer between retries:

import time
from openai import OpenAI, RateLimitError

client = OpenAI(base_url="https://api.relay-station.com/v1", api_key="sk-...")

for attempt in range(5):
    try:
        response = client.chat.completions.create(
            model="deepseek-chat",
            messages=[{"role": "user", "content": "Hello"}]
        )
        break
    except RateLimitError:
        wait = 2 ** attempt  # 1, 2, 4, 8, 16 seconds
        print(f"Rate limited. Retrying in {wait}s...")
        time.sleep(wait)

Respect Retry-After

The Retry-After header tells you exactly how long to wait:

import time
from openai import OpenAI, RateLimitError

client = OpenAI(base_url="https://api.relay-station.com/v1", api_key="sk-...")

try:
    response = client.chat.completions.create(...)
except RateLimitError as e:
    # In production, parse Retry-After from response headers
    retry_after = e.response.headers.get("Retry-After", "5")
    time.sleep(int(retry_after))

Requesting Higher Limits

If your application consistently hits rate limits, you can request an increase. We evaluate requests based on:

  • Your account history and payment record
  • Your specific use case (e.g., production deployment)
  • Your current average and peak usage

Email support@relay-station.com with your account email and desired limits.