Rate Limits

Rate limits control how many requests you can make to the API within a specific time period. Different features have different rate limits based on your account level.

Per-User Tracking

Rate limits are tracked per user account, not per API key. All requests from your account count toward your rate limit regardless of which API key is used.

Checking Rate Limits & Plan Status

You can check your current rate limit status and plan information by inspecting the response headers from any API request. Every response includes detailed rate limit information.

Check Rate Limit Status

1import requests
2
3response = requests.post(
4    "https://api.selamgpt.com/v1/chat/completions",
5    headers={
6        "Authorization": "Bearer YOUR_API_KEY",
7        "Content-Type": "application/json"
8    },
9    json={
10        "model": "selam-turbo",
11        "messages": [{"role": "user", "content": "Hello"}]
12    }
13)
14
15# Check rate limit headers
16print(f"Limit: {response.headers.get('X-RateLimit-Limit')}")
17print(f"Remaining: {response.headers.get('X-RateLimit-Remaining')}")
18print(f"Reset: {response.headers.get('X-RateLimit-Reset')}")
19print(f"Reset After: {response.headers.get('X-RateLimit-Reset-After')} seconds")

Plan-Based Limits

Rate limits are determined by your account plan. Each plan tier provides different limits for various API features. Limits are enforced per user account, not per API key.

FREE Plan

Perfect for testing and personal projects. Includes access to basic text models and TTS features.

  • 5 text requests/minute, 100/day
  • No image generation access
  • 5 TTS requests/minute, 5 audio minutes/day
  • Access to selam-turbo and selam-thinking models

BETA Plan

Great for developers and small applications. Includes premium models and image generation.

  • 10 text requests/minute, 500/day
  • 1 image/minute, 10/day
  • 15 TTS requests/minute, 15 audio minutes/day
  • Access to all Selam models including selam-plus, selam-coder, selam-search
  • Direct access to 34+ provider models

PRO Plan

Ideal for production applications with higher usage requirements.

  • 10 text requests/minute, unlimited daily
  • 3 images/minute, 50/day
  • 30 TTS requests/minute, 40 audio minutes/day
  • Access to premium image models (selam-image-pro)
  • Priority support

DDoS Protection & Fair Use

Our API includes built-in DDoS protection and fair use policies to ensure service quality for all users.

Automatic Protection

Our infrastructure automatically detects and mitigates suspicious traffic patterns. Legitimate traffic is never affected by these protections.

Fair Use Policy

Rate limits are designed to prevent abuse while allowing legitimate use cases. Excessive or abusive usage may result in temporary restrictions or account suspension.

Per-User Enforcement

Rate limits are tracked per user account, not per API key. Creating multiple API keys will not bypass rate limits. This prevents users from circumventing limits and ensures fair resource allocation.

Burst Protection

Short bursts of traffic are allowed within your rate limits. However, sustained high-frequency requests may trigger additional protections.

Abuse Prevention

Attempting to bypass rate limits through multiple accounts, API keys, or other means is prohibited and may result in permanent account suspension.

Plan Validity & API Key Status

Your API keys are tied to your account plan. If your plan expires or is downgraded, your rate limits will automatically adjust.

API Key Validation

Every API request validates your key and checks your current plan status. Invalid or expired keys will receive a 401 Unauthorized response.

Plan Changes

When you upgrade or downgrade your plan, rate limits update immediately. No API key regeneration is required.

Multiple API Keys

You can create multiple API keys for different applications, but all keys share the same rate limits since limits are enforced per user account.

Key Rotation

Regularly rotate your API keys for security. Old keys can be revoked without affecting your rate limits or plan status.

Check API Key Status

1import requests
2
3response = requests.get(
4    "https://api.selamgpt.com/v1/models",
5    headers={"Authorization": "Bearer YOUR_API_KEY"}
6)
7
8if response.status_code == 401:
9    print("API key is invalid or expired")
10elif response.status_code == 200:
11    print("API key is valid")
12    print(f"Plan: {response.headers.get('X-Plan-Tier', 'Unknown')}")
13else:
14    print(f"Unexpected status: {response.status_code}")

Text Model Rate Limits

Rate limits for chat completions and text generation endpoints vary by account level:

Account LevelRequests/MinuteRequests/Day
FREE5100
BETA10500
PRO10Unlimited

Image Generation Rate Limits

Image generation has separate rate limits:

Account LevelImages/MinuteImages/Day
FREE00
BETA110
PRO350

Image Generation Access

Image generation is not available for FREE tier accounts. Upgrade to BETA or PRO to access image generation features.

Text-to-Speech Rate Limits

TTS endpoints have both request and audio duration limits:

Account LevelRequests/MinuteAudio Minutes/DayMax Characters/Request
FREE551,500
BETA15155,000
PRO304012,500

Audio Duration Calculation

TTS rate limits are based on audio duration, not just request count. Approximately 750 characters equals 1 minute of audio at normal speed (1.0x).

Voice Agent Access

Voice Agent WebSocket API is currently in private beta and requires special access. Contact our team for more information.

Limited Availability

Voice Agent API access is restricted and not available through standard account tiers. Please contact support for enterprise access.

Rate Limit Headers

All API responses include rate limit information in the headers:

Rate Limit Headers

1X-RateLimit-Limit: 60
2X-RateLimit-Remaining: 59
3X-RateLimit-Reset: 1640995200
4X-RateLimit-Reset-After: 60

X-RateLimit-Limit

The maximum number of requests allowed in the current time window.

X-RateLimit-Remaining

The number of requests remaining in the current time window.

X-RateLimit-Reset

Unix timestamp when the rate limit window resets.

X-RateLimit-Reset-After

Number of seconds until the rate limit resets.

Handling Rate Limits

When you exceed a rate limit, you'll receive a 429 error response:

Rate Limit Error

1{
2  "error": {
3    "message": "Rate limit exceeded. Try again in 60 seconds.",
4    "type": "rate_limit_error",
5    "code": "rate_limit_exceeded"
6  }
7}

Retry-After Header

Rate limit error responses include a Retry-After header indicating when you can retry:

1HTTP/1.1 429 Too Many Requests
2Retry-After: 60
3X-RateLimit-Reset-After: 60

Exponential Backoff

Implement exponential backoff to handle rate limits gracefully:

Exponential Backoff Example

1import time
2import requests
3
4def make_request_with_backoff(url, max_retries=5):
5    for attempt in range(max_retries):
6        response = requests.post(url, json=data, headers=headers)
7        
8        if response.status_code == 200:
9            return response.json()
10        
11        if response.status_code == 429:
12            retry_after = int(response.headers.get('Retry-After', 60))
13            wait_time = min(retry_after * (2 ** attempt), 300)  # Max 5 minutes
14            print(f"Rate limited. Waiting {wait_time} seconds...")
15            time.sleep(wait_time)
16            continue
17        
18        response.raise_for_status()
19    
20    raise Exception("Max retries exceeded")

Best Practices

📊 Monitor Rate Limit Headers

Always check rate limit headers in responses to track your usage and avoid hitting limits.

🔄 Implement Retry Logic

Use exponential backoff when retrying failed requests to avoid overwhelming the API.

âš¡ Batch Requests

Use the batch endpoint for multiple requests to reduce the number of API calls.

💾 Cache Responses

Cache API responses when appropriate to reduce redundant requests.

📈 Upgrade When Needed

If you consistently hit rate limits, consider upgrading your account for higher limits.

Need Higher Limits?

Contact our sales team if you need custom rate limits for enterprise use cases.

Was this page helpful?