Short answer. You call the Perplexity Agent API with client.responses.create(effort=..., input=...) and get text with inline sources. The parameter that decides cost, time and depth is effort, with five stable levels (fast, low, medium, high, xhigh) and a sixth in preview (ultra-preview). Each level is a ready-made bundle of model, tools, step ceiling and system prompt; whatever you pass alongside overrides it. The cost to watch is not the level itself but how many tools the model invokes inside the ceiling, because each search is billed separately.
Verified on 30 October 2026
Tables and model names come from the "Effort" and "Presets" pages of the documentation. The pages state explicitly that you can call a level by name (automatic updates) or pin its version: the response carries an effort field with the version that ran, for example fast@2026-10-16.0. By the time you read this the models behind a level may have changed: that is why it pays to log that field.
The levels in a table
| Level | Model (per documentation) | Tools | Max steps | Suggested use |
|---|---|---|---|---|
fast | openai/gpt-6-luna (fallback openai/gpt-5.6-luna) | web search in fast mode | 1 | Single facts, definitions, short summaries |
low | openai/gpt-6-luna | fast search (4,000 tokens) + fetch_url (1 URL) | 5 | Everyday research, light multi-step lookups |
medium | openai/gpt-6-luna | same as low | 15 | Multi-hop browsing, aggregation across many sources |
high | openai/gpt-6.1-terra | same as low | 40 | Deep, source-heavy research without code execution |
xhigh | anthropic/claude-opus-5-5 (fallback openai/gpt-6.1-sol) | web search, finance search, code sandbox | 300 | Open-ended agentic work including code execution |
ultra-preview | not disclosed | not disclosed | not disclosed | Maximum coverage; long runs; called by name |
The documented output-token ceilings are 8,192 for fast, 128,000 for low, medium and high, 512,000 for xhigh. The search presets use search_type: "fast" at all the listed levels, with max_results 10 for fast and 15 for the others. Do not copy model names into your code: the level is the contract, the model is a detail Perplexity may change.
The first call and what comes back
from perplexity import Perplexity
client = Perplexity()
answer = client.responses.create(
effort="low",
instructions="Answer in English, in at most 120 words.",
input="What is the difference between PerplexityBot and Perplexity-User?",
)
print(answer.output_text)
print(answer.effort) # e.g. "low@2026-10-16.0": log it
Input rules, from the migration guide: input accepts a string or an array of items ({"type": "message", "role": "user", ...}); the system prompt goes in the instructions field; for multi-turn dialogue you pass previous_response_id or resend earlier turns, assistant included, inside input. The token ceiling is set with max_output_tokens.
Sources: where they live and how to read them
The response is a typed output array that records the whole run: searches, results, executed code, generated files. Sources arrive in an item with type: "search_results"; each result has an id, and the inline marker in the text ([1] at fast, [web:1] from low upward) points to the result with that id. The documentation describes no separate "annotations" field: the marker-to-source map is yours to build.
import re
def read(field, name, default=None):
"""Read a field from an SDK object or a dict."""
if isinstance(field, dict):
return field.get(name, default)
return getattr(field, name, default)
def sources_by_id(answer):
mapping = {}
for item in answer.output:
if read(item, "type") == "search_results":
for r in read(item, "results", []):
mapping[str(read(r, "id"))] = {
"title": read(r, "title"),
"url": read(r, "url"),
}
return mapping
def with_links(answer):
mapping = sources_by_id(answer)
def replace(m):
key = m.group(1).split(":")[-1]
s = mapping.get(key)
return f"[{key}]({s['url']})" if s and s["url"] else m.group(0)
return re.sub(r"\[((?:web:)?\d+)\]", replace, answer.output_text)
An honest caveat: the field names title and url inside the search_results item I took from the shape of Search API results; the migration page names only id and results with certainty. Print a real response and check before trusting the code above. Two tests worth writing: every marker in the text has a matching source, and every URL in the map answers 200.
Filters and tools: what is overridden and what is merged
If you pass effort together with other fields, your fields win; the tools array merges per tool. A concrete example from the documentation: overriding only web_search does not remove fetch_url, which keeps running. To narrow the search you add the tool with its filters:
answer = client.responses.create(
effort="low",
input="What does the official documentation say about QPS limits?",
tools=[{
"type": "web_search",
"max_results": 8,
"max_tokens_per_page": 2000,
"filters": {
"search_domain_filter": ["docs.perplexity.ai"],
"search_recency_filter": "month",
},
}],
)
Documented web_search parameters: search_type ("web" or "fast"), max_results from 1 to 50, max_tokens, max_tokens_per_page, user_location; in filters: search_domain_filter (up to 20 domains, - prefix to exclude; allowlist or denylist, not both), search_recency_filter (hour, day, week, month, year) and filters on publication or last-update date in MM/DD/YYYY format. To check which tools really ran, the documentation says to inspect response.model and response.usage.tool_calls_details.
Streaming and long runs
- Streaming: the Agent API emits typed server-sent events. For text you handle
response.output_text.delta; tool calls and reasoning arrive asresponse.output_item.*andresponse.reasoning.*events, not as text deltas. - Background: with
background: trueyou submit the request and poll the response by id. Forxhighandultra-preview, which can run long, it is the indicated route. Note: polling counts toward the QPS limit (article 6), so do it with backoff.
The trade-off: depth is paid in tools, not in "quality"
Moving up a level changes three things together: the model, the step ceiling and the available tools. You cannot isolate which of the three improved the answer. Perplexity publishes internal benchmarks (on the migration page) but, as they state, these are internal results and improvements "vary by use case". The method I propose is less elegant and more reliable:
- Collect 30-50 real questions from your product, with the expected answer or at least the facts that must appear.
- Run them at
fast,lowandmedium; record theeffortfield with version, the number of tool calls (tool_calls_details), tokens and time. - Pick the lowest level that passes your criterion. If the criterion is "every claim has a source that supports it", verify it by hand on a sample: a marker being present does not prove the cited page says that.
On costs: each standard web search is 0.0025 dollars (0.001 in fast mode), each fetch_url 0.0005. At low, with a 5-step ceiling, the maximum tool cost per request stays around a cent; at xhigh, with 300 possible steps, the ceiling is two orders of magnitude higher and the real distribution is not published. I do not know the model token prices (they are not on the page I read): measure them.
Common mistakes
- Thinking
reasoning.effortis the same aseffort. The documentation separates them:effortpicks the bundle,reasoning.effortcontrols only the chosen model's reasoning. - Passing
effortandprofiletogether. Not allowed. - Setting
temperatureand expecting determinism. For the GPT-5, o1 and o3 families the documentation saystemperatureandtop_pare ignored and thattemperature: 0does not guarantee identical outputs. If you need repeatable tests, pin the level's version and compare facts, not strings. - Treating the response as text. The
outputarray holds the audit trail of the run: keeping it (at least source ids and tool calls) is what lets you explain an error three weeks later.
Use cases: when the right level changes someone's work
Hypothetical scenarios: people, hours and sizes are declared assumptions; tool prices are the documented ones; model tokens are not, since they are not on the pricing page read.
Daily life: "is this message about the recall true?"
Who: Anna, who receives in the family group chat a message about an alleged recall of a children's product. What she did: searched institutional sites by hand, ten minutes, and often gave up. What changes: a small tool (a web form of her own, or a terminal command) sends the question to the Agent API at low with search_domain_filter limited to the competent authority's sites and asks it to answer only if it finds a source in those domains. Documented tool cost: at most five steps, each at most one 0.0025-dollar search, about one cent. What goes wrong: the answer can say "confirmed" while citing a page about a different batch or product. So the tool shows the list of links and Anna's rule is one: before forwarding, she opens the page and reads the product name.
Small business, professional practice: the three-person law firm
Who: a three-lawyer firm (assumption) that must get oriented on a new subject before a consultation. What it did by hand: about an hour and a half of research across databases and official sources per new topic. What changes: medium level (15-step ceiling) with the domain filter on the official sources the firm already uses, and instructions asking for a list of leads to verify with links, not an opinion. Tool-only ceiling: 15 standard searches are 0.0375 dollars. What goes wrong, and here a mistake is costly: (1) the citation may not support the claim; (2) the version of a statute read by the model may not be the one in force on the date that matters; (3) a reference to a judgment may be inaccurate. The firm's rule: no line of a filing or opinion originates from generated text; the API answer tells you where to look, and every reference is checked on the official source before use. With that rule the API saves the initial orientation; without it, it transfers the risk to the client.
Large manufacturer: the weekly regulatory watch
Who: the compliance office of a manufacturer with lines in several countries (assumption). What it did by hand: one analyst spent a day a week scanning gazettes, agency sites and newsletters on twenty-five subjects that touch the products. What changes: a scheduled job launches twenty-five requests with background: true, medium level, a week recency filter and authoritative domains; the analyst receives a queue of flags with links and checks the relevant ones. For the audit trail, for each request you store the whole output array, the effort field with its version and the tool calls: that is what lets you answer, months later, "why didn't you flag this change?".
import json, time, pathlib
def run_and_archive(client, topic, folder="audit"):
r = client.responses.create(
effort="medium",
background=True,
input=f"Regulatory news from the last week on: {topic}. "
"List only facts with a source; if you find nothing, say so.",
tools=[{"type": "web_search",
"filters": {"search_recency_filter": "week"}}],
)
# ...poll with backoff (see article 6), then:
pathlib.Path(folder).mkdir(exist_ok=True)
name = f"{int(time.time())}-{topic[:30].replace(' ', '_')}.json"
(pathlib.Path(folder) / name).write_text(
json.dumps(r.model_dump(), ensure_ascii=False, indent=2)
)
return r
model_dump() assumes a Pydantic object: check the type your SDK returns. What goes wrong: non-repeatability (the documentation says temperature does not guarantee identical outputs) and level drift if you do not pin the version; 25 parallel jobs count against the organization's shared QPS, and so does polling. The system's silence ("nothing new") does not prove there is nothing new: a person must spot-check periodically. Healthcare: for clinical decisions this tool must not be used as a source; for a hospital it can, with the same discipline, flag guidelines for a clinician to read, never to replace the reading.
← Article 1: the API map Article 3: the Search API for your RAG →
Frequently asked questions
Which effort levels does the Perplexity Agent API have?
fast, low, medium, high and xhigh, plus ultra-preview in preview. Each is a bundle of model, tools, step ceiling (1, 5, 15, 40, 300) and system prompt; fields you pass alongside take precedence over the defaults.
How do I get the URLs of the cited sources?
In the output array look for the item of type search_results: each result has an id, and the inline marker ([1] or [web:1]) points to that id. Check the url and title field names on a real response before writing the parser.
Can I pin a level's version?
Yes: the response includes the effort field with the version (for example fast@2026-10-16.0) and that value can be sent back to pin the configuration. Calling the level by name gives you automatic updates.
How much does an Agent API request cost?
It depends on the model tokens, which are not listed on the pricing page read, plus tools: 0.0025 dollars per standard search, 0.001 in fast mode, 0.0005 for fetch_url. The number of tools invoked varies within the level's step ceiling.
Sources and further reading
- Perplexity, Agent API: effort levels (read on 30 October 2026)
- Perplexity, Agent API: presets (30 October 2026)
- Perplexity, web_search tool (30 October 2026)
- Perplexity, migration guide: request and response shape (30 October 2026)
- Perplexity, Pricing (30 October 2026)
Commenti
Caricamento commenti...
Sign in to comment