Documentation
API Reference
Rate Limits
Every Laghav response includes rate limit headers. Monthly call quotas are enforced by plan. Exceeding them returns a 429 with a machine-readable code.
Rate limit response headers
Included on every /v1/complete response:
bash
X-RateLimit-Limit: 1000X-RateLimit-Remaining: 847X-RateLimit-Reset: 1717257600 # Unix timestamp of reset (per-minute window)X-Laghav-Request-Id: lgh_req_abc123X-Laghav-Overhead-Ms: 18
Plan monthly call quotas
| Plan | Calls / month | API keys | Applications | Team members |
|---|---|---|---|---|
| Sandbox (Free) | 10,000 | 1 | 1 | None |
| Builder | 200,000 | 3 | 2 | None |
| Scale | 2,000,000 | Unlimited | Unlimited | ✓ Unlimited |
| Business | 15,000,000 | Unlimited | Unlimited | ✓ Unlimited |
| Enterprise | Unlimited | Unlimited | Unlimited | ✓ Unlimited |
⚠Upgrade triggers
When you hit 80% of your monthly limit, Laghav sends an email alert (N05). At 100%, calls return
429 MONTHLY_LIMIT_REACHED. Upgrade to restore access immediately — no waiting for the billing cycle.Per-minute rate limits
In addition to monthly quotas, per-minute limits prevent burst abuse:
| Plan | Requests / minute |
|---|---|
| Sandbox | 60 |
| Builder | 500 |
| Scale | 2,000 |
| Business | 10,000 |
| Enterprise | Custom |
Handling 429 errors
retry.py
import timefrom laghav.errors import RateLimitErrordef call_with_retry(client, messages, max_retries=3):for attempt in range(max_retries):try:return client.complete(messages=messages, model="auto")except RateLimitError as e:if attempt == max_retries - 1:raise# e.retry_after is seconds until rate limit resetswait = e.retry_after or (2 ** attempt)print(f"Rate limited. Waiting {wait}s...")time.sleep(wait)response = call_with_retry(client, messages)
Playground rate limits
The /v1/playground endpoint (no auth required) has separate limits:
| User type | Calls / day | Reset |
|---|---|---|
| Anonymous (IP-based) | 10 | Midnight UTC |
| Email-verified | 50 | Midnight UTC |
| Free account | Full API quota | Monthly |
429-response.json
{error: "Daily playground limit reached",code: "PLAYGROUND_LIMIT_EXCEEDED",calls_used: 10,reset_at: "2025-06-02T00:00:00Z",upgrade_url: "https://laghav.ai/signup",message: "Create a free account for 50 compressions/day"}