| name | perplexity-rate-limits |
| description | Implement Perplexity rate limiting, backoff, and request queuing.
Use when handling 429 errors, implementing retry logic,
or optimizing API request throughput for Perplexity Sonar.
Trigger with phrases like "perplexity rate limit", "perplexity throttling",
"perplexity 429", "perplexity retry", "perplexity backoff".
|
| allowed-tools | Read, Write, Edit |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","perplexity","api"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Perplexity Rate Limits
Overview
Handle Perplexity Sonar API rate limits. Perplexity uses a leaky bucket algorithm: burst capacity is available, with tokens refilling continuously at your assigned rate. Rate limits are based on requests per minute (RPM).
Rate Limit Tiers
| Tier | RPM | Notes |
|---|
| Free / Starter | 50 | Default for new API keys |
| Search API | ~3 req/sec | Per-endpoint limit |
| Higher tiers | Contact sales | Custom limits available |
Rate limits apply per API key, not per model. Using sonar-pro counts against the same RPM as sonar.
Prerequisites
PERPLEXITY_API_KEY set
- Understanding of HTTP 429 responses
Instructions
Step 1: Exponential Backoff with Jitter
async function withExponentialBackoff<T>(
operation: () => Promise<T>,
config = { maxRetries: 5, baseDelayMs: 1000, maxDelayMs: 30000, jitterMs: 500 }
): Promise<T> {
for (let attempt = 0; attempt <= config.maxRetries; attempt++) {
try {
return await operation();
} catch (error: any) {
if (attempt === config.maxRetries) throw error;
const status = error. || error.?.;
(status && status !== && status < ) error;
exponentialDelay = config. * .(, attempt);
jitter = .() * config.;
delay = .(exponentialDelay + jitter, config.);
.();
( (r, delay));
}
}
();
}
result = (
perplexity...({
: ,
: [{ : , : }],
})
);