Automated summary
Provides TypeScript patterns for handling Perplexity API rate limits: exponential backoff with jitter, idempotency keys, request queuing, and quota-header monitoring.
Strengths
- Demonstrates exponential backoff with jitter to prevent thundering-herd retries
- Clearly separates retryable errors (429, 5xx) from permanent failures
- Includes a concurrency-limited p-queue wrapper and an X-RateLimit header monitor
- Ships a ready-to-use header-to-action mapping table
Limitations
- TypeScript only, with no Python or other-language examples
- Assumes Perplexity actually honors the Idempotency-Key header, which is not evidenced
- The per-tier quota numbers (Free/Pro/Enterprise) are illustrative and should be checked against official docs
- The file cuts off mid-way through the RateLimitMonitor class, leaving that example incomplete
Use it when integrating the Perplexity API and you need calls that survive 429 errors and traffic spikes.
Skip it if you want a drop-in retry library or examples in a language other than TypeScript.
Security analysis
SafeThe skill contains educational guidance and TypeScript examples for rate limiting, backoff, idempotency, and queueing. It does not instruct destructive actions, secret exfiltration, obfuscated execution, or disabling safety mechanisms. Declared tools are limited to Read, Write, and Edit, with no bash or network execution.
No concerns found
How this analysis is madeExamples
My Perplexity API calls keep failing with 429 errors during batch runs. Add exponential backoff with jitter and only retry on 429 and 5xx, using TypeScript.I want to make my Perplexity search requests idempotent so retries don't create duplicate charges. Show me how to generate deterministic idempotency keys.Set up a queue-based rate limiter for my Perplexity client so I stay under 10 requests per second with concurrency of 5, and monitor the X-RateLimit-Remaining header.name: perplexity-rate-limits description: | Implement Perplexity rate limiting, backoff, and idempotency patterns. Use when handling rate limit errors, implementing retry logic, or optimizing API request throughput for Perplexity. Trigger with phrases like "perplexity rate limit", "perplexity throttling", "perplexity 429", "perplexity retry", "perplexity backoff". allowed-tools: Read, Write, Edit version: 1.0.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io
Perplexity Rate Limits
Overview
Handle Perplexity rate limits gracefully with exponential backoff and idempotency.
Prerequisites
- Perplexity SDK installed
- Understanding of async/await patterns
- Access to rate limit headers
Instructions
Step 1: Understand Rate Limit Tiers
| Tier | Requests/min | Requests/day | Burst | |------|-------------|--------------|-------| | Free | 60 | 1,000 | 10 | | Pro | 300 | 10,000 | 50 | | Enterprise | 1,000 | 100,000 | 200 |
Step 2: Implement Exponential Backoff with Jitter
async function withExponentialBackoff<T>(
operation: () => Promise<T>,
config = { maxRetries: 5, baseDelayMs: 1000, maxDelayMs: 32000, 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.status || error.response?.status;
if (status !== 429 && (status < 500 || status >= 600)) throw error;
// Exponential delay with jitter to prevent thundering herd
const exponentialDelay = config.baseDelayMs * Math.pow(2, attempt);
const jitter = Math.random() * config.jitterMs;
const delay = Math.min(exponentialDelay + jitter, config.maxDelayMs);
console.log(`Rate limited. Retrying in ${delay.toFixed(0)}ms...`);
await new Promise(r => setTimeout(r, delay));
}
}
throw new Error('Unreachable');
}
Step 3: Add Idempotency Keys
import { v4 as uuidv4 } from 'uuid';
import crypto from 'crypto';
// Generate deterministic key from operation params (for safe retries)
function generateIdempotencyKey(operation: string, params: Record<string, any>): string {
const data = JSON.stringify({ operation, params });
return crypto.createHash('sha256').update(data).digest('hex');
}
async function idempotentRequest<T>(
client: PerplexityClient,
params: Record<string, any>,
idempotencyKey?: string // Pass existing key for retries
): Promise<T> {
// Use provided key (for retries) or generate deterministic key from params
const key = idempotencyKey || generateIdempotencyKey(params.method || 'POST', params);
return client.request({
...params,
headers: { 'Idempotency-Key': key, ...params.headers },
});
}
Output
- Reliable API calls with automatic retry
- Idempotent requests preventing duplicates
- Rate limit headers properly handled
Error Handling
| Header | Description | Action | |--------|-------------|--------| | X-RateLimit-Limit | Max requests | Monitor usage | | X-RateLimit-Remaining | Remaining requests | Throttle if low | | X-RateLimit-Reset | Reset timestamp | Wait until reset | | Retry-After | Seconds to wait | Honor this value |
Examples
Queue-Based Rate Limiting
import PQueue from 'p-queue';
const queue = new PQueue({
concurrency: 5,
interval: 1000,
intervalCap: 10,
});
async function queuedRequest<T>(operation: () => Promise<T>): Promise<T> {
return queue.add(operation);
}
Monitor Rate Limit Usage
class RateLimitMonitor {
private remaining: number = 60;
private resetAt: Date = new Date();
updateFromHeaders(headers: Headers) {
this.remaining = parseInt(headers.get('X-RateLimit-Remaining') || '60');
const resetTimestamp = headers.get('X-RateLimit-Reset');
if (resetTimestamp) {
this.resetAt = new Date(parseInt(resetTimestamp) * 1000);
}
}
shouldThrottle(): boolean {
// Only throttle if low remaining AND reset hasn't happened yet
return this.remaining < 5 && new Date() < this.resetAt;
}
getWaitTime(): number {
return Math.max(0, this.resetAt.getTime() - Date.now());
}
}
Resources
Next Steps
For security configuration, see perplexity-security-basics.
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/perplexity-rate-limits-msh3usqp/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/perplexity-rate-limits-msh3usqp' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/perplexity-rate-limits-msh3usqp/download' --output '.skill-downloads/perplexity-rate-limits-msh3usqp/SKILL.md.part' && mv '.skill-downloads/perplexity-rate-limits-msh3usqp/SKILL.md.part' '.skill-downloads/perplexity-rate-limits-msh3usqp/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Read, Write, Edit
Original excerpt: Prerequisites
- Perplexity SDK installed
- Understanding of async/await patterns
- Access to rate limit headers
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/perplexity-rate-limits-msh3usqp/SKILL.md' && test -s '.skill-downloads/perplexity-rate-limits-msh3usqp/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/perplexity-rate-limits' && cp -R '.skill-downloads/perplexity-rate-limits-msh3usqp' '.claude/skills/perplexity-rate-limits'Cursor
test -f '.skill-downloads/perplexity-rate-limits-msh3usqp/SKILL.md' && test -s '.skill-downloads/perplexity-rate-limits-msh3usqp/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/perplexity-rate-limits' && cp -R '.skill-downloads/perplexity-rate-limits-msh3usqp' '.cursor/skills/perplexity-rate-limits'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/perplexity-rate-limits-msh3usqp'openskills read 'perplexity-rate-limits-msh3usqp'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/perplexity-rate-limits-msh3usqp/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.