| name | perplexity-cost-tuning |
| description | Optimize Perplexity costs through model routing, caching, token limits, and budget monitoring.
Use when analyzing Perplexity billing, reducing API costs,
or implementing budget alerts for Perplexity Sonar API.
Trigger with phrases like "perplexity cost", "perplexity billing",
"reduce perplexity costs", "perplexity pricing", "perplexity budget".
|
| allowed-tools | Read, Grep |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","perplexity","api","monitoring","cost-optimization"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Perplexity Cost Tuning
Overview
Reduce Perplexity Sonar API costs. Perplexity charges per-token (input + output) plus a per-request fee that varies by search context size. The biggest cost lever is model selection: sonar-pro costs 3-15x more than sonar per request.
Pricing Reference
| Model | Input $/M tokens | Output $/M tokens | Request Fee |
|---|
sonar | $1 | $1 | $5 per 1K requests |
sonar-pro | $3 | $15 | $5 per 1K requests |
sonar-reasoning-pro | $3 | $15 | $5 per 1K requests |
sonar-deep-research | $2 | $8 | $5 per 1K searches |
Search context size (Low/Medium/High) affects the request fee. More context = higher fee.
Prerequisites
- Perplexity API account with usage dashboard
- Understanding of query patterns in your application
- Cache infrastructure for search results
Instructions
Step 1: Route Queries to the Right Model
function selectModel(query: string): "sonar" | "sonar-pro" {
const simplePatterns = [
/^what is/i, /^define/i, /^who is/i, /^when did/i,
/current price/i, /^how many/i, /^is it true/i,
];
if (simplePatterns.some((p) => p.test(query))) return ;
complexPatterns = [
, , ,
, , ,
];
(complexPatterns.( p.(query))) ;
;
}