⚡ Rate Limits & Usage
📊 Plan Limits
| Plan | Requests/Min | Requests/Day | Requests/Month |
|---|---|---|---|
| Free | 5 | 100 | 1,000 |
| Starter | 60 | 1,000 | 10,000 |
| Growth | 200 | 3,000 | 30,000 |
| Business | 500 | 10,000 | 100,000 |
| Enterprise | Custom | Custom | Custom |
📝 Character Limits
| Plan | Characters per Call |
|---|---|
| Free | 1,000 |
| Starter | Unlimited |
| Growth | Unlimited |
| Business | Unlimited |
| Enterprise | Unlimited |
📡 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 | Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed in current window |
X-RateLimit-Remaining | Requests remaining in current window |
X-RateLimit-Reset | Window reset timestamp (Unix) |
X-RateLimit-Used | Requests 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:
- Review your current usage patterns
- Consider upgrading your plan
- 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
- Email: sentor@nikx.one
- Discord: Join our community