Skip to main content

observra

Zero-touch tracing and gateway routing for LLM SDKs — configure once, keep writing the provider SDK's own client exactly as before.

Install

pip install observra

Configure

Only gateway_key is required — gateway_url defaults to the production gateway (https://gateway.observra.in):

import observra

observra.configure(gateway_key="obs_live_xxx")

Or via environment variable (no explicit configure() call needed):

export OBSERVRA_GATEWAY_KEY="obs_live_xxx"

Use

No wrapper client — write plain provider SDK code exactly as you already would. configure() transparently patches the SDK (Gemini) and, for every known provider host, patches httpx itself (OpenAI, Anthropic — and Gemini too, for non-SDK callers), so any request to those hosts routes through the gateway and gets traced/guardrailed, no matter which library actually made the call:

from google import genai

client = genai.Client(api_key="AIza...")  # your own Gemini key, forwarded as-is

response = client.models.generate_content(
    model="gemini-2.0-flash",
    contents="Summarize this support ticket: ...",
)
print(response.text)
from openai import OpenAI

client = OpenAI(api_key="sk-...")  # your own OpenAI key
response = client.chat.completions.create(model="gpt-4o-mini", messages=[{"role": "user", "content": "..."}])
from anthropic import Anthropic

client = Anthropic(api_key="sk-ant-...")  # your own Anthropic key
response = client.messages.create(model="claude-3-5-sonnet-20241022", max_tokens=1024, messages=[{"role": "user", "content": "..."}])

Cerebras works through its native SDK, raw HTTPX, or any HTTPX-based OpenAI-compatible client. Configure Observra before constructing the client:

import observra
from cerebras.cloud.sdk import Cerebras

observra.configure(gateway_key="obs_live_xxx")
client = Cerebras(api_key="csk-...")
response = client.chat.completions.create(
    model="gpt-oss-120b",
    messages=[{"role": "user", "content": "..."}],
)

The OpenAI SDK works too with base_url="https://api.cerebras.ai/v1". Sync and async HTTPX clients route to /cerebras automatically. Cerebras' optional aiohttp backend is not intercepted; use its default HTTPX backend.

TokenRouter works with the OpenAI SDK by setting base_url="https://api.tokenrouter.com/v1". Requests are automatically routed through the Observra gateway at /tokenrouter; the upstream /v1 prefix is removed because the gateway handles TokenRouter's provider versioning. Raw HTTPX requests to the same TokenRouter host are handled identically.

Same for async clients, and for any framework integration that builds one of these internally — e.g. LangChain's ChatGoogleGenerativeAI routes through the gateway automatically too, no extra step. See examples/raw_http_gemini.py for the same guarantee at the raw-HTTP level — no provider SDK at all, just httpx pointed straight at Google's real endpoint.

Inside a LangChain agent — instrument() additionally traces every step (agent/chain/tool boundaries) under one trace, on top of the LLM-call-level tracing configure() already gives you:

observra.instrument()

Guardrails (PII/secret detection on prompts and responses) run on every call automatically — violations are recorded as span events (guardrail.violation), the payload itself is never blocked or altered.

See examples/ for full runnable scripts, and traces show up in your Observra dashboard's Request Flow view.

Download files

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

Source Distribution

observra_sdk_python-0.1.8.tar.gz (56.0 kB view details)

Uploaded Source

Built Distribution

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

observra_sdk_python-0.1.8-py3-none-any.whl (52.9 kB view details)

Uploaded Python 3

File details

Details for the file observra_sdk_python-0.1.8.tar.gz.

File metadata

  • Download URL: observra_sdk_python-0.1.8.tar.gz
  • Upload date:
  • Size: 56.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for observra_sdk_python-0.1.8.tar.gz
Algorithm Hash digest
SHA256 f64fa5c26f091ba71ebf803c253a8af4f4073ad30887a2ce5ff709aac5bbe8a5
MD5 8e8b0e4839632d918d7aa4765c812d78
BLAKE2b-256 5dc49fdfca57560f9787d8ff2b44a9e605fb0f75ca243915b4dd4ca27802ee00

See more details on using hashes here.

Provenance

The following attestation bundles were made for observra_sdk_python-0.1.8.tar.gz:

Publisher: publish.yml on aviasoletechnologies/observra-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file observra_sdk_python-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for observra_sdk_python-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4dff154bc5450350899ce70754d8a3c62172dfde3fc5bcd56b72b7b1eeb8d007
MD5 ad7d883f4f348ea72ab571da042062f3
BLAKE2b-256 f9f9f3e58c0b6f8da553cfadcab1a8dceb68f5628b80685c4031d51ba8932a1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for observra_sdk_python-0.1.8-py3-none-any.whl:

Publisher: publish.yml on aviasoletechnologies/observra-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page