⚡ Up to 54.1% quality-gated token savings

The transparent token-savings layer

Compression Caching Routing Alignment Pruning

A drop-in proxy that applies 28 optimisation techniques to every LLM call — sending fewer tokens for the same result, with a single line of code, no change to how your developers work, and quality preserved.

Already run an LLM gateway? Keep it — TokenLean sits in front of, or inside, the one you already have.

FewerTokens per call
1-lineIntegration
~84%On cached prefixes
Apache-2.0Open-source core
One line. Zero rewrites.

Point your OpenAI, Claude or Gemini client at TokenLean

TokenLean speaks the OpenAI, Anthropic (Claude Code) and Gemini APIs natively. Swap your base URL — your code, prompts, SDK and even tool-calls stay exactly the same. TokenLean optimises every request before forwarding it to any of 10 first-class providers.

  Before
client = OpenAI(
  api_key="sk-openai-..."
)
  After
client = OpenAI(
  api_key=os.environ["TOKENLEAN_KEY"],
  base_url=os.environ["TOKENLEAN_ENDPOINT"] + "/v1"
)  # that's it — fewer tokens, quality preserved
OpenAI SDK
/v1/chat/completions
Anthropic SDK · Claude Code
/v1/messages
Gemini SDK
:generateContent
How a request flows through TokenLean One base-URL swap · code unchanged · quality preserved Your app OpenAI · Anthropic Gemini SDK base_url = … 0 Native ingress any protocol → OpenAI shape, re-serialised back TokenLean optimisation pipeline 8 groups · 28 techniques ① Gate rate-limit · guardrails · PII cache read · route (3-tier) ② Request-side compress · RAG · tools prune · dedup · CCR ③ LLM-call params reasoning budget · format batch/TOON · loop budget ④ Cache alignment prefix-cache reorder up to ~84% on prefix LLM provider any OpenAI-compatible resilience layer breaker → retry → failover Response _token_opt per-call savings breakdown cache hit · G4 bypass → straight to response Trust & safety — runs first G30 injection · G29 PII · G31 context-trust two boundaries — the prompt, and what RAG injects Provider failover — always on circuit breaker · retry · fallback provider one upstream outage never drops the request Every call measured Langfuse traces · Grafana · Prometheus per-call → quarterly savings dashboards
Under the hood

8 optimisation groups, 28 techniques — with safety & resilience built in

TokenLean organises 28 techniques into 8 groups, layering a full pipeline of token-reduction strategies onto every call — each one measured, each one optional — and wraps every request in non-bypassable trust-&-safety and provider-failover layers. Because optimisation without measurement is guesswork.

Prompt compression

LLMLingua-2 strips redundant tokens from prompts while preserving meaning.

20–50% saved

Multi-level caching

Exact, semantic and response caches return answers without ever hitting the model.

30–80% saved

Smart model routing

A confidence-checked cascade sends easy calls to cheaper models, hard ones to bigger ones.

40–70% saved

Cache alignment

Reorders messages to hit provider prefix-caches — zero quality risk, large savings.

up to ~84%

Structured pruning & dedup

AST-aware compression of code, JSON and logs, plus collapsing of near-duplicate turns — structural savings that never touch your wording.

5–40% saved

Budget-aware context management

Compacts older history before a long conversation overflows the context window — prune, compress, then a cached summary. Recent turns are never touched.

20–60% on long threads

Batch lane & compact encoding

Compact encoding for structured payloads, plus an opt-in async lane claiming the provider's own 50% batch discount — for jobs that can wait.

25–60% saved

Adaptive reasoning budget

Classifies how hard each request is and sets reasoning effort to match — a simple question never pays for extended thinking.

10–30% saved

Real-time savings tracking

Every response carries line-item token & dollar savings — fully auditable ROI.

Total visibility

Two trust boundaries

Injection and PII scanned on the prompt — then again on whatever your RAG and memory inject. Non-bypassable, before any tokens are spent.

Non-bypassable · ×2

Provider failover

Circuit breaker + retry + fallback provider keep requests serving when an upstream degrades — before any bytes reach the client.

Always-on

Quality, measured

Retrieval hit-rate, grounding coverage and schema-validation tracked apart from savings — so "cheaper" never quietly becomes "worse".

Measured signals
See it in action

The whole story, in one live console

TokenLean isn't a black box. Every optimisation, every dollar and every guardrail event is visible to your team in a multi-tenant portal — from real-time savings to per-user chargeback and security you can audit.

🔒 Enterprise exclusive — this console ships with the managed Enterprise plan, not the free self-hosted version.

Every team sees exactly what they saved

Billed requests, tokens saved, dollars saved and average saving % — live, per tenant. Savings are disclosed estimates; you're only ever billed on request count.

tokenlean.cbeyond.cloud/portal
TokenLean portal — usage & savings dashboard with live token and cost savings

FinOps, built in

Month-to-date spend, a month-end projection, cost per request, savings ROI and cache hit-rate — with a daily tokens-saved trend. Your LLM unit economics, at a glance.

tokenlean.cbeyond.cloud/portal · observability
TokenLean portal — AI FinOps: spend, projection, cost per request, savings ROI, cache hit-rate

Chargeback-ready, down to the user

Break requests, tokens and cost down by user, model, provider or day. Hand finance a clean showback for every team and every bot — no spreadsheets required.

tokenlean.cbeyond.cloud/portal · usage
TokenLean portal — per-user token & cost explorer with requests-per-day chart

Tune every technique to your risk appetite

Toggle and dial each optimisation — compression aggressiveness, cache thresholds, routing confidence — and see changes apply within a minute. Savings vs. quality, on your terms.

tokenlean.cbeyond.cloud/portal · settings
TokenLean portal — optimisation settings for each G-group with tunable parameters

Your keys, your models, your spend cap

Bring your own provider keys (stored encrypted), pick per-tier models for the routing cascade, and set a hard monthly spend ceiling that stops runaway or leaked-key costs cold.

tokenlean.cbeyond.cloud/portal · models & keys
TokenLean portal — models & keys: BYOK provider keys, model preferences, monthly spend cap

Security you can actually watch

A per-day trust-&-safety trend plus a live incident log — every PII redaction (G29) and blocked injection (G30), by type and action. Metadata only; the matched content is never stored.

tokenlean.cbeyond.cloud/portal · trust & safety
TokenLean portal — Trust & Safety tab: per-day event trend and PII / injection incident log

Billing with nothing hidden

Six months of invoice history, billed purely on request count — with the value you saved shown right alongside, and never added to the bill.

tokenlean.cbeyond.cloud/portal · invoices
TokenLean portal — invoice history billed on request count with value-saved shown
Real screens from the TokenLean console · click any view to open it full-size
Proof, not promises

Every call reports exactly what it saved

  • Per-call and per-technique token-savings breakdown
  • Multi-tenant by default — per-team limits & config
  • Self-host or run managed — scales to near-zero when idle
  • Sits in front of, or inside, any existing LLM gateway
  • Claims the provider's own 50% batch discount on work that can run async — opt-in, never on live traffic
  • Credits the real cached-token discount into cost reporting, per provider — no inflated savings
  response._token_opt
{
  "baseline_tokens": 450,
  "final_tokens_sent": 220,
  "total_abs_saving": 230,
  "total_pct_saving": 51.1,
  "cache_hit": false,
  "routed_model": "gpt-4o-mini"
}
TokenLean savings dashboard — per-call token breakdown
tokenlean/img/dashboard.png Observability dashboard · savings metrics & per-technique breakdown
Recommended: 900 × 500 px
Proof you can run yourself

Don't take our word for it — run the A/B

Every request fires twice: once straight to the provider, once through TokenLean. We compare the provider's own billed usage — never our self-report — over recognised public datasets, on your key. Costs under a dollar.

54.1% Our internal headline Quality-gated live ablation on production-scale payloads (temperature-0; 50.8–55.8% observed across runs). Self-measured — a directional estimate, not an independent third-party benchmark.
~34% What you can reproduce publicly A disclosed illustrative-mix blend of the workloads below, at default balanced weights. It lands below our own headline by construction — and that's deliberately the honest point.
WorkloadPublic A/BReproduce with
cache · warm-repeat~90%--workload cache
agentic · tool loop~20%--workload agentic
prose · first-ask~8%--workload standard
reasoning~0%--workload standard
  examples/benchmark
# all workloads + the blend · OpenAI · <$1
./examples/benchmark/run.sh --ab --workload full

# 10-provider sweep
./examples/benchmark/run.sh --ab --providers all
What's measured — and what isn't. Datasets are pinned and used verbatim: HotpotQA, MT-Bench, SWE-bench Lite, HumanEval, GSM8K and BFCL. One additional ops profile of verbose DevOps payloads is production-shaped, not a recognised public benchmark, and is labelled as such in the repo. Agentic reads ~20% here against 46% internally because the largest lever structurally cannot fire in a live single-loop A/B — so we publish the lower number and show you why.
Already running a managed proxy? We can preview your savings against your live traffic — ask for a preview →
Pricing

Start free. Scale when you're ready.

Self-host the open-source core at no cost, or let us run it for you — fully managed and billed on request count, never on tokens, so every token you save stays yours.

Self-hosted

Free

Open-source · Apache-2.0 · $0
The complete engine, yours to run. Deploy on your own infrastructure and keep full control of your data, keys and spend — no vendor in the loop.
  • The full engine — never tier-gated
  • All 28 optimisation techniquesG0–G28: prompt compression, multi-level & semantic caching, model routing, prefix-cache alignment, structured pruning, context-budget compaction + 22 more. No optimisation is ever paywalled.
  • Up to 54.1% quality-gated savingsMeasured on a live-ablation harness, counting only datasets where answer quality held. Cost savings run ~70% on the same workloads (directional estimate).
  • One-line, drop-in integrationPoint your OpenAI, Anthropic (Claude Code) or Gemini SDK's base_url at the proxy — no prompt or code changes.
  • 10 providers + any OpenAI-compatibleOpenAI, Anthropic, Gemini, Azure, Bedrock, Mistral, Cohere, xAI, DeepSeek, Groq — plus any OpenAI-compatible API via config alone.
  • Production-grade, included
  • Trust & safety — non-bypassableG29 PII redaction, G30 injection guardrails and G31 context-trust (a 2nd boundary that scans what RAG/memory inject) — all run before any tokens are spent.
  • Provider failover & resilienceCircuit breaker + retry + per-tenant cooldown + failover to a fallback provider, so one upstream outage never drops a request.
  • 10 Grafana dashboards + savings trackingEvery response carries a _token_opt breakdown and x-tokenlean-* headers, feeding per-call to quarterly dashboards you own.
  • Multi-tenant by defaultPer-tenant Redis/Qdrant namespacing, rate limits and config overrides.
  • Intent-orchestration engineConfig-driven agent registry routes each request to the right downstream agent by intent — no routing code in your app.
  • Yours to run
  • Runs on your own infrastructureDeploy on GCP via Terraform or locally via Docker. Scales to zero — about $2/mo idle on Cloud Run. Your data and keys never leave your infra.
  • Community supportGitHub issues + full documentation.
View on GitHub →
Fully managed SaaS

Enterprise

Hosted & managed · billed per request, never on tokens
Everything in Free, run for you as a service. We host, scale, secure and operate TokenLean so your team captures the savings on day one — with zero infrastructure to build or maintain.
  • Run for you
  • Zero-ops, zero infrastructureWe deploy, patch and upgrade for you — no proxy to run, no on-call, no maintenance.
  • Elastic auto-scalingScales to zero when idle, bursts to peak instantly — you pay for savings delivered, not idle servers.
  • 99.9% SLA-backed reliabilityUptime commitment backed by circuit breakers, retries and automatic failover across 10 providers — plus per-model lockout that quarantines one degraded model while the provider's others keep serving.
  • Long conversations never hit the context wallWhen a prompt approaches the model's context window, the proxy compacts the older history for you — pruning repeated turns and stale tool output, compressing wording, then replacing the older span with a cached summary. Recent turns and system prompts are never touched, and a tool result is never separated from the call that produced it. Tune the trigger, target and every step per tenant from the portal — no config files, no redeploy. Off until you enable it.
  • Start on a real production free trialTrial the full optimisation pipeline for a set number of days or requests — whichever runs out first — with automatic 80/90% warnings, a clean cut-over to paid, and trial traffic never invoiced.
  • The console — Enterprise exclusive
  • Self-service portal & AI-FinOps dashboardsLive savings, month-end spend projections, cost-per-request, cache ROI and anomaly alerts.
  • Tune every optimisation from one dashboardEnable/disable and dial the savings-vs-quality knobs for every step from the portal — with trust & safety controls locked to your operators so security can't be switched off. Changes apply within ~60 seconds, no redeploy.
  • Self-optimising over timeA managed learning loop watches which optimisations stop paying off for your workloads and switches them off automatically — with a safety denylist so caching, routing and guardrails are never touched. Your savings improve on their own.
  • Chargeback & invoicing built inPer-user, per-model and per-provider cost rollups, one-click chargeback CSV, monthly invoices.
  • Spend caps & request quotasHard monthly USD ceilings and per-tenant quotas stop runaway usage or a leaked key cold.
  • Managed agents consoleDeclare and govern downstream agents from the portal — route each request to the right agent by intent, with an ML intent classifier and a full routing-decision audit.
  • Enterprise-grade security & ops
  • BYOK — encrypted key vaultYour provider keys stored encrypted (Cloud KMS-wrapped master key), instant cross-instance revocation, self-serve rotation.
  • Managed trust & safetyPII redaction and injection guardrails with a live incident log — plus a continuously updated red-team ruleset feed.
  • Managed alerting → Slack / PagerDuty / SIEMHMAC-signed, retried webhooks deliver spend-cap, budget, guardrail and PII events straight into Slack, PagerDuty or your SIEM.
  • Managed medical-NER (PHI)Opt-in healthcare recognisers — DEA / NPI / MRN / ICD-10 — layered on PII redaction for regulated medical workloads.
  • Immutable audit trail, SOC 2 evidence & GDPR toolingTamper-evident 365-day audit log; downloadable SOC 2 evidence pack; one-click data export and right-to-erasure.
  • Hard multi-tenant isolationPostgres row-level security, tenant-scoped caches and signed upload URLs — no tenant ever sees another's data.
  • Partnership
  • Dedicated support & onboardingPriority support and a success engineer to tune your pipeline and maximise realised savings.
New features arrive here first — and stay Enterprise-only. Upcoming capabilities such as SSO / RBAC and deeper compliance controls ship to the Enterprise tier exclusively.
Contact us for pricing →
Resources

See it, then read the story

A short walkthrough of the savings and how the proxy works, plus the deck that lays it out.

Early access · limited spots

Partner with us — before everyone else

We're opening TokenLean to a select group of early-access customers ahead of general availability. Come in now and you're not just a user — you're a founding partner shaping the product, on terms that reward you for it.

🚀 Founding-partner offer

A significant discount for coming in early

We're keeping the first cohort deliberately small so every partner gets real attention. In exchange for working with us to make TokenLean better, early-access customers lock in pricing — and access — that won't be offered again:

  • Founding-partner pricingA substantial, locked-in discount that rewards you for partnering with us early.
  • Free credits to startTrial it on your real workloads at minimum cost — credits cover your early usage.
  • Direct influence on the roadmapYour use case shapes what we build and prioritise next.
  • White-glove onboardingA direct line to the founders and hands-on help tuning your pipeline for maximum savings.