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,266 stars 315 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
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

perplexity-performance-tuning

Optimize Perplexity Sonar API performance with caching, streaming, model routing, and batching. Use when experiencing slow API responses, implementing caching strategies, or optimizing request throughput for Perplexity integrations. Trigger with phrases like "perplexity performance", "optimize perplexity", "perplexity latency", "perplexity caching", "perplexity slow".

2,266 Updated today
jeremylongshore
AI & Automation Featured

perplexity-observability

Set up monitoring for Perplexity Sonar API with latency, cost, citation quality, and error tracking. Use when implementing monitoring dashboards, setting up alerts, or tracking Perplexity API health in production. Trigger with phrases like "perplexity monitoring", "perplexity metrics", "perplexity observability", "monitor perplexity", "perplexity dashboard".

2,266 Updated today
jeremylongshore
AI & Automation Featured

perplexity-architecture-variants

Choose and implement Perplexity architecture blueprints for different scales: direct search widget, cached research layer, and multi-query pipeline. Trigger with phrases like "perplexity architecture", "perplexity blueprint", "how to structure perplexity", "perplexity project layout".

2,266 Updated today
jeremylongshore
AI & Automation Featured

perplexity-reference-architecture

Implement Perplexity reference architecture with model routing, citation pipeline, and research automation. Use when designing new Perplexity integrations, reviewing project structure, or establishing architecture for search-augmented apps. Trigger with phrases like "perplexity architecture", "perplexity project structure", "how to organize perplexity", "perplexity design patterns".

2,266 Updated today
jeremylongshore
AI & Automation Featured

perplexity-reliability-patterns

Implement reliability patterns for Perplexity Sonar API: circuit breaker, model fallback, streaming timeout, and citation validation. Trigger with phrases like "perplexity reliability", "perplexity circuit breaker", "perplexity fallback", "perplexity resilience", "perplexity timeout".

2,266 Updated today
jeremylongshore