Getting Started
Peekr traces your LLM calls with two lines of Python. Call peekr.instrument() once and every OpenAI, Anthropic, Gemini, and Bedrock call is captured automatically — no wrappers, no proxy.
Install
Python 3.9+ required.
pip install peekrOr pull in an LLM client at the same time:
pip install "peekr[openai]" # OpenAI + Peekr
pip install "peekr[anthropic]" # Anthropic + Peekr
pip install "peekr[all]" # every supported clientQuickstart (script)
Add two lines at the top of your entrypoint, then run your code as usual.
import peekr
peekr.instrument()
import openai
openai.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)Spans are written to traces.jsonl in the current directory. View them from the CLI (add --io to see inputs and outputs):
peekr view traces.jsonl
peekr view traces.jsonl --ioNote
peekr.instrument() beforeyou import or construct any LLM client. Peekr patches at the class level, so clients created before instrumenting won't be traced.Quickstart (FastAPI)
Same idea for a web app — instrument first, then add the middleware to capture request-level context on every span.
import peekr
peekr.instrument()
from fastapi import FastAPI
app = FastAPI()
app.add_middleware(peekr.FastAPIMiddleware)Connect to Peekr Cloud
Point Peekr at the hosted dashboard by passing an HTTPExporter. Spans are batched and sent in the background, so nothing blocks your app.
Python
import peekr
peekr.instrument(
tenant_id="acme",
exporter=peekr.HTTPExporter(
endpoint="https://peekr.starkspherelabs.com",
api_key="pk_live_…",
),
)TypeScript
import { instrument } from "@peekr/sdk";
instrument({
exporter: {
type: "http",
endpoint: "https://peekr.starkspherelabs.com",
apiKey: "pk_live_…",
},
});Next steps
Observability
Trace waterfalls, cost and latency tracking, evals, and hallucination scoring.
Guardrails
PIIRedact, Blocklist, and HallucinationBlock — enforce rules on every LLM call.
Compliance Packs
HIPAA, FDCPA, FINRA, GDPR, and more — enforced through Peekr Cloud.
API Reference
instrument(), @trace, exporters, and the full span schema.