Skip to content

About

Move from the Perplexity Search API to SpecStream in one line: set base_url to api.specstream.ai/perplexity and keep the official SDK, request and reply. $1 per 1,000 searches. Python, Node and cURL, tested on a stand-in and live.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Move from the Perplexity Search API to SpecStream in one line

Keep your Perplexity code and its official SDK. Set the base URL to https://api.specstream.ai/perplexity in place of https://api.perplexity.ai and put a SpecStream key where your Perplexity key was. The route is POST /search, the request and the reply stay Perplexity's own, and the key stays a Bearer token.

  client = Perplexity(
-     api_key=os.environ["PERPLEXITY_API_KEY"],
+     api_key=os.environ["SPECSTREAM_API_KEY"],
+     base_url="https://api.specstream.ai/perplexity",
  )
  search = client.search.create(query="best crm for dental clinics", max_results=5)

Each call is one search on SpecStream's fast tier: $0.001 for up to 10 results, which is $1 per 1,000, at a 937 ms median over 6,548 live calls in the 7 days to December 1, 2026. Perplexity's Search API lists $5 per 1,000 requests (compared November 24, 2026). SpecStream is first on WideSearch and 99 on SimpleQA Verified (benchmarks). Tested with perplexityai 0.50.0 and @perplexity-ai/perplexity_ai 0.45.0.

Python, with the official SDK

import os
from perplexity import Perplexity

client = Perplexity(api_key=os.environ["SPECSTREAM_API_KEY"], base_url="https://api.specstream.ai/perplexity")
search = client.search.create(query="best crm for dental clinics", max_results=5, search_recency_filter="month")
for result in search.results:
    print(result.date, result.title, result.url)

Or set PERPLEXITY_BASE_URL=https://api.specstream.ai/perplexity in the environment and change no code. python/perplexity_search.py makes the same call with the standard library only.

Node, with the official SDK

import Perplexity from "@perplexity-ai/perplexity_ai";

const client = new Perplexity({ apiKey: process.env.SPECSTREAM_API_KEY, baseURL: "https://api.specstream.ai/perplexity" });
const search = await client.search.create({ query: "best crm for dental clinics", max_results: 5 });

node/perplexitySearch.mjs does the same with fetch only.

cURL

curl https://api.specstream.ai/perplexity/search \
  -H "Authorization: Bearer $SPECSTREAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "best crm for dental clinics", "max_results": 5}'

What carries over

Perplexity Search API On SpecStream
POST https://api.perplexity.ai/search POST https://api.specstream.ai/perplexity/search
query as a string, or a list holding one query the same; a list of several queries gets a 422 (send one call per query)
max_results 1 to 20, 10 by default (to 50 with search_type: "people"), search_type web, fast or people the same
search_recency_filter (hour, day, week, month, year), search_after_date_filter and search_before_date_filter as MM/DD/YYYY the same
search_domain_filter, with - before a domain to leave it out the same
max_tokens, max_tokens_per_page the page text in each snippet, cut to that budget
reply: id, results[] with title, url, snippet, date, last_updated; server_time with display_server_time the same; date, last_updated and server_time are null when there is none
errors: 401 for a key, 422 {"detail": [...]} for a field, 429 with Retry-After when busy the same

Each reply also carries a specstream object with the request_id and the price_usd of the call. Perplexity's chat completions (Sonar) are a different route; for answers with citations on any model, see perplexity-rag-grounding-specstream.

Check it without a key

pip install -r requirements.txt     # optional: adds the official SDK check
python check_live.py
https://api.specstream.ai/perplexity replaces https://api.perplexity.ai: POST /perplexity/search, key in the Authorization: Bearer header
no key       401 missing_api_key
made up key  401 invalid_token
official SDK  AuthenticationError 401, as on Perplexity
The route answers in Perplexity's own shape. Set SPECSTREAM_API_KEY to search.

A call with no key or a made up key is refused before any search runs, so the check spends nothing.

Test

pip install -r requirements.txt && python -m unittest discover -s tests -v
npm install && npm test

The tests run the standard library clients and both official SDKs against a local stand-in for the route (tests/fake_perplexity.py) that answers as the live one does: the request passed through unchanged, null date, last_updated and server_time, no results, a list of two queries refused with 422, a 429 waited out, and no key or a made up key refused with 401 (AuthenticationError in the SDKs). They need no key and spend nothing.

Prices

Price
Fast search (speed: "fast"), up to 10 results $1 per 1,000 searches, 937 ms median over 6,548 live calls in the 7 days to December 1, 2026
Default search, with a cited answer when the question has one $5 per 1,000 searches
Extract, a page read as Markdown $0.80 per 1,000 pages read
Free credit on sign up $2, which is 2,000 fast searches or 2,500 pages read, no card
Monthly Pro Pass $49 a month: 5,000 ready list rows a month and $49 of API credit

SpecStream is the live web data engine: first on WideSearch and 99 on SimpleQA Verified (benchmarks).

Links

License

MIT

About

Move from the Perplexity Search API to SpecStream in one line: set base_url to api.specstream.ai/perplexity and keep the official SDK, request and reply. $1 per 1,000 searches. Python, Node and cURL, tested on a stand-in and live.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages