Skip to main content

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.

pip install brime

Python 3.9+. Sync and async clients. Fully typed (py.typed). Single dependency tree: httpx + pydantic.

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

License

MIT © Brime

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brime-0.1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brime-0.1.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file brime-0.1.0.tar.gz.

File metadata

  • Download URL: brime-0.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for brime-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d1947d598b09a4e3c13b6e8a460851a9b1a73e2d3a25fa5611f6c3db859ed8ca
MD5 8880f1906c1775910211ca2b9107a770
BLAKE2b-256 83a696fb3c5b189d4bb4e6d9037c3f35473aa0ccabe918e0228e5a0a915bb435

See more details on using hashes here.

File details

Details for the file brime-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: brime-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for brime-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53846f19e3a09a5761d4b461f3c6c73e7579eb463eaf9d44754de7c24068e027
MD5 8da6ad3cf1db23ae6729eb5911eff624
BLAKE2b-256 f60e2be37904d73ab3a7e4e4b49ac9c2b68d00844f8c6b1ad57b92df57cb1be4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page