Perplexity's Sonar API gives you LLM answers that are connected to live web search and return citations — the same engine behind Perplexity's answer engine. That makes it great for up-to-date Q&A and research apps, but it bills differently from a plain LLM: you pay for tokens and a per-request search fee. Here's the full picture and how to get your key.
| Model | Input $/1M | Output $/1M | Best for |
|---|---|---|---|
| Sonar cheapest | $1.00 | $1.00 | Fast cited answers |
| Sonar Pro | $3.00 | $15.00 | Deeper research, longer answers |
| Search request fee | ~$5.00 per 1,000 requests | Charged on top of tokens | |
→ Estimate the token side on the AI API cost calculator, then add your request count × the search fee.
There's no open free API tier, but Perplexity Pro subscribers get monthly API credits (around $5) to test with. For a genuinely free LLM quota, see Google Gemini or Mistral — though neither includes built-in web search like Sonar.
1. Sign in at perplexity.ai and open Settings → API.
2. Add a payment method (or use included Pro credits) to activate API access.
3. Click Generate API Key and copy it once.
4. The endpoint is OpenAI-style; point your OpenAI SDK at the Perplexity base URL.
Test it with a simple request:
The single most common surprise on a Perplexity bill is the per-request search charge. At ~$5 per 1,000 requests, an app doing 100,000 answer requests a month pays ~$500 in search fees before token cost. If you don't need live web data on every call, route generic questions to a cheaper plain LLM and reserve Sonar for queries that truly need fresh, cited information.
If you don't need built-in search, a plain LLM is far cheaper: Gemini Flash, DeepSeek or GPT-4o mini. To add your own search, pair one of those with a search API. For one key across many models, see OpenRouter.
Because each request can trigger a live web search billed separately (~$5 per 1,000 requests). For high request volumes the search fee, not tokens, dominates the bill.
No open free tier, but Pro subscribers receive monthly API credits to test with.
Open Settings → API at perplexity.ai, add billing or use Pro credits, generate a key and copy it once.
When answers must reflect current events or cite live sources. For static knowledge, a plain LLM is cheaper and faster.
Not affiliated with Perplexity. Prices are reference estimates — always verify on the official pricing page.