Skip to main content
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: 1000
X-RateLimit-Remaining: 847
X-RateLimit-Reset: 1717257600 # Unix timestamp of reset (per-minute window)
X-Laghav-Request-Id: lgh_req_abc123
X-Laghav-Overhead-Ms: 18

Plan monthly call quotas

PlanCalls / monthAPI keysApplicationsTeam members
Sandbox (Free)10,00011None
Builder200,00032None
Scale2,000,000UnlimitedUnlimited✓ Unlimited
Business15,000,000UnlimitedUnlimited✓ Unlimited
EnterpriseUnlimitedUnlimitedUnlimited✓ 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:

PlanRequests / minute
Sandbox60
Builder500
Scale2,000
Business10,000
EnterpriseCustom

Handling 429 errors

retry.py
import time
from laghav.errors import RateLimitError
def 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 resets
wait = 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 typeCalls / dayReset
Anonymous (IP-based)10Midnight UTC
Email-verified50Midnight UTC
Free accountFull API quotaMonthly
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"
}