Sign in Book a demo 136
Open source · runs locally · no signup

Token Efficiency For AI Agents

TokenJam reads your Claude Code, Codex, and other agent logs and estimates where you can cut tokens: cheaper models, cacheable prefixes, leaner prompts, deterministic scripts.

Open-source. Runs locally. Full observability stack included.

tokenjam — first run
$ pipx install tokenjaminstalled tokenjam · CLI available as `tj` or `tokenjam` $ tj onboard --claude-codewired Claude Code telemetry · backfilled 247 sessions $ tj optimizeAnalyzing 247 sessions, 9.8K spans, 4.0M tokens (30d)…  downsize  116 sessions look Haiku-eligible (structural)  cache     2.4K-token prefix repeats across 94% of calls  trim      ~770 low-significance tokens in your CLAUDE.md  Estimated recoverable: ~$1,632/mo — review before acting $ tj tokenmaxx  Efficiency tier: LeanOperator · 38% overhead this cycle

Illustrative output. Every figure is an estimate you review before acting.

How it works

Telemetry from your agents flows into the TokenJam core, through the analyzers, and out to TokenJam Lens and TokenJam Bench.

From your agents

  • Claude
  • OpenAI
  • Anthropic
  • Google
  • AWS
  • Microsoft
  • NVIDIA
  • LiteLLM
  • OTLP
TOKENJAM
Available via CLI · MCP · Exported config

Reads telemetry from every major agent runtime, framework, provider, and observability tool.

Fifteen analyzers + Lens. One install.

Each analyzer reads the same captured telemetry and surfaces a different shape of waste. Lens brings them together in a local dashboard you can open in your browser.

Downsize

Find tasks where a cheaper model would suffice.

tj optimize — downsize
$ tj optimize Analyzing 247 sessions, 9.8K spans, 4.0M tokens (last 30d)…   ① Model downgrade: 47% of sessions look Haiku-eligible     • 116 of 247 sessions match structural heuristics     • Currently: claude-opus-4-7, claude-sonnet-4-7     • Suggested target: claude-haiku-4-5     • At current usage: $1,886 → $254 (-86% on flagged sessions)     • Estimated monthly savings: $1,632 (-38% total)
See how it works

Trim

Identify token waste in your system prompts.

tj optimize — trim
Prompt bloat detected in claude-code-myproj:  • Your CLAUDE.md is 4,213 tokens (up 38% in 30 days)  • Section "Coding conventions > Error handling" appears identically    in 91 of 247 sessions (1,108 tokens × 91 = ~100K repeated tokens)  • Significance analysis suggests ~340 of those 1,108 tokens carry    the signal; the rest could be trimmed  • Estimated cost: ~$8.50/mo at current usage on Sonnet
See how it works

Cache

Detect cacheable prompt prefixes. Save 30–60% with provider-native caching.

tj optimize — cache
Cache opportunities in last 30d:  • Identical 2,400-token prefix detected across 94% of your calls    (your CLAUDE.md + tools + system prompt)  → You're already using prompt caching for 11% of cacheable opportunities.  → Increasing cache_control breakpoints could save ~$42/mo (90% reduction     on the 89% of calls currently paying full price).   • Semantic similarity ≥0.95 detected on 47 instances of "format SQL query"    style requests in last 30d.  → Estimated savings: $8/mo at TTL ≥ 1 day.
See how it works

Lens

See your spend, your recoverable waste, and your alerts at a glance, in a local browser dashboard.

127.0.0.1:7391/#/overview
OverviewLast 7d
Spend · last 7d$284.71
At this pace, ~$1,219 by end of June
(linear run-rate, not a forecast)
Estimated savings
Downsize
$42 / mo
Cache
$31 / mo
Reuse
$54 / mo
3 unread alerts·0 agents drifting
See how it works

The other twelve

Same install, same captured telemetry. Each one reads it for a different shape of waste.

All fifteen are in the open-source CLI. Install once, analyze everything.

Benchmark & Evaluate · the Prove beat

TokenJam Bench

A downsize candidate is a hypothesis. Bench runs the cheaper model against the original on real task suites and reports, per suite, whether accuracy holds. Pass rate with Wilson confidence intervals and a McNemar p-value, a hedged verdict, never a blanket "safe".

tjb
$ tjb run --suite humaneval,gsm8k --baseline opus --candidate haiku
  running 200 paired tasks per suite…
  humaneval · 200/200   gsm8k · 200/200
  humaneval REGRESSED   gsm8k HOLDS
  verdict → ./bench-report.json

TokenJam Bench · per-suite verdict

Pass rate · per suite
humaneval
71/89%regressed
gsm8k
94/95%holds
Run summary
200paired / suite
p≈0.000humaneval McNemar
1 / 2suites held
haiku vs opus · Wilson CI · measured, never "certified"

Open source. pip install tokenjam-bench.

Analyze. Optimize. Prove.

TokenJam Lens and TokenJam Bench bring all three — analyze, optimize, prove — into local dashboards you can explore.

Analyze

Capture the telemetry

TokenJam reads from wherever your agent telemetry already lives. On Claude Code or Codex, that's your local log files. If you run Langfuse, Helicone, LangSmith, or Phoenix for observability, it ingests from there. No observability tool? It captures OpenTelemetry directly, into a local store.

Optimize

Surface the savings

Fifteen analyzers, several grounded in published research and all validated against your own data, surface cheaper-model, prompt-trimming, and re-send candidates with explicit confidence levels. TokenJam never claims a smaller model would have produced an identical answer; it shows candidates with evidence and you act via tj optimize, MCP, or an exported routing config.

Evaluate · Prove

Prove a candidate holds

A candidate is a hypothesis, not a guarantee. TokenJam Bench runs the cheaper model against the original on real task suites and reports, per suite, whether accuracy holds: pass rate with Wilson confidence intervals and a McNemar p-value, a hedged verdict (holds or regressed). Measured, never "certified".

Also included

A full observability stack

Everything you'd expect from a tracing tool, running locally alongside the analyzers.

Real-time cost tracking

Every LLM call priced as it happens. Spend per agent, model, session, and tool, visible the moment it occurs.

Trace waterfalls

Full span tree per session. See exactly which tools ran, in what order, and how long each step took.

Sensitive-action alerts

13 alert types, 6 channels (ntfy, Discord, Telegram, webhook, file, stdout). Get pinged before damage is done.

Drift detection

Z-score baselines flag when your agent starts behaving differently. No LLM-on-LLM evaluation required.

Schema validation

Declare a JSON Schema for your tools or let TokenJam infer one. Violations are caught the instant they occur.

Local web UI & REST API

tj serve runs a dashboard at 127.0.0.1:7391. Prometheus metrics at /metrics. No cloud, no signup.

Install

Four commands. Local. No signup.

install
$ pipx install tokenjam$ tj onboard --claude-code$ tj optimize$ pip install tokenjam-bench
Star us on GitHub

Open source · MIT · runs 100% locally · no signup