
What Is the Perplexity AI API?
Carlos GarciaPublished What Is the Perplexity AI API?
The Perplexity API is how you get Perplexity's answer engine into your own software: a question goes in, and a written answer comes back with the web sources it was built from.
If you looked at it a year ago, almost everything about it has changed. The product you probably read about was called Sonar, and Sonar Chat Completions support ended on 27 September 2026.
What replaced it is the Agent API, and it is a bigger thing than Sonar was. It runs other vendors' models alongside Perplexity's own, and it does more than one step per request.
This guide covers what the API is now, what broke in the move, and whether it is the right tool for what you are building.
What Is the Short Answer?
The Perplexity AI API is a hosted search-and-reasoning API. You send a prompt, the service searches the live web, reads what it finds, and returns an answer with citations.
Today that means the Agent API, at POST https://api.perplexity.ai/v1/agent. It became generally available in February 2026 and /v1/agent became the canonical endpoint that March, with /v1/responses kept as an alias.
The official SDKs expose it as client.responses.create, and it is built to the Open Responses standard, so the request shape will look familiar if you have used that pattern elsewhere.
The old Sonar endpoint still exists at POST https://api.perplexity.ai/v1/sonar, but it is legacy. New work should target the Agent API.
Not sure which of your pages are actually bringing people in? Start with a free SEO audit and get a clear picture.
Free audit
Where do you stand in AI search?
A manual SEO + AI search audit of your site: how ChatGPT, Gemini, Perplexity and Claude read and cite it today, and what to fix first. Report within 48 hours, no credit card.
Get my free auditOr have it all done: AI SEO services, $999 once
What Changed, and Why Your Old Code Broke
This is the part that catches people. The migration is not a version bump — the request and response shapes are different.
What Sonar looked like
Sonar was a chat-completions API. You sent a messages array and read the answer out of choices, which is the pattern most AI APIs settled on.
You also picked a model by name to choose how hard it worked: Sonar, Sonar Pro, Sonar Reasoning Pro, or Sonar Deep Research.
What the Agent API looks like
The Agent API takes an input instead of messages, and returns a typed output array with one item per step the agent took.
That array contains message items and search_results items, so you can see what the agent searched for as well as what it concluded. There is also an output_text convenience field if you just want the prose.
Instead of choosing a model to control depth, you set effort. That parameter was called preset until October 2026, when it was renamed; preset survives as a deprecated alias.
The mapping from the old Sonar models is published:
- Sonar maps to
fast - Sonar Pro maps to
fast - Sonar Reasoning Pro maps to
low - Sonar Deep Research maps to
high
For the deepest research work, Perplexity recommends xhigh, which has no Sonar equivalent.
One more change bites in production: Sonar's async mode is gone. The Agent API uses background mode instead, so any long-running job you had queued through async needs rewriting.
How Do You Actually Call It?
The shape of the work is straightforward once you know the endpoint has moved.
- Create an API key in your Perplexity account settings. Since April 2026 a key can only be revealed once, at creation — copy it then or generate a new one.
- Install an official SDK for Python or TypeScript, or plan to call
/v1/agentdirectly over HTTPS with a bearer token. - Send an
inputrather than amessagesarray. If you are porting Sonar code, this is the first thing to change. - Set
effortto match the job. Usefastfor lookups and classification,lowormediumfor analysis,highorxhighfor research you intend to publish. - Read the
outputarray, notchoices. Pull the prose fromoutput_textand the citations from thesearch_resultsitems. - Enable the built-in tools you need. Web search, URL fetching, code sandboxes, MCP and premium data sources are all available inside a single request.
- Use background mode for anything slow. Deep research at
xhighis not something to hold an HTTP connection open for. - Pass prior responses for multi-turn work. The API keeps conversation state, so you do not have to rebuild history yourself.
If you would rather not write a client at all, Perplexity has run a remote MCP server at https://api.perplexity.ai/mcp since July 2026, with custom connectors and OAuth sign-in added that September.
Want to know which keywords your site could realistically rank for? Start with a free SEO audit and get a clear picture.
What Does It Cost?
Pricing has two parts, and the second one is the one people forget: you pay for tokens, and you pay separately for searches.
On the search side, Fast Search launched in September 2026 at $1.00 per 1,000 web_search calls, down from $2.50, and the fast effort level adopted it. In October the low, medium, high and xhigh levels moved to Fast Search as well.
Image Search arrived in October 2026 at $2.50 per 1,000 calls.
Token pricing varies by the model the agent ends up using, which is the consequence of the Agent API being multi-vendor. A request routed to a cheap small model and one routed to a frontier model are not comparable line items.
Because of that, the only sensible advice is to read the current rate card on Perplexity's own pricing page before you size a budget. The figures move several times a year — there were token price cuts in July 2026 and increases in August.
Two cost levers are worth knowing. Presets gained stable prompt cache keys in August 2026, which Perplexity says cuts costs by roughly 5% for frequent preset users. And the Decisions API, launched in October 2026, bills its pplx-decider models per million input tokens with output free, which is cheap for routing and classification work.
A small discipline helps here: log the model each response actually used. Without that field in your own telemetry, an unexplained jump in spend is very hard to attribute after the fact.
When Should You Use It?
The API earns its place when your answers must reflect the live web. A general chat model, however good, is answering from training data; this one searches before it speaks.
The three jobs it does well are research summaries with sources, question answering over current information, and anything where you need to show a user where an answer came from.
It is also a reasonable default when you do not want to run your own retrieval stack. Search, fetching and reranking are all handled, which removes a lot of infrastructure.
The Orchestrator API, launched July 2026, is the right target if you are coordinating several agents rather than making one call. And the Embeddings API, which shipped alongside the Agent API in February 2026, covers the vector side if you are building your own index.
What Are the Limitations Worth Knowing?
The model roster churns, and that is a real operational cost. On 24 October 2026 the Agent and Orchestrator APIs retired several OpenAI model IDs including gpt-5.4, gpt-5.2 and gpt-5, and older Anthropic, Google and xAI models were dropped from the docs that month.
If you pin a model name, you are signing up to maintain that pin. Pinning an effort level instead is more durable, because Perplexity moves the underlying model for you.
Cost is harder to predict than with a single-model API, since token spend depends on which model a request lands on plus a per-search charge on top.
The migration tax is real too. If you have Sonar code in production, the messages to input change, the choices to output change and the loss of async mode all need handling, and they are not drop-in edits.
Citations are good but not infallible. The API returns the sources it used; it does not guarantee that the answer is a fair reading of them, so anything you publish still needs a human pass.
Finally, this is a hosted service with no self-hosted option. If your data cannot leave your network, this is not the tool.
Curious how your competitors are getting traffic you are not? Start with a free SEO audit and get a clear picture.
Rate limits are tier-based rather than published as one number, so a load test on a new key tells you less than you would like about production headroom.
How Does It Compare to the Alternatives?
Against calling OpenAI or Anthropic directly, Perplexity's advantage is that search is built in and cited. Going direct is cheaper per token and gives you more control, but you are building retrieval yourself.
Against a dedicated search API such as Brave or Bing paired with your own model, Perplexity is the faster route to something that works and the slower route to something you fully control. You are buying their retrieval and reranking choices.
Against Google's grounded generation, the two are close in capability. Perplexity's pitch is model choice across vendors; Google's is depth of index and tight integration with the rest of its cloud.
Against scraping the Perplexity web app, there is no comparison worth making — use the API. The web product and the API are priced and licensed differently, and only one of them is a supported integration.
The short version: use it when citations and live information matter more than per-token cost, and go direct when they do not.
Final Thoughts
The Perplexity API is in a better place than it was as Sonar, and it is also a more complicated thing to adopt. One endpoint, many models, two pricing axes and an agent loop that can take several steps per request.
If you are starting fresh, target /v1/agent, pin an effort level rather than a model, and budget for searches as well as tokens. That will survive the next few rounds of model churn without code changes.
If you are migrating, treat it as a rewrite of your client layer rather than a config change, and test the search_results handling specifically — that is where the shape differs most from choices.
For a view of what the same engine looks like from the consumer side, including the search modes and model picker that the API exposes programmatically, our rundown of Perplexity AI's features covers the product itself.
Ready to find out what your whole digital setup looks like from the outside? Start with a free SEO audit and get a clear picture.
Want this done for you?
SEO Stuff gets businesses cited by ChatGPT, Gemini, Perplexity and Claude, and ranking in Google. Start with the free audit, a call, or the package.
See where you stand
A free, manual SEO + AI search audit of your site, with a report within 48 hours. No credit card, no sales call.
Get my free auditTalk it through
A free 15-minute call with the founder about whether AI search is a meaningful opportunity for your business.
Free strategy callHave it done
The Done-For-You Package: audit, 10 pages of content, 3 DR50+ placements, dashboard. $999 once, delivered in 21 business days.
See the package

