> For the complete documentation index, see [llms.txt](https://docs.layerlens.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layerlens.ai/more-in-this-section-9/rate-limiting.md).

# Rate Limiting

Rate limiting — recognize 429 responses, handle RateLimitError, inspect retry headers.

This guide covers how to handle rate limiting when using the Stratix Python SDK, including best practices for avoiding rate limits and properly handling rate limit errors.

## Identifying Rate Limit Errors

### Rate Limit HTTP Response

When you exceed rate limits, the API returns a `429 Too Many Requests` status:

```python
import layerlens
from layerlens import Stratix

try:
 client = Stratix()

 # Making too many requests quickly
 for i in range(100):
 evaluation = client.evaluations.create(
 model="gpt-4",
 benchmark="mmlu"
 )

except layerlens.RateLimitError as e:
 print(f"Rate limited: {e}")
 print(f"Status code: {e.status_code}") # 429
 print(f"Response headers: {dict(e.response.headers)}")
```

## See Also

* [Errors reference](/more-in-this-section-9/errors-1.md) — full exception hierarchy
* [Async patterns](/more-in-this-section-9/async-patterns.md) — concurrency-safe usage
