perplexity-hello-world
Create a minimal working Perplexity example. Use when starting a new Perplexity integration, testing your setup, or learning basic Perplexity API patterns. Trigger with phrases like "perplexity hello world", "perplexity example", "perplexity quick start", "simple perplexity code".
Install
mkdir -p .claude/skills/perplexity-hello-world && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5379" && unzip -o skill.zip -d .claude/skills/perplexity-hello-world && rm skill.zipInstalls to .claude/skills/perplexity-hello-world
About this skill
Perplexity Hello World
Overview
Minimal working example demonstrating Perplexity's core value: web-grounded answers with citations. Unlike standard LLMs, Perplexity searches the web for every query and returns cited sources.
Prerequisites
- Completed
perplexity-install-authsetup openaipackage installedPERPLEXITY_API_KEYenvironment variable set
Instructions
Step 1: Basic Search with Citations (TypeScript)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.PERPLEXITY_API_KEY,
baseURL: "https://api.perplexity.ai",
});
async function main() {
const response = await client.chat.completions.create({
model: "sonar",
messages: [
{
role: "system",
content: "Be precise and cite your sources.",
},
{
role: "user",
content: "What are the latest features in Node.js 22?",
},
],
});
const answer = response.choices[0].message.content;
console.log("Answer:", answer);
// Citations are returned as a top-level array on the response
const citations = (response as any).citations || [];
console.log("\nSources:");
citations.forEach((url: string, i: number) => {
console.log(` [${i + 1}] ${url}`);
});
// Usage breakdown
console.log("\nUsage:", {
prompt_tokens: response.usage?.prompt_tokens,
completion_tokens: response.usage?.completion_tokens,
total_tokens: response.usage?.total_tokens,
});
}
main().catch(console.error);
Step 2: Basic Search with Citations (Python)
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PERPLEXITY_API_KEY"],
base_url="https://api.perplexity.ai",
)
response = client.chat.completions.create(
model="sonar",
messages=[
{"role": "system", "content": "Be precise and cite your sources."},
{"role": "user", "content": "What are the latest features in Node.js 22?"},
],
)
answer = response.choices[0].message.content
print("Answer:", answer)
# Citations from the raw response
raw = response.model_dump()
citations = raw.get("citations", [])
print("\nSources:")
for i, url in enumerate(citations, 1):
print(f" [{i}] {url}")
print(f"\nTokens: {response.usage.total_tokens}")
Step 3: Search with Domain Filter
// Restrict search to specific domains
const response = await client.chat.completions.create({
model: "sonar",
messages: [
{ role: "user", content: "What is the latest Python release?" },
],
// Perplexity-specific parameters (pass as extra body)
search_domain_filter: ["python.org", "docs.python.org"],
search_recency_filter: "month",
} as any);
Step 4: Streaming Search
const stream = await client.chat.completions.create({
model: "sonar",
messages: [
{ role: "user", content: "Explain quantum computing breakthroughs in 2025" },
],
stream: true,
});
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content || "";
process.stdout.write(text);
// Citations arrive in the final chunk
if ((chunk as any).citations) {
console.log("\n\nSources:", (chunk as any).citations);
}
}
Output
- Working search query returning a web-grounded answer
- Parsed citation URLs from the response
- Token usage stats confirming billing
Error Handling
| Error | Cause | Solution |
|---|---|---|
401 Unauthorized | Invalid API key | Verify key at perplexity.ai/settings/api |
| Empty citations array | Query too abstract | Ask a specific, factual question |
429 Too Many Requests | Rate limit exceeded | Wait and retry with backoff |
| Timeout | Complex search query | Use sonar instead of sonar-pro |
Resources
Next Steps
Proceed to perplexity-local-dev-loop for development workflow setup.
More by jeremylongshore
View all skills by jeremylongshore →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversBoost your AI code assistant with Context7: inject real-time API documentation from OpenAPI specification sources into y
Learn how to create a server in Minecraft efficiently. Use npx tool to scaffold an MCP server with templates and best pr
Connect Blender to Claude AI for seamless 3D modeling. Use AI 3D model generator tools for faster, intuitive, interactiv
Unlock seamless Figma to code: streamline Figma to HTML with Framelink MCP Server for fast, accurate design-to-code work
Supercharge your AI code assistant with GitMCP—get accurate, up-to-date code and API docs from any GitHub project. Free,
By Sentry. MCP server and CLI that provides tools for AI agents working on iOS and macOS Xcode projects. Build, test, li
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.