--- title: "Perplexity API guide (2026): keys, models, pricing and limits" category: "guides" url: https://keirolabs.cloud/blog/perplexity-api-guide-2026 --- ## The 60-second version The Perplexity API gives your code the thing Perplexity is known for: web search plus a written, cited answer. In October 2026 it is really three products under one key, and most guides online still describe the 2025 version. - **Sonar models** return a finished answer with citations. Sonar is $1 per million tokens in and out plus a request fee of $5, $8 or $12 per 1,000 requests by search context size. A short answer costs about $0.007. - **The Agent API** is where Sonar now lives. Since September 27, 2026, Sonar runs as presets of the Agent API, which can also host other models and call tools like `web_search` and `fetch_url`. - **The Search API** returns raw results with no answer: a flat $5 per 1,000 requests and no token charges. **To start: create an API key in your Perplexity account's API settings, add a payment method, and call the OpenAI-compatible chat completions endpoint with `model: "sonar"`.** Synchronous Sonar requests still work there, and the code below is ten lines. ## What is the Perplexity API? **The Perplexity API is Perplexity's search-and-answer engine exposed to developers: you send a question, it searches the live web and returns an answer with the sources it used.** It is the same retrieval loop that powers Perplexity's consumer product, packaged for your application. That makes it different from a plain LLM API. A model API answers from its training data; Perplexity searches first, so answers include today's information and links. And it is different from a plain search API, which returns links and leaves the writing to you. Perplexity does both steps, and bills for both. On the [Artificial Analysis Search Index](https://artificialanalysis.ai/agents/search-api) for September 2026, Perplexity Search scored 80, the top score on the displayed board ([our comparison](/blog/web-search-apis-for-agents-2026)). Part of what you pay for is a genuinely strong retrieval and synthesis loop. ## How do you get a Perplexity API key? 1. **Sign in** to your Perplexity account and open the **API** section of your account settings. 2. **Add a payment method** or buy credits. The API is pay as you go; the consumer Pro subscription is a separate product. 3. **Generate an API key** and copy it. It starts with `pplx-`. 4. **Store it as an environment variable**, for example `PERPLEXITY_API_KEY`. Never put it in client-side code. Your rate limit depends on your usage tier, which rises with lifetime spend (more on that below). A new key starts at the lowest tier. ## How do you make your first request? **The Sonar chat completions endpoint is OpenAI-compatible, so the OpenAI SDK works by changing the base URL.** Synchronous and streaming Sonar requests still work after September 27; Perplexity now runs them as Agent API requests behind the scenes ([migration guide](https://docs.perplexity.ai/docs/agent-api/migrate-from-sonar/overview)). ```python from openai import OpenAI import os client = OpenAI(api_key=os.environ["PERPLEXITY_API_KEY"], base_url="https://api.perplexity.ai") resp = client.chat.completions.create( model="sonar", # or "sonar-pro" for harder questions messages=[{"role": "user", "content": "What changed in the Perplexity API in 2026?"}], ) print(resp.choices[0].message.content) print(getattr(resp, "citations", None)) # the URLs the answer used ``` Or with cURL: ```bash curl https://api.perplexity.ai/chat/completions \ -H "Authorization: Bearer $PERPLEXITY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "sonar", "messages": [{"role": "user", "content": "Latest Tavily pricing?"}]}' ``` **Show the citations to your users.** The answer is only as trustworthy as the sources it lists, and the citations are what make a Perplexity answer checkable. ## Which Perplexity model should you use? | Model | Use it for | Input / output per million tokens | Request fee per 1,000 (low / medium / high context) | |---|---|---|---| | **Sonar** | Quick factual answers, high volume | $1 / $1 | $5 / $8 / $12 | | **Sonar Pro** | Harder, multi-part questions, more sources | $3 / $15 | $6 / $10 / $14 | | **Sonar Reasoning Pro** | Questions that need step-by-step reasoning | $2 / $8, plus $3 per million reasoning tokens | $6 / $10 / $14 | | **Sonar Deep Research** | Long research reports | $2 / $8, plus reasoning and citation tokens | none; $5 per 1,000 search queries | Rates from Perplexity's [models documentation](https://docs.perplexity.ai/docs/agent-api/models), checked October 12, 2026. **Start with Sonar.** Move to Sonar Pro only when Sonar's answers miss things, because Pro's $15-per-million output rate makes long answers expensive. Plain `sonar-reasoning` is no longer in the lineup; use Sonar Reasoning Pro. The search context size (low, medium, high) controls how much retrieved content the model sees. Low is the default and the cheapest; raise it only for questions that need many sources. ## How much does the Perplexity API cost per answer? **The request fee is most of the bill on short answers: a typical Sonar answer is about $0.007, of which $0.005 is the fee and $0.002 is tokens.** Worked examples at published rates: | Answer | Fee | Tokens | Total | |---|---|---|---| | Sonar, low context, 1,500 in / 500 out | $0.005 | $0.002 | **about $0.007** | | Sonar Pro, medium context, 3,000 in / 1,000 out | $0.010 | $0.024 | **about $0.034** | | Sonar Reasoning Pro, low context, with 20,000 reasoning tokens | $0.006 | about $0.076 | **about $0.08** | | Sonar Deep Research run, 10 searches | none | about $0.18 + $0.05 searches | **about $0.22** | At a million answers a month, Sonar at low context is about $7,000. The full rate card, with the stale numbers still circulating online, is in our [Perplexity Sonar API pricing breakdown](/blog/perplexity-sonar-api-pricing-2026). ## What is the Agent API? **The Agent API is Perplexity's newer, broader endpoint: you pick a model and a preset, and the agent can call tools during the request.** Since September 27, 2026 it is the recommended home for Sonar, and the presets map directly: Sonar and Sonar Pro map to `fast`, Sonar Reasoning Pro to `low`, Sonar Deep Research to `high` ([migration guide](https://docs.perplexity.ai/docs/agent-api/migrate-from-sonar/overview)). Two things are new. **You can run other providers' models** through it, billed at each provider's list price. **And tools are metered per call:** `web_search` costs $2.50 per 1,000 invocations, or $1.00 per 1,000 with the fast search type ([web_search docs](https://docs.perplexity.ai/docs/agent-api/tools/web-search)). An agent that searches three times per turn adds those fees to every turn. What ended: **asynchronous Sonar requests.** If your code used fire-and-forget async calls with a callback, move them to the Agent API's background mode. ## What is the Search API? **The Search API is Perplexity's retrieval layer on its own: ranked web results, no written answer, $5 per 1,000 requests and no token charges.** Up to five queries in one request bill as a single request, and failed or rate-limited requests are not billed. Use it when your own model writes the answer, or when you need sources rather than prose. It replaces the search half of Sonar at roughly the price of Sonar's lowest request fee, without the synthesis. ## What are the Perplexity API rate limits? **The Agent API's limit depends on your usage tier, from 1 query per second at tier 0 up to 33 at tiers 4 and 5.** Tiers advance with lifetime API spend and never go down ([rate limits](https://docs.perplexity.ai/docs/admin/rate-limits-usage-tiers)). | Tier | Agent API queries per second | |---|---| | 0 | 1 | | 1 | 3 | | 2 | 8 | | 3 | 17 | | 4 and 5 | 33 | The Search API ignores tiers: a flat 50 query units per second with a 50-unit burst. A five-query request bills as one request but uses five units of rate limit, so size your concurrency on units, not on the invoice. ## What are the best Perplexity API alternatives? If you want a cited answer for less, or a different shape of result: | Alternative | What you get | Price | |---|---|---| | **Keirolabs `/answer`** | Search plus a cited answer | about $0.012 per answer (Essential), $0.004 (Startup) | | **Keirolabs search + extract** | Results and page content; your model writes | about $0.0025 per page (Startup) | | **Parallel Search** | Dense excerpts, no answer | $1 per 1,000 (Turbo, Fast) | | **Brave Search API** | Independent index results; Answers plan available | $5 per 1,000; Answers $4 per 1,000 + tokens | | **Exa** | Semantic search and page contents | $7 per 1,000 searches | | **Tavily** | Search tuned for RAG | $8 per 1,000 basic, pay as you go | Sources: [Keirolabs pricing](https://keirolabs.cloud/pricing), [our Brave breakdown](/blog/brave-search-api-pricing-2026), [Exa](/blog/exa-api-pricing-2026), [Tavily](/blog/tavily-search-api-pricing-per-1000-requests-2026). Disclosure: Keirolabs is ours. **Pick Perplexity when answer quality and one invoice matter most; build from search plus extraction when cost and control matter more.** At low volume the difference is small. At a million answers a month, Sonar at about $7,000 against a search-plus-extract pipeline at about $2,500 is a real line item. ## Common mistakes - **Quoting old prices.** Sonar Pro's request fee is **$6, $10 and $14** per 1,000 by context size. The $5/$8/$12 ladder belongs to plain Sonar; pages that apply it to Pro are out of date. - **Calling retired models.** `sonar-reasoning` and the old Sonar Small, Large and Huge names are gone. - **Forgetting tool fees.** On the Agent API, every `web_search` call is billed on top of tokens. - **Raising context size by default.** High context nearly doubles the request fee on short answers. Keep low unless answers are missing sources.