perplexity-hello-world

Featured

Create a minimal working Perplexity Sonar search example with citations. Use when starting a new Perplexity integration, testing your setup, or learning basic search-with-citations patterns. Trigger with phrases like "perplexity hello world", "perplexity example", "perplexity quick start", "simple perplexity search".

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 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-auth` setup - `openai` package installed - `PERPLEXITY_API_KEY` environment variable set ## Instructions ### Step 1: Basic Search with Citations (TypeScript) ```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....

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