Docs

⚡ Rate Limits & Usage

📊 Plan Limits

PlanRequests/MinRequests/DayRequests/Month
Free51001,000
Starter601,00010,000
Growth2003,00030,000
Business50010,000100,000
EnterpriseCustomCustomCustom

📝 Character Limits

PlanCharacters per Call
Free1,000
StarterUnlimited
GrowthUnlimited
BusinessUnlimited
EnterpriseUnlimited

📡 Rate Limit Headers

Every API response includes rate limit information:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1740356100
X-RateLimit-Used: 1
HeaderDescription
X-RateLimit-LimitMaximum requests allowed in current window
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetWindow reset timestamp (Unix)
X-RateLimit-UsedRequests used in current window

⚠️ Rate Limit Exceeded

When you exceed the rate limit, you’ll receive a 429 response:

{
    "error": {
        "code": "rate_limit_exceeded",
        "message": "Rate limit exceeded",
        "status": 429,
        "details": {
            "limit": 60,
            "remaining": 0,
            "reset": 1740356100,
            "retry_after": 30
        },
        "documentation_url": "https://sentor.app/docs/api/rate-limits"
    }
}

💡 Best Practices

1. 🔄 Implement Exponential Backoff

import time
import random

def exponential_backoff(retry_count, base_delay=1):
    delay = min(300, (2 ** retry_count) + random.uniform(0, 1))
    time.sleep(delay)

2. 📊 Monitor Your Usage

def check_rate_limits(response):
    remaining = int(response.headers.get('X-RateLimit-Remaining', 0))
    if remaining < 10:
        logger.warning(f"Rate limit running low: {remaining} requests remaining")

3. 📦 Use Batch Processing

def batch_process(texts, batch_size=10):
    """Process texts in batches to optimize rate limits."""
    for i in range(0, len(texts), batch_size):
        batch = texts[i:i + batch_size]
        yield batch

4. 💾 Implement Caching

from functools import lru_cache
import time

@lru_cache(maxsize=1000)
def cached_sentiment_analysis(text):
    """Cache sentiment analysis results for 1 hour."""
    return client.analyze(text)

📱 Usage Dashboard

Monitor your API usage in real-time at dashboard.sentor.app/settings

🔔 Usage Notifications

Set up alerts to monitor your usage:

  • Email notifications at 80% quota
  • Slack notifications for rate limit events
  • WebHook integration for automated monitoring

📈 Plan Management

If you’re frequently hitting rate limits:

  1. Review your current usage patterns
  2. Consider upgrading your plan
  3. Contact us for custom enterprise solutions

🛠️ Implementation Examples

Python

from sentor import Client
import time

client = Client(api_key)

def make_request_with_retry(text, max_retries=3):
    for attempt in range(max_retries):
        try:
            return client.analyze(text)
        except RateLimitError as e:
            if attempt == max_retries - 1:
                raise
            time.sleep(e.retry_after)

JavaScript

const { SentorClient } = require('@sentor/sdk');

const client = new SentorClient(apiKey);

async function makeRequestWithRetry(text, maxRetries = 3) {
    for (let attempt = 0; attempt < maxRetries; attempt++) {
        try {
            return await client.analyze(text);
        } catch (error) {
            if (error.code === 'rate_limit_exceeded' && attempt < maxRetries - 1) {
                await new Promise(resolve => setTimeout(resolve, error.retryAfter * 1000));
                continue;
            }
            throw error;
        }
    }
}

🔗 Related Resources

💬 Support