# How to use the Perplexity API

Create an account in the Perplexity API Console, buy credits, generate a key and call the Agent API. Inside: the seven APIs, their prices and the end of Sonar.

Tool: Perplexity. By ColdIQ team. Updated 2026-11-27. Source: https://coldiq.com/university/perplexity/perplexity-api

## In short

- The Perplexity API lets developers bring Perplexity’s live, web-grounded search into their own apps. It uses the same infrastructure as the public answer engine.
- It is a separate service from the Perplexity subscription: you buy pay-as-you-go credits, and no Pro or Max plan is needed.
- Seven APIs share one key and one host, api.perplexity.ai. The Agent API is the one Perplexity recommends for new projects.
- As of November 2026, the Search API costs $5 per 1,000 requests, or $1 per 1,000 in Fast Search mode.
- Sonar Chat Completions support ended on September 27, 2026. Perplexity asks developers to move to the Agent API.

## Steps

1. Sign in at console.perplexity.ai and create a project.
2. Add credits on the Billing page, then generate an API key.
3. Save the key as PERPLEXITY_API_KEY and send a first request.

## What is the Perplexity API?

An API (a way for one program to talk to another) lets your own software use Perplexity. Instead of typing in the chat, your code sends a request and gets back an answer or search results.

Perplexity says its API is for developers who build search, question answering, agents (programs that act on their own) or retrieval pipelines. It runs on the same infrastructure as perplexity.ai.


## Which APIs does Perplexity offer?

All seven use the same API key and the host api.perplexity.ai.

- Agent API: model calls that can search the web, fetch pages, run code or use your own tools.
- Search API: ranked web results (title, link, snippet, dates) with no written answer.
- Context API: pulls the content of web pages you already have.
- Decisions API: returns probabilities for yes or no, multiple-choice and rubric questions.
- Orchestrator API: direct calls to models in the OpenAI or Anthropic request format.
- Embeddings API: turns text and images into vectors for semantic search.
- Monitor API: saves recurring searches or watches pages for changes.


## How do you get a Perplexity API key?

You manage everything in the API Console at console.perplexity.ai. Perplexity says some new accounts get a one-time $10 credit that expires after 60 days.

1. Sign in to the API Console and create or select a project.
2. If the project has only sign-up credit, add credits on the Billing page before you call the Agent API.
3. Open the API Keys page and generate a new key.
4. Copy the key right away: the console shows it only once.
5. Save it as an environment variable named PERPLEXITY_API_KEY, never in your code.

Tip: Treat the key like a password. Anyone who has it can spend your credits. Turn on Automatic Top Up only with a budget in mind.


## How much does the Perplexity API cost?

You pay per use. These are the prices on Perplexity’s docs, as of November 2026.

The Agent API charges the tokens of the model you pick (a token is a small piece of a word) plus a fee each time a tool runs. Model prices vary a lot, from cheap fast models to top models such as Claude Opus 5.5 at $4 per million input tokens.

- Search API: $5 per 1,000 requests, or $1 per 1,000 with Fast Search.
- Agent API web search tool: $2.50 per 1,000 calls, or $1 per 1,000 with Fast Search.
- Agent API fetch URL tool: $0.50 per 1,000 calls.
- Agent API people search and finance search tools: $5 per 1,000 calls each.
- Context API: $1 per 1,000 fetched pages.


## What happened to Sonar?

Sonar was the name of Perplexity’s earlier answer models in the API. Perplexity says Sonar Chat Completions support ended on September 27, 2026.

Normal and streaming Sonar requests keep working for now, as Perplexity rewrites them into Agent API requests. Asynchronous Sonar requests are no longer supported.

For a new project, use the Agent API. Its effort levels replace the old models: Sonar and Sonar Pro map to fast, Sonar Reasoning Pro to low, and Sonar Deep Research to high.


## What can a sales or marketing team build with it?

The API is for teams with a developer, or for people who use AI coding tools. It turns a manual research habit into a step that runs on every row of a list.

- Add a one-line "latest news" column to every account in a spreadsheet.
- Check each company’s pricing page for changes every week with the Monitor API.
- Feed fresh, cited facts into the first line of a cold email.
- Build an internal Slack bot that answers market questions with sources.


## Command

```
pip install perplexityai
```

## Sources

- [What is the Perplexity API Platform?](https://www.perplexity.ai/help-center/en/articles/10354842-what-is-the-perplexity-api-platform)
- [API payment and billing](https://www.perplexity.ai/help-center/en/articles/10354847-api-payment-and-billing)
- [API overview](https://docs.perplexity.ai/docs/getting-started/overview)
- [API quickstart](https://docs.perplexity.ai/docs/getting-started/quickstart)
- [API pricing](https://docs.perplexity.ai/docs/getting-started/pricing)
- [Agent API models](https://docs.perplexity.ai/docs/agent-api/models)
- [Migrate from Sonar to the Agent API](https://docs.perplexity.ai/docs/agent-api/migrate-from-sonar/overview)

## Questions

**Is the Perplexity API free?** No. It is pay as you go. Some new accounts get a one-time $10 credit that expires after 60 days.

**Does Perplexity Pro include API access?** The API is a separate service with its own credits. Perplexity says no subscription is needed to buy API credits or use the API.

**Is the Perplexity API compatible with OpenAI?** The Orchestrator API accepts requests in the OpenAI or Anthropic format, so you can use the OpenAI SDK with it.

**Can I get a refund on API credits?** Perplexity refunds unused credits if you ask within 14 days of purchase. Used credits are not refundable.


## Related

- [How much does Perplexity Pro cost?](https://coldiq.com/university/perplexity/perplexity-pricing)
- [What is Perplexity AI?](https://coldiq.com/university/perplexity/what-is-perplexity)

## Try ColdIQ free

ColdIQ gives new accounts up to 1,450 free credits as they get started, no credit card required.
One subscription covers 40+ B2B data providers for finding, enriching and verifying
contacts and companies, through the web app, the API or the MCP server for AI agents.

1. Create an account: https://coldiq.com/marketplace/sign-up?utm_source=ai-assistant&utm_medium=markdown&utm_content=university
2. Run a first search on your own market with the free credits.
3. Connect the MCP server to Claude, ChatGPT or Cursor: https://coldiq.com/mcp
