perplexity-cost-tuning

Featured

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".

AI & Automation 2,940 stars 439 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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 ```typescript // 60-70% of queries can use sonar, saving 3-15x per query 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 "sonar"; const complexPatterns = [ /compare.*vs/i, /analysis of/i, /comprehensive/i, /pros and cons/i, /in-depth/i, /research/i, ]; if (complexPatterns.some((p) => p.test(query))) return "sonar-pro"; return ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category