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.

terminal
pip install peekr

Or pull in an LLM client at the same time:

terminal
pip install "peekr[openai]"      # OpenAI + Peekr
pip install "peekr[anthropic]"   # Anthropic + Peekr
pip install "peekr[all]"         # every supported client

Quickstart (script)

Add two lines at the top of your entrypoint, then run your code as usual.

python
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):

terminal
peekr view traces.jsonl
peekr view traces.jsonl --io

Note

Call 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.

python
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.

1

Python

python
import peekr

peekr.instrument(
    tenant_id="acme",
    exporter=peekr.HTTPExporter(
        endpoint="https://peekr.starkspherelabs.com",
        api_key="pk_live_…",
    ),
)
2

TypeScript

typescript
import { instrument } from "@peekr/sdk";

instrument({
  exporter: {
    type: "http",
    endpoint: "https://peekr.starkspherelabs.com",
    apiKey: "pk_live_…",
  },
});

Next steps