Return standard 429 Retry-After headers for polite backoff
Give SDKs, webhook workers, and mobile apps exact Retry-After seconds and structured quota errors when limits engage.
Configuring polite HTTP 429 rate-limit responses
- 01
Set accurate Retry-After seconds
Compute exact seconds until window capacity reopens rather than returning static guesswork.
- 02
Distinguish quota vs burst limits
Return distinct error codes for temporary RPM bursts versus exhausted monthly plan quotas.
- 03
Include reset epoch timestamps
Expose X-RateLimit-Reset alongside remaining quota headers for frontend progress bars.
- 04
Verify retry helper integration
Test client retry libraries against throttled sandbox keys to confirm clean exponential pause.
Common questions
Why return Retry-After instead of a generic 500 or bare 429?
Standard Retry-After headers let worker queues and SDKs pause the exact required duration instead of hammering your endpoint blindly.
Can we customize the 429 JSON body format?
Yes. Define custom error JSON templates including support links, current tier names, and upgrade URLs.
Does a blocked 429 request consume any model tokens?
Zero tokens—rate-limit checks run at the edge gateway before any prompt formatting or model call.
Related tasks in this category
See all in Response Caching & Rate Limiting-
Cache identical AI responses at the edge for instant hits
Serve repeated identical prompts in under 20 milliseconds while slashing token expenses to zero for deterministic endpoints.
-
Cut LLM costs with semantic similarity response caching
Match paraphrased user questions like 'reset password' and 'forgot login' using vector similarity thresholds to reuse verified answers.
-
Protect AI endpoints with sliding-window rate limits
Prevent traffic bursts and abusive scrapers from draining token budgets with smooth per-IP, per-key, and per-user sliding limits.
-
Throttle AI endpoints automatically by customer plan tier
Give free users 10 daily runs, Pro teams 120 RPM, and Enterprise workspaces custom headroom without coding metering middleware.
-
Manage cache TTLs and purge stale AI outputs instantly
Set smart time-to-live schedules and invalidate tagged cache entries via webhook the second underlying product docs or pricing change.
-
Stop infinite client retry loops from draining AI spend
Detect bugged client loops, runaway webhooks, and daily spend velocity anomalies at the gateway before they rack up huge bills.