Skip to main content
The Claro API implements rate limiting to ensure fair usage and maintain service quality for all users. This guide explains how rate limits work and how to handle them in your application.

Rate Limit Tiers

Rate limits vary based on authentication status:
Enterprise customers can request higher rate limits. Contact support@baytos.ai for custom limits.

Rate Limit Headers

Every API response includes headers indicating your current rate limit status:

429 Too Many Requests

When you exceed the rate limit, the API returns a 429 Too Many Requests response:
The response includes:
  • Retry-After header: Seconds until you can retry
  • retry_after field: Same value in the JSON response body

Handling Rate Limits

Automatic Retry with SDK

The Python SDK automatically handles rate limits with exponential backoff:
The SDK will:
  1. Wait for the duration specified in Retry-After header
  2. Retry with exponential backoff (1s, 2s, 4s, …)
  3. Throw BaytRateLimitError if all retries are exhausted

Manual Retry Logic

If calling the API directly, implement retry logic:

Python Example

JavaScript Example

Best Practices

Always check X-RateLimit-Remaining to know when you’re approaching the limit:
Don’t retry immediately. Use exponential backoff to avoid hammering the API:
Instead of fetching prompts one at a time, use the list endpoint:
Cache prompt data to reduce API calls:
If processing many prompts, add delays between requests:
For production applications, implement server-side caching:

Rate Limit Response Example

Checking Headers Before Hitting Limit

Response:

When Rate Limited

Monitoring Rate Limit Usage

Track your rate limit usage in application logs:

Enterprise Rate Limits

Enterprise customers receive:
  • Higher default rate limits
  • Dedicated rate limit pools
  • Priority support for limit adjustments
  • Custom rate limit configurations per API key
Contact support@baytos.ai to discuss enterprise options.

Next Steps

Error Handling

Learn how to handle all API errors

Python SDK

Use the SDK with built-in retry logic

Best Practices

Optimize your API usage

Authentication

Learn about API authentication