Point your client at llmtap instead of the API β one environment variable,
zero code changes β and every call is forwarded to Anthropic (streaming and
all) while llmtap records a trace, tracks tokens / cost / cache in real time,
and prints a live dashboard.
$ llmtap up --port 8400 --trace run.jsonl
llmtap listening on http://127.0.0.1:8400
β upstream https://api.anthropic.com
β trace run.jsonl
point your client here:
export ANTHROPIC_BASE_URL=http://127.0.0.1:8400
# model inβout cache $ lat
1 claude-opus-4-8 412β128 0 $0.0053 2.1s
2 claude-opus-4-8 1620β64 1208 $0.0036 1.4s ~
3 claude-opus-4-8 980β512 0 $0.0177 3.9s
ββ session ββ
calls 3 (0 errors)
tokens 3,012 in / 704 out (1,208 from cache)
total spend $0.0266Most LLM observability means SDK wrappers, decorators, or a SaaS account. llmtap sits on the wire instead: it's a plain HTTP proxy, so anything that talks to the Anthropic API β any language, any framework, any agent β is instrumented by changing one env var.
- Zero integration.
export ANTHROPIC_BASE_URL=http://localhost:8400. Done. - Streaming-aware. SSE responses pass straight through to your client while llmtap reconstructs the message and usage for the trace.
- Cost & cache, live. Per-call tokens, dollars, and cache hits as they happen, with a session rollup on exit.
- One ecosystem. The trace it writes is the same format read by
rewind(replay/fork calls) andcachelens(diagnose cache misses). - Zero dependencies. Pure stdlib.
pip install llmtapllmtap up # listens on 127.0.0.1:8400, writes llmtap.jsonl
llmtap up --port 9000 --trace myagent.jsonl
llmtap up -q # no per-call line, just recordThen run your app against it:
export ANTHROPIC_BASE_URL=http://127.0.0.1:8400
python your_agent.pyYour ANTHROPIC_API_KEY stays in your client and is forwarded upstream
untouched β llmtap never stores it.
Afterwards, feed the trace to the rest of the toolkit:
cachelens doctor myagent.jsonl # why is my cache missing?
rewind ls myagent.jsonl # what did the agent actually do?git clone https://github.com/oavlloh-wq/llmtap && cd llmtap
pip install -e .
llmtap selftestselftest spins up a fake upstream, runs the proxy against it, and checks
forwarding, streaming passthrough, and trace recording end-to-end β entirely
offline.
llmtap is a threaded HTTP proxy. For each request it forwards method, path,
body, and headers (your API key included) to the upstream. Non-streaming
responses are relayed and parsed for usage; streaming (SSE) responses are
piped to your client byte-for-byte while llmtap accumulates the events to
reconstruct the final message, stop reason, and token usage for the trace. It
strips hop-by-hop headers and disables upstream compression so responses stay
parseable. No request or response body is sent anywhere but to you and Anthropic.
- Web dashboard (live timeline, per-model rollups)
- Budget guardrails (warn / block past a spend threshold)
- Redaction hooks for PII before writing traces
- Multi-provider upstreams
- Prometheus / OpenTelemetry export
PRs welcome.