How to connect Perplexity to Toolspoke
Let your Toolspoke agents ask Perplexity for search-grounded answers with citations, run web searches and start multi-step research runs. A Perplexity API key with credits, and an agent that posts a weekly news digest.
Checked against Perplexity's documentation on 2026-11-26.
An agent can reason well, but on its own it doesn't know what was published this morning. Perplexity's API answers questions by searching the web first and returns the sources it used. Toolspoke's Perplexity toolkit calls that API directly with your API key, so you get the same named actions every time, with the project's switches and audit log around them. Once it's installed, any agent in the project can use it. This guide sets it up, then builds an agent that posts a weekly news digest with links.
Setup takes about five minutes. The hard part is cost, not configuration: almost every call here is billed by Perplexity, so this guide spends most of its time on which actions spend money.
What an agent can do once it's connected
The toolkit has 8 named actions. Here is what they do, grouped by what you'd use them for:
- Ask a question, get an answer with sources:
chat_completionsends a question to a Sonar model and returns a written answer and the citations behind it. The model is a plain string. The names in use aresonar,sonar-pro,sonar-reasoning-proandsonar-deep-research. - Get sources without an answer:
searchreturns ranked web results with page content and no written answer. The agent then reads the pages itself. It's the cheapest way to get sources. - Run a multi-step research job:
create_agent_responseruns Perplexity's agent, which picks a model, searches, reads and can repeat that over several steps. Give it a model inprovider/modelform, or one of the presetsfast,low,medium,highorxhigh. Withbackground: trueit returns at once, andget_agent_responsereads the result later.cancel_agent_responsestops a run that's still going.list_agent_fileslists files a run produced, such as charts or spreadsheets. - Embeddings:
create_embeddingsturns text into vectors with Perplexity's embedding models. - Connection check:
list_modelslists the models the key can reach. It returns the Agent API's roster (ids likeopenai/…), not the Sonar models.
A note on Sonar. Perplexity's own model pages now say that Sonar Chat Completions support ended on September 27, 2026. Synchronous Sonar requests still work, and Perplexity is rewriting them as Agent API requests model by model. Asynchronous Sonar requests were not rewritten and are no longer supported, so the toolkit no longer offers queued Sonar questions; Perplexity points those users to the Agent API's background mode. In practice: use chat_completion for quick questions, and use create_agent_response with background: true for long research.
Which actions cost money
Perplexity bills per call and per token, so the action's kind (read or write) isn't the same as whether it costs money. Toolspoke marks the actions that start billed work as writes, but two reads are billed too:
| Action | Kind | What Perplexity bills |
|---|---|---|
chat_completion | Write | Tokens in and out, plus a per-request fee that depends on the search context size |
create_agent_response | Write | Model tokens at each model's rate, plus a fee for every tool call the agent makes |
cancel_agent_response | Write | Nothing itself; work done before the cancel is still billed |
search | Read | $5.00 per 1,000 successful requests, no token charge |
create_embeddings | Read | Per million tokens; pplx-embed-v1-0.6b is $0.004 and pplx-embed-v1-4b is $0.03 |
The rest (list_models, get_agent_response, list_agent_files) read results that already exist.
On Perplexity's pricing page, the agent's standard web search tool costs $0.0025 per call, and other agent tools have their own prices. One agent run can make many searches and many model turns. Its max_steps setting is the only cap this toolkit puts on that, so ask the agent to set it.
What you need
- A Perplexity API account with credits. The API is pay as you go and needs no subscription. Perplexity's quickstart says to buy API credits before you call the Agent API.
- A Toolspoke workspace, and a project to install the toolkit in.
Step 1: Create an API key
- Open Perplexity's API Console and create or select the project the key should belong to.
- Open API Keys and choose + Generate API Key.
- Copy the key straight away. The console shows the full key only once.
- Project
- API Keys
If you can, create a separate project for Toolspoke's key. Its spend is then easy to see on its own, apart from your other apps.
Step 2: Add credits
Open Billing in the API Console and buy credits. Do this before your first agent run, or create_agent_response fails even though the key is valid. Perplexity's admin docs cover payment methods and usage monitoring.
Step 3: Install the Perplexity toolkit in Toolspoke
- In Toolspoke, open the project your agents work in. Find Perplexity in the marketplace and add it.
- Paste the API key from step 1.
list_models answered. The credential works.
Toolspoke checks the connection by calling list_models, which creates nothing. If that fails, see Troubleshooting.
The key is encrypted at rest and attached to each request by the gateway. The agent never sees it, and it never appears in the arguments an agent sends or in the audit log.
Step 4: Decide what agents may spend
In the project's toolkit settings, Perplexity's actions are grouped as read, write and destructive. Each one can be switched on or off for everyone in the project. An action that's switched off can't be called, whatever the prompt says.
A sensible start:
- Leave
search,chat_completionand the result reads on. That covers most "look this up" questions. - Switch on
create_agent_responseandcancel_agent_responseonce you've seen what a few agent runs cost. - Switch off
create_embeddingsunless someone is building an index.
Perplexity actions in your project
Agents can call 5 of 8, and 1 of those can change something.
list_modelsList the models this key can reach, in OpenAI list format.searchSearch the web and get ranked results with page content, and no written answer.get_agent_responseRead an agent response by id — the one to poll after create_agent_response with `background: true`.list_agent_filesList the files an agent run produced — charts, spreadsheets, documents written in its sandbox — with their ids and names.create_embeddingsTurn text into vectors with Perplexity's own embedding models.
chat_completionAsk Perplexity a question and get a written answer with the citations behind it.create_agent_responseRun Perplexity's agent, which chooses a model, searches, reads and can use tools across several steps.cancel_agent_responseStop an agent run that is still going, so it stops spending.
Every call is recorded with the agent and person behind it, the status and the duration. Toolspoke keeps the prompts and answers out of the log, because they're prose and other people's pages.
Step 5: Build an agent that uses it
In Toolspoke, create an agent and describe its job in one sentence. The builder proposes the instructions, the toolkits it needs, a schedule and where it should answer. You add or skip each one, then create the agent. Every piece stays editable afterwards.
The same agent answers follow-up questions when someone asks it in Slack or emails it, and it replies in the thread it was asked in. It uses search and chat_completion only, so each digest costs a handful of billed calls, not an agent run.
Try it
Ask the agent the way you'd ask a researcher on the team:
- Search the web for the latest release notes for Next.js and summarise what changed. Use Perplexity's search, not a written answer, and give me the links.
- Ask Perplexity with sonar what the current LTS version of Node.js is, and show the citations.
- Start a background Perplexity agent run with the medium preset and at most 10 steps: what changed in EU AI Act guidance this quarter? Check on it in a minute.
- That agent run is taking too long. Cancel it.
The third and fourth need create_agent_response and cancel_agent_response switched on.
For narrow questions, ask the agent to restrict the domains or the recency of sources. That's cheaper than a bigger model, and usually more accurate. The Perplexity toolkit page lists every action.
Troubleshooting
401 or "invalid API key".
The key was copied wrong or revoked. Generate a new one under API Keys and paste it into the toolkit's credentials.
The key works, but agent runs fail on credits.
The project has no API credits. Buy some under Billing.
An agent asks for a queued Sonar question.
Perplexity no longer supports asynchronous Sonar requests, and the toolkit no longer has an action for them. Switch on create_agent_response, ask for background: true, and poll get_agent_response.
listmodels doesn't list sonar.
That's expected. It lists the Agent API's models. Sonar model names go straight into chat_completion.
A 400 naming maxoutputtokens.
The agent run used an anthropic/… model, which needs an output token cap. Ask the agent to set one.
Questions
Does the agent see my Perplexity key?
No. The gateway attaches it to the request. The agent never sees it, and it's masked in the audit log.
Can I cap what an agent spends?
Perplexity bills your Perplexity account, so the cap lives there. Use a dedicated Perplexity project with only the credits you're willing to spend, switch off the actions you don't need, and have the agent set max_steps on agent runs.