Official Python SDK for the Brime API (search · extract · research)
Project description
brime
The live-web toolkit for AI apps. One API key. One SDK. Search, scrape, and research the open web — clean output, sane defaults, no plumbing.
Documentation | Get Your API Key | Changelog | GitHub
pip install brime
Python 3.9+. Sync and async clients, exponential-backoff retry, with_raw_response observability, fully typed (py.typed). Single dependency tree: httpx + pydantic. Released via npm-style Trusted Publishing — every wheel ships with PyPI provenance.
Why brime?
- One key, three primitives.
search,extract,research— the shape every AI app needs from the web. - Tuned defaults. No depth selectors, no round counters, no knobs to babysit. The gateway is tuned for you; you pass a query, you get a clean answer.
- Drop-in compatible. Already on Tavily, Exa, or Parallel? Point their SDK at our adapter URL and your code keeps working. Migrate when you're ready.
- Honest pricing. Flat per-call credits. 0.5 for search, 1 per URL for extract, 5 for research. No surprises.
30 seconds
from brime import Brime
brime = Brime() # reads BRIME_API_KEY
# Live answer + ranked sources, sub-second.
result = brime.search(query="what changed in the latest TypeScript release")
print(result.answer)
That's the whole shape. Same pattern for extract and research.
What you can build
Search the open web
result = brime.search(
query="tesla earnings",
topic="finance", # optional: news / general / finance recency hint
time_range="week", # optional: day / week / month / year
domains=["sec.gov"], # optional allow-list
)
Turn any URL into clean markdown
result = brime.extract(urls=[
"https://example.com",
"https://en.wikipedia.org/wiki/BM25",
])
for r in result.results:
print(r.url, len(r.markdown))
for f in result.failed:
print("skipped", f.url, f.error.message)
Handles HTML, PDF, DOCX, and JavaScript-heavy SPAs. The smart-clean pipeline strips chrome, nav, cookie banners, and template noise — what's left is the article.
Multi-step research with citations
result = brime.research(
query="compare frontier coding models with concrete benchmark numbers",
)
print(result.answer)
print(f"{len(result.sources)} sources cited")
One call, ~30–90 seconds, real synthesis from real sources.
Live progress? Stream it:
for evt in brime.research_stream(query="..."):
print(evt.event, evt.data)
if evt.event in ("complete", "error", "timeout"):
break
Authentication
export BRIME_API_KEY="sk-brime-..."
Brime() # uses BRIME_API_KEY
Brime(api_key="sk-brime-...") # explicit
Brime(base_url="https://...") # staging override (or BRIME_BASE_URL env)
Get a key at brime.dev — the free tier comes with 1,000 credits/month and no card.
Async
Every method is mirrored on AsyncBrime:
import asyncio
from brime import AsyncBrime
async def main():
async with AsyncBrime() as brime:
result = await brime.search(query="python async io")
print(result.answer)
asyncio.run(main())
Async streaming works the same way:
async with AsyncBrime() as brime:
async for evt in brime.research_stream(query="..."):
if evt.event == "complete":
print(evt.data)
break
Error handling
Typed exceptions, predictable surface area:
from brime import (
BrimeError,
AuthenticationError,
RateLimitError,
InsufficientCreditsError,
)
try:
brime.search(query="...")
except AuthenticationError:
... # bad key
except RateLimitError:
... # back off
except InsufficientCreditsError:
... # top up
except BrimeError as e:
print(e.code, e.message)
Idempotency, baked in
extract calls require an Idempotency-Key — the SDK auto-generates one per call so accidental retries never double-charge. Pin it yourself for cross-process dedup:
brime.extract(
urls=["https://x"],
idempotency_key="user-42-prefetch-2026-05",
)
Configuration
| Constructor arg | Env var | Default |
|---|---|---|
api_key |
BRIME_API_KEY |
— (required) |
base_url |
BRIME_BASE_URL |
https://api.brime.dev |
timeout |
— | 30.0 seconds |
Per-call override: brime.search(query="...", timeout=60).
Already using Tavily, Exa, or Parallel?
You don't have to rip them out. Brime exposes wire-compatible adapters:
TavilyClient(api_key, api_base_url="https://api.brime.dev/tavily")
Exa(api_key=..., base_url="https://api.brime.dev/exa")
Parallel(api_key, base_url="https://api.brime.dev/parallel")
Same response shapes, same code. Switch to the native brime SDK when you want the extras (research synthesis, SSE streaming, smart-clean extract).
Links
- Docs — docs.brime.dev
- API reference — docs.brime.dev/api-reference
- Status — brime.dev
- Issues — github.com/brime-dev/brime-python/issues
License
MIT © Brime
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file brime-0.2.0.tar.gz.
File metadata
- Download URL: brime-0.2.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4af303d09c1ea00f9e750361a9124a9ac2487e2716aae56e6e617fdf9310c008
|
|
| MD5 |
a4e686bf0c5d0ce9ede58d61bfdd397d
|
|
| BLAKE2b-256 |
3d1682f698798130b20f355856fb17502897e8db733527d6a92697c500a3d299
|
File details
Details for the file brime-0.2.0-py3-none-any.whl.
File metadata
- Download URL: brime-0.2.0-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef41c363036061050f5355e735be84162fb43c16476eceb3031af662a21bf3b3
|
|
| MD5 |
680697d1dfcbff2723faaa1ed064131e
|
|
| BLAKE2b-256 |
326954516ef889b5768fe607c5f29310fb07963c668f9d2be14dbab3b058ae2e
|