itechmeat/llm-code/perplexity
Claude Code and agent skill by itechmeat/llm-code
- community
Checking that the SKILL.md file is still in the repository.
Perplexity API for web-grounded AI and search. Covers Sonar models, chat/search APIs, streaming, structured outputs, filters, and attachments. Keywords: Perplexity, Sonar, search API, grounded LLM.
Install
npx vskill@latest install itechmeat/llm-code/perplexitySKILL.md
Perplexity API
Build AI applications with real-time web search and grounded responses.
Quick Navigation
- Models & pricing:
references/models.md - Search API patterns:
references/search-api.md - Chat completions guide:
references/chat-completions.md - Browser sessions API:
references/browser.md - Embeddings API:
references/embeddings.md - Structured outputs:
references/structured-outputs.md - Filters (domain/language/date/location):
references/filters.md - Media (images/videos/attachments):
references/media.md - Pro Search:
references/pro-search.md - Prompting best practices:
references/prompting.md
When to Use
- Need AI responses grounded in current web data
- Building search-powered applications
- Research tools requiring citations
- Real-time Q&A with source verification
- Document/image analysis with web context
Installation
Install: pip install perplexityai (Python) or npm install @perplexityai/perplexity (TypeScript/JavaScript).
Authentication
SDK auto-reads PERPLEXITY_API_KEY environment variable.
Quick Start — Chat Completion
Note (v0.28.0): The Python client includes a custom JSON encoder to support additional types in request payloads.
Quick Start — Search API
Release Highlights (0.34.1 -> 0.38.0)
- Streaming:
responses.createnow yields named SSE events and discriminates theResponseStreamEventunion, which matters for typed stream consumers. - Search context:
search_context_sizewas briefly exposed onsearch.create, removed in0.35.1, then reintroduced in0.37.0for both the Search API and theweb_searchtool to control retrieved context size. - Background responses: the SDK adds background-task support and
responses.retrieve, so long-running response workflows can be polled instead of only streamed inline. - Reasoning effort:
xhighis available where the API supports reasoning-effort controls. - Sandbox tool:
0.36.0adds the Responses API sandbox built-in tool;0.38.0adds afilessubresource for retrieving sandbox-produced files. Gate both like other executable/tooling surfaces.
Model Selection Guide
| Model | Use Case | Cost | |
|---|---|---|---|
sonar | Quick facts, simple Q&A | Lowest | |
sonar-pro | Complex queries, research | Medium | |
sonar-reasoning-pro | Multi-step reasoning, analysis | Medium | |
sonar-deep-research | Exhaustive research, reports | Highest |
Key Patterns
Streaming Responses
Multi-Turn Conversation
Web Search Options
Pro Search (Multi-Step Research)
Image Attachment
File Attachment (PDF Analysis)
Return Images in Response
Domain Filtering (Search API)
Multi-Query Search
Structured Outputs (JSON Schema)
Async Operations
Rate Limit Handling
Response Parameters
| Parameter | Default | Description | |
|---|---|---|---|
temperature | 0.7 | Creativity (0-2) | |
max_tokens | varies | Response length limit | |
top_p | 0.9 | Nucleus sampling | |
presence_penalty | 0 | Reduce repetition (-2 to 2) | |
frequency_penalty | 0 | Reduce word frequency (-2 to 2) |
Search API Parameters
| Parameter | Description | |
|---|---|---|
max_results | 1-20 results per query | |
max_tokens_per_page | Content extraction depth (default 2048) | |
country | ISO country code for regional results | |
search_domain_filter | Domain allowlist/denylist (max 20) | |
search_language_filter | ISO 639-1 language codes (max 10) |
Pricing Quick Reference
Search API: $5/1K requests (no token costs)
Sonar Models (per 1M tokens):
| Model | Input | Output | |
|---|---|---|---|
| sonar | $1 | $1 | |
| sonar-pro | $3 | $15 | |
| sonar-reasoning-pro | $2 | $8 |
Request fees (per 1K requests): $5-$14 depending on search context size.
Critical Prohibitions
- Do NOT request links/URLs in prompts (use
citationsfield instead — model will hallucinate URLs) - Do NOT use recursive JSON schemas (not supported)
- Do NOT use
dict[str, Any]in Pydantic models for structured outputs - Do NOT mix allowlist and denylist in
search_domain_filter - Do NOT exceed 5 queries in multi-query search
- Do NOT expect first request with new JSON schema to be fast (10-30s warmup)
- Do NOT use Pro Search without
stream=True(will fail) - Do NOT send images to
sonar-deep-research(not supported) - Do NOT include
data:prefix for file attachments base64 (only for images) - Do NOT try to control search via prompts (use API parameters instead)
Error Handling
OpenAI SDK Compatibility
Perplexity supports OpenAI Chat Completions format. Use OpenAI client by pointing to Perplexity endpoint.
Links
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationFailed, 48 of 100Degrading. 1 run. Evaluated 7 months ago.
Source
- SKILL.md in the repositoryCheckingskills/perplexity/SKILL.md
Popularity
- Repository stars
- 12
- 7-day trend score
- 13
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 31 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/itechmeat/llm-code/perplexity)