Migrate from Perplexity
Keep the Perplexity SDK for the Search API. Change the base URL and the key.
typesearch speaks Perplexity’s Search API (POST /search) — the ranked results, not Sonar’s generated
answers. With the official SDK, migrating is one line.
from perplexity import Perplexity
# before: client = Perplexity()
client = Perplexity(api_key=TYPESEARCH_API_KEY, base_url="https://api.typesearch.ai/compat/perplexity")
r = client.search.create(query=["el dólar", "el FMI"], max_results=5, search_recency_filter="week")You can also set PERPLEXITY_BASE_URL instead of changing code.
Parameters
| Perplexity | On typesearch |
|---|---|
query (one, or up to 5) | Same. Several queries are judged together; results come in one list. |
max_results (1–20) | Same. |
search_domain_filter | Same: without a prefix it includes, with - it excludes, paths included. Mixing both is an error, as on Perplexity. |
search_recency_filter | hour, day, week, month, year. |
search_after_date_filter, search_before_date_filter | Same (MM/DD/YYYY). last_updated_* is read as the publication date (approximated:). |
country | Only outlets from that country (approximated:country: Perplexity treats it as a preferred region; here it filters). |
search_language_filter | Same: only articles in those languages. |
max_tokens, max_tokens_per_page, search_context_size | Ignored: excerpts are always short. |
search_type: "web", "fast" | Both run in our fast mode. |
search_type: "people" | An error: the index is news. |
Without a date filter it searches the whole index, as Perplexity does, in fast mode.
What it costs
Perplexity bills its Search API at $5 per 1,000 requests, or $1 with Fast Search
(search_type: "fast"), and a request can carry up to five queries (list prices checked September 25, 2026). Here each
query is one search of its mode: $1.40 per 1,000 in fast, the mode the compatibility layer uses,
$1.00 in ultra, which judges headlines only, and $2.20 in normal, which reads the top 4 before ranking
them. For single headline searches, Perplexity’s Fast Search costs the same as our ultra (pick it with
"mode": "ultra" in the extras below) and less than our fast; with several queries per request it costs
less, because it bills the request and we bill each query. What you get for the difference is a news index
with publication time and outlet on every result, a calibrated relevance probability and, in normal and
deep, results read and verified before they are ranked.
Our extras
With the Perplexity SDK, send them through extra_body:
r = client.search.create(query="el dólar", extra_body={"typesearch": {"tone": True, "mode": "normal"}})They come back in a typesearch field of the response. Errors keep Perplexity’s format: 422 with
detail[] for validation, error for the rest.