specstream-client
pip install specstream-client (the specstream package on PyPI is a different project)
Python client and command line for SpecStream, the live web data engine. One platform to build, search, extract, enrich, map, and monitor data across the entire web.
Ask for any dataset in plain words, and SpecStream builds it from the entire live web: every match found, extracted and enriched into structured records, then monitored for change.
- Source URL and read time on every value.
- You pay for each row delivered.
The client has no dependencies and needs Python 3.12 or newer. It uses the same account, permissions, projects and balance as the workspace.
pip install specstream-client
The package installs the import name specstream_client and the command specstream.
Create an API key under Agents & API in your SpecStream workspace and keep it in the environment:
export SPECSTREAM_API_KEY="ss_live_..."
Search the web
web_search calls the Search API, GET /v1/web-search, at $5 per 1,000 searches of up to 10 results, or $1 on the fast tier.
import os
from specstream_client import Client
client = Client(os.environ["SPECSTREAM_API_KEY"])
search = client.web_search(q="What is the population of Japan?")
for source in search["sources"][:1]:
print(source["title"], source["url"], source["snippet"])
Extract pages
extract_pages calls the Extract API, POST /v1/extract, at $0.80 per 1,000 pages, and a page with no text is not charged.
import os
from specstream_client import Client
client = Client(os.environ["SPECSTREAM_API_KEY"])
extract = client.extract_pages({"urls": ["https://example.com"]})
for page in extract["results"][:1]:
print(page["title"], page["url"], page["text"])
Drop-in for the API you already call
SpecStream answers calls written for these search APIs at its own address, in each API's own reply shape. To switch, change the base address and the key. Each search call is one Search API web search on your SpecStream key. A drop-in call runs the fast search: $0.001 for up to 10 results ($1 per 1,000 searches), and each 10 results more in the same call add $0.0012. A call that asks for an answer or the API's thorough mode runs the default search: $0.005 for up to 10 results, and $0.006 for each 10 more.
| API you call | Base address you have | SpecStream address | Where the SpecStream key goes |
|---|---|---|---|
| Tavily | https://api.tavily.com |
https://api.specstream.ai/tavily |
Bearer token or api_key |
| Exa | https://api.exa.ai |
https://api.specstream.ai/exa |
x-api-key or Bearer token |
| Brave Search API | https://api.search.brave.com |
https://api.specstream.ai |
X-Subscription-Token |
| Serper | https://google.serper.dev |
https://api.specstream.ai/serper |
X-API-KEY |
| Bing Web Search API v7 | https://api.bing.microsoft.com/v7.0/search |
https://api.specstream.ai/v7.0/search |
Ocp-Apim-Subscription-Key |
| Google Custom Search JSON API | https://www.googleapis.com or https://customsearch.googleapis.com |
https://api.specstream.ai |
key= (cx is accepted and not used) |
| SearXNG (JSON) | your instance address | https://api.specstream.ai/searxng/<key> |
in the address, key=, X-API-Key or Bearer token |
| Firecrawl v2 | https://api.firecrawl.dev |
https://api.specstream.ai/firecrawl |
Bearer token |
The official Tavily and Exa Python SDKs take the address as an argument:
import os
from tavily import TavilyClient
from exa_py import Exa
tavily = TavilyClient(api_key=os.environ["SPECSTREAM_API_KEY"], api_base_url="https://api.specstream.ai/tavily")
exa = Exa(api_key=os.environ["SPECSTREAM_API_KEY"], base_url="https://api.specstream.ai/exa")
- A call that names no result count returns 10 results, at $0.001 on the fast search. Brave's own default is 20: send
count=20for 20 results at $0.0022. - A Firecrawl
/v2/scrapecall is one Extract API page at $0.0008. The Firecrawl JavaScript SDK works with this address; the Firecrawl Python SDK does not yet. - Each route's request and reply fields: specstream.ai/agents.md. Create a key under Agents & API at specstream.ai/workspace. New accounts start with $10 of credit, no card.
Read a request, get the price
import os
from specstream_client import Client
client = Client(os.environ["SPECSTREAM_API_KEY"])
read = client.compile("Open-source document-signing tools I can self-host. Include the license and latest release.")
offer = client.quote_capacity_work({
"ast_hash": read["ast_hash"],
"operation": "find",
"requested_units": read["ast"]["limit"]["max"],
})
print(offer["maximum_cents"], offer["expires_at"])
Nothing has run yet. Review the quote: what will be found, the facts that come back, the most the work can cost, and when the price expires. A price lasts 30 minutes.
Approve it, then read the results
After a person approves, send the approved maximum in cents and a request key you saved first:
run = client.authorize_capacity_work({
"quote_id": offer["quote_id"],
"quote_hash": offer["quote_hash"],
"confirm_max_cents": approved_maximum_cents,
"idempotency_key": saved_request_key,
})
find_id = run["find_id"]
page = client.rows(find_id)
for row in page["rows"]:
print(row)
If the response is lost, get_capacity_request(saved_request_key) returns the same work. Keep the original key when you retry, and you will not pay twice. get_find reports progress, and rows pages through results with next_cursor. Reading, exporting and sharing results you own cost nothing.
authorize_capacity_work refuses to send anything unless the quote, its signature, the maximum and the key are all present.
Keep a list current on a schedule
A monitor checks a list again on the live web every hour, day, week or month ("month" is every 30 days). Each check is a refresh: half the row rate for a row that changed or is new, and 1 cent for a row that comes back unchanged.
monitor = client.monitor_list(
find_id,
every="week",
max_price_per_run_usd=2,
max_price_per_month_usd=8,
)
if monitor["status"] == "saved":
print(monitor["monitor_id"], monitor["next_run_at"])
else:
print(monitor["message"]) # "over_maximum": one check costs more than max_price_per_run_usd, nothing was saved
The client prices one check before it saves anything.
When one check can cost more than max_price_per_run_usd, nothing is saved.
max_price_per_month_usd is the most the monitor spends in one UTC calendar month, checks run on demand included.
Without it, the limit is max_price_per_run_usd times the checks in 31 days.
The first check runs one interval after the current hour began, and the monitor ends a year after it, unless you set first_run_at= and ends_at= (a datetime with a time zone or an ISO 8601 string).
The same call again in the same hour returns the monitor already saved, not a second one.
| Call | What it does | Cost |
|---|---|---|
monitor_list(list_id, ...) |
Prices one check of the list and saves the schedule within your limits | Each check, within the limits |
monitors() |
Every monitor of the account, with its state, next check and last list | Free |
monitor_runs(monitor_id) |
The recent checks, newest first: when, the outcome, the reason and the list each one made | Free |
run_monitor_now(monitor_id) |
One check now, inside the monitor's limits. The regular times stay as they are | One check |
pause_monitor(monitor_id), resume_monitor(monitor_id) |
Stops and starts the checks. A missed check is never bought later | Free |
delete_monitor(monitor_id) |
Ends the monitor. The lists it made stay yours | Free |
revisit(list_id) |
Each record of a refreshed list: still matches, no longer matches, unresolved or unavailable | Free |
A blocked or missed check is not an unchanged result, and it is not bought later.
For a calendar schedule (for example Mondays at 9:00 in your time zone), call create_capacity_schedule with the API's own fields, including calendar_schedule; list_capacity_schedules, update_capacity_schedule, list_capacity_occurrences and run_capacity_schedule_now are there too.
Send new and changed records to a webhook
delivery = client.set_monitor_delivery(monitor["monitor_id"], webhook="https://example.com/hooks/specstream")
signing_secret = delivery["webhook_secret"] # shown once: store it, never log it
set_monitor_delivery also takes slack= (a channel of your connected Slack workspace), send_to= (a connected tool) and notify= (SpecStream notifications). Nothing runs when you set it.
Slack and webhook delivery need a plan that includes deliveries.
Each delivery is a JSON POST with the headers Specstream-Event-Id and Specstream-Signature: t=<unix time>,v1=<hex>.
Check it before you trust the body, and use the event id to drop repeats:
import json
import os
from specstream_client import verify_webhook
# In your web endpoint, with the raw request body
verify_webhook(
secret=os.environ["SPECSTREAM_WEBHOOK_SECRET"],
signature=request.headers["Specstream-Signature"],
body=raw_body,
) # raises SpecstreamError when the signature is wrong or older than 5 minutes
event = json.loads(raw_body)
Drive a real browser
For a page that needs a real browser, open_browser starts a Chromium on SpecStream.
You drive it one step at a time, and browser_read returns the page's text as it stands after its JavaScript ran.
with client.browser(timeout_s=120) as session:
client.browser_navigate(session["id"], "https://example.com")
print(client.browser_read(session["id"])) # Markdown; "text" for plain text
A session costs $0.10 an hour, charged by the second, plus $1 per 1,000 steps (0.1¢ a step).
An open session is charged until timeout_s passes, so close it: the with block does, also when a step fails.
| Call | What it does |
|---|---|
open_browser(timeout_s=..., allowed_domains=[...], ...) |
Opens a browser and returns the session, with its id and connect_url |
browser_navigate(session_id, url) |
Opens the address |
browser_read(session_id, format="markdown") |
The page's text, in Markdown or plain text |
browser_snapshot(session_id) |
The page's links, buttons and fields, each with a reference |
browser_step(session_id, tool, arguments) |
Any step of Playwright MCP by its name: browser_click, browser_type, browser_take_screenshot and the others |
browser_session(session_id), browser_sessions(status="running") |
One session or the account's sessions, with seconds, steps and charge. Free |
browser_downloads(session_id) |
The files the browser downloaded, as the bytes of one zip, until ten minutes after the session ends. Free |
close_browser(session_id) |
Ends the session and returns it with charged_usd |
A page the browser may not open (a private address, a site that opted out, a host outside allowed_domains) is not an exception for a step: the answer's error holds the code blocked and the reason. browser_read raises SpecstreamError in that case.
Your own Playwright, Puppeteer, browser-use or Stagehand code can drive the same browser over the Chrome DevTools Protocol:
from playwright.sync_api import sync_playwright
session = client.open_browser(timeout_s=300, idempotency_key="job-42")
try:
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp(session["connect_url"])
context = browser.contexts[0] if browser.contexts else browser.new_context()
page = context.new_page()
page.goto("https://example.com")
print(page.title())
finally:
print(client.close_browser(session["id"])["charged_usd"])
With idempotency_key, the same call again answers with the same session and opens no second one.
More than a first request
quote_capacity_workalso pricesextend(more results),add_factsandrefresh(a recheck, at half price) on a finished run. Pass the originalparent_find_id.spec_options(kind)lists the facts you can ask for, per kind of thing.edit_specchanges a request without rereading it.create_capacity_schedulekeeps any request up to date, hourly to yearly, inside per-run and per-period limits.exportanddownload_exportgive CSV, XLSX, JSON or HTML.create_customer_webhooksends signed events.- Projects, members, shares and starred items have their own methods.
Command line
specstream compile "Open-source vector databases on GitHub with more than 5,000 stars, with their license."
specstream get-capacity-balance
specstream quote-capacity-work --body quote-request.json
specstream authorize-capacity-work --body approved-execution.json
specstream rows --find-id FIND_ID
--body takes a JSON file or - for stdin. Every command's --help describes its parameters. The command line exposes the same operations as the client.
Pricing
New accounts start with $10 of credit, no card. A delivered result costs 5 cents, 15 cents or $1 depending on how many facts it carries. No result, no charge. Rechecks cost half. People and agents share one balance. See pricing.
Links
MIT license.
Metadata
Release files for specstream-client 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| specstream_client-1.5.1.tar.gz | 48.2 kB | With provenance | Details for specstream_client-1.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| specstream_client-1.5.1-py3-none-any.whl | Python 3 | none | any | Details for specstream_client-1.5.1-py3-none-any.whl |
Total release size: 92.1 kB
Release files / specstream_client-1.5.1.tar.gz
| Download URL | specstream_client-1.5.1.tar.gz |
|---|---|
| Size | 48.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
304d44016928a0193bd0fafbd1ada08da20702cc88c08a90f661b6831b02b5ce
|
|
BLAKE2b-256 checksum How to use checksums |
8bf3e051125cabe38c6c7eed667757f7135eae24d41df8dd9f5a549e656e8874
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / specstream_client-1.5.1-py3-none-any.whl
| Download URL | specstream_client-1.5.1-py3-none-any.whl |
|---|---|
| Size | 43.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90576ebf977e7964e98e86e29196dbca7f1864004e70c9846c13a6441b4d4219
|
|
BLAKE2b-256 checksum How to use checksums |
e4dcfe77c20069a152c6239a8a41ba89826087f484fe7855c4af6029dbbebc01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for specstream-client 1.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for specstream_client-1.5.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.