Skip to main content
TokenSaver

The control plane CLI for AI coding agents

Route Claude Code, Cursor, and Codex through TokenSaver — Zero Trust governance, MCP tools, and Flux IA observability on every run.

Free signup · 15 free models · 600+ model catalog (Pro) · stdlib-only · MCP + Trust Gateway · Python ≥ 3.10

GitHub Stars PyPI Downloads Python 3.10+ License: MIT CI

Website Platform Connect guide Platform Docs SDK

Get started (60s) · Connect (CLI · API · MCP) · What you get · Agent graph · Control plane · Architecture · Agents · Docs · llms.txt


See TokenSaver in action

CLI → Claude Code

TokenSaver CLI routing Claude Code


Install → loginroute claude --launch

Agentic graph

Multi-agent handoffs traced in Flux IA


Agent-to-agent handoffs in Flux IA

Sign up / Log in · Flux IA · Agentic graph · Observability guide


Most coding agents talk to LLM providers directly: no shared audit trail, no inline PII guard, no org-wide FinOps — and every teammate wires MCP by hand.

TokenSaver CLI is the open-source on-ramp to the TokenSaver control plane: one command routes your agent through governed pipelines (cache, compression, RAG, PII, quotas) with full observability in the console.

Platform governance, not a local-only proxy. Policies, RBAC, Agent Registry, and Flux IA live on platform.tokensaver.fr. The CLI configures your laptop; the platform enforces and traces every call.

The CLI is one way in. Same control plane via OpenAI/Anthropic-compatible APIs, Python SDK / REST, MCP tools, or Trust Gateway — see Connect to the control plane (mirrors console Docs → Build / Connect).

Who it's for:

  • Developers shipping with Claude Code, Cursor, or Codex who want governance + observability without rewriting agent code
  • Platform teams standardizing how agents connect to LLMs (OpenAI-compatible + Anthropic-compatible APIs, MCP tools, Trust Gateway)
  • FinOps / security stakeholders who need PII filtering, quotas, and auditable runs — not just cheaper tokens
  • Free-plan explorerstokensaver login creates a workspace and API key in under a minute

Quick Start · Why TokenSaver · Command reference · Contributing


What you get

  • 600+ models (Pro/BYOK) — full Agent Registry; Free plan includes 15 hosted models (GLM, DeepSeek, GPT-OSS, Llama, …) with no provider API key → models & Free plan
  • tokensaver route claude --launch — Claude settings, MCP tools (mcp.tokensaver.fr), Trust Gateway (gateway.tokensaver.fr), and the tokensaver-router plugin in one shot
  • Governed pipelines — cache, compression, PII, RAG, and quotas follow your API key policies (runtime governance, not hard-coded in the CLI)
  • Flux IAtokensaver flows lists recent runs; tokensaver flows --open jumps to the console dashboard
  • Agent Registrytokensaver approve / tokensaver use for zero-trust model catalog (fixes 403 on quarantined models)
  • MCP slash commands/tokensaver-router:quota, :flows, :cache, :models, … inside Claude Code
  • Clean undotokensaver unroute claude restores backed-up config files
  • Zero runtime deps — stdlib only; pip install tokensaver-cli and go

Companion library: tokensaver-sdk for POST /pipelines/run, chat sessions, and programmatic API access.


Why TokenSaver

Direct provider API Local proxy only TokenSaver CLI
Setup Per-provider keys Manual env / config login + route claude
Governance Provider defaults Local rules Platform policies + RBAC
PII / audit DIY Varies Inline pipeline + traces
Observability Provider dashboard Local logs Flux IA end-to-end
MCP Wire yourself Partial Tools + Gateway pre-wired
FinOps Per-account billing None Quotas, budgets, run detail
Model catalog Open access N/A Agent Registry (zero-trust)

TokenSaver adds a hosted trust layer (governance, registry, observability) while keeping the OSS CLI free and MIT-licensed.


Connect to the control plane

This repository ships the CLI on-ramp. Every path below hits the same SaaS control plane (governance + Flux IA):

Path When to use Entry point
CLI Claude Code / Cursor / Codex on your machine tokensaver route …
LLM egress OpenAI- or Anthropic-shaped SDKs, n8n, LangChain, LibreChat… api.tokensaver.fr/openai/v1 or …/anthropic + ts_…
Python SDK / REST Apps, RAG, sessions, policies api.tokensaver.fr/api/v1 · tokensaver-sdk
MCP tools Platform tools inside an agent host mcp.tokensaver.fr/mcp
Trust Gateway Govern third-party MCP servers gateway.tokensaver.fr/mcp

Deep dive (OSS): docs/connect-control-plane.md — matrix, recipes, “do not confuse egress vs MCP vs A2A”.
Product Docs: platform.tokensaver.fr → sidebar DocsBuild (choose a path) · Connect (n8n, LangChain, Cowork, …)

# Same control plane without routing an IDE — OpenAI-shaped client
export OPENAI_BASE_URL=https://api.tokensaver.fr/openai/v1
export OPENAI_API_KEY=ts_…
./examples/04-llm-egress.sh    # optional auth check + Flux IA reminder

Architecture

 Claude Code · Cursor · Codex · LangChain · n8n · MCP host · your app
        │           │              │             │
        │ CLI       │ LLM egress   │ SDK/REST    │ MCP A / Gateway
        └───────────┴──────────────┴─────────────┘
                              │
                              ▼
 ┌─────────────────────────────────────────────────────────┐
 │  TokenSaver control plane  (SaaS · EU-ready)            │
 │  Cache → RAG → Compression → PII → LLM → Audit          │
 │  Agent Registry · FinOps · Flux IA                      │
 └─────────────────────────────────────────────────────────┘
        │
        ▼
 LLM providers  (OpenRouter · Anthropic · OpenAI · Mistral · …)

 Optional local helper (this repo):
   tokensaver CLI  →  writes settings / MCP / env for Claude · Cursor · Codex

SaaS endpoints (default after tokensaver login):

Surface URL
Control plane (console) platform.tokensaver.frsign up · log in
API api.tokensaver.fr
MCP tools mcp.tokensaver.fr/mcp
Trust Gateway gateway.tokensaver.fr/mcp
Flux IA (live pipeline runs) platform.tokensaver.fr/en/{workspaceId}/dashboard?tab=flows — or tokensaver flows --open
Agentic graph (multi-agent audit) platform.tokensaver.fr/en/{workspaceId}/execution-graph?period=7d

Typical pipeline savings on the platform: ~45% fewer tokens (cache + compression + routing) — see tokensaver.fr.


Control plane & live observability

The CLI routes traffic; the TokenSaver control plane shows every governed run in real time.

Goal How
Create account / log in platform.tokensaver.fr/en/signup or …/en/login — same email as tokensaver login
Flux IA — pipeline steps, cache, PII, LLM, MCP After tokensaver login: tokensaver flows --open (opens your workspace Flux IA tab)
Agentic graph — agent-to-agent handoffs, tool runs, audit trail Console sidebar → Agentic graph, or https://platform.tokensaver.fr/en/{workspaceId}/execution-graph?period=7d
Latest run deep link tokensaver flows prints the URL with flowId=… when a recent run exists
tokensaver login              # saves ts_… key + workspace_id locally
tokensaver route claude --launch
# send a message in Claude Code, then:
tokensaver flows --open       # Flux IA in the browser (real-time)
tokensaver whoami             # email, plan, workspace id

Use the same email in the browser as tokensaver whoami. In the console sidebar: Flux IA for step-by-step runs, Agentic graph for the multi-agent canvas (as in the demo above).

Docs: Observability (this repo) · Product overview · Console


Get started (60 seconds)

# 1 — Install (stdlib only)
pip install -U tokensaver-cli

# 2 — Free signup or sign-in → ts_… key saved locally
tokensaver login

# 3 — Route Claude Code and launch
tokensaver route claude --launch

# 4 — Verify + open Flux IA
tokensaver doctor --claude
tokensaver flows --open

Credentials: ~/.config/tokensaver/credentials.json (0600).
TOKENSAVER_API_KEY overrides the file when set.

Self-host: append --local on commands (API :8000, MCP :8787/mcp, gateway :8788/mcp).


Agent compatibility

Agent tokensaver route Notes
Claude Code --launch Full: settings + MCP + plugin + optional --with-fs
Cursor Writes .cursor/mcp.json + Override URL steps
OpenAI Codex --launch Exports OPENAI_BASE_URL + key
Generic proxy route proxy Prints env for any OpenAI-compatible client
MCP only route mcp Tools + gateway entries without agent launch

Claude Code flags: --scope user|project|local · --profile cheap|default|strong · --model provider/model · --with-fs · --no-plugin · --local

Undo: tokensaver unroute <claude|cursor|codex|proxy|mcp>


When to use · When to skip

Great fit if you…

  • run Claude Code / Cursor daily and want one command to wire MCP + governance
  • need Flux IA traces (tool calls, cache, PII steps) without building observability yourself
  • want Free-tier exploration with a real control plane, not just a API key passthrough

Skip if you…

  • need 100% offline / air-gapped with no SaaS (use --local self-host)
  • only want local token compression with no platform
  • cannot send prompts through a governed API (strict data residency without self-host)

Command map

Auth           login · logout · whoami · keys list|create|revoke
Models         models · use · profiles · approve · catalog
Observability  flows · status
Route          route <claude|cursor|codex|proxy|mcp> · unroute …
Health         doctor [--claude] [--local]
Auth & keys
Command Purpose
tokensaver login Interactive signup / sign-in
tokensaver login --email you@acme.com --signup -y Non-interactive signup
tokensaver login --key ts_… Import existing key
tokensaver login --local Self-host (localhost:8000)
tokensaver logout Remove local credentials
tokensaver whoami Email, plan, key prefix, Flux IA link
tokensaver keys list List API keys (JWT required)
tokensaver keys create --name CLI --use Create + set default key
tokensaver keys revoke <id> Revoke a key
Models & Agent Registry
Command Purpose
tokensaver models Profiles + plan-filtered catalogue (15 on Free, 600+ on Pro)
tokensaver use <cheap|default|strong|provider/model> Sticky model + approve + rewrite settings
tokensaver approve [--current] Approve model in registry (zero-trust 403 fix)
tokensaver catalog list|pending|approve <ref> Registry admin

Free plan: 15 hosted OpenRouter models — see docs/models-and-free-plan.md. Default profile → openrouter/openai/gpt-oss-20b. Override: TOKENSAVER_PLAN=free.

Claude plugin slash commands

Installed by route claude → skill tokensaver-router:

Slash Action
/tokensaver-router:welcome Orientation + console link
/tokensaver-router:models List models + profiles
/tokensaver-router:use Switch sticky model
/tokensaver-router:flows Flux IA + recent runs (tokensaver flows)
/tokensaver-router:quota Usage (tokensaver quota)
/tokensaver-router:cache Cache stats (MCP)
/tokensaver-router:doctor Health checks
/tokensaver-router:help Full slash catalogue
Environment variables
export TOKENSAVER_API_KEY=ts_…
export TOKENSAVER_MODE=local          # or --local on commands
export TOKENSAVER_API_URL=http://localhost:8000
export TOKENSAVER_MCP_URL=http://localhost:8787/mcp
export TOKENSAVER_GATEWAY_URL=http://localhost:8788/mcp
# Optional override — otherwise local mode reads CONSOLE_BASE_URL or apps/console/.env.local PORT
export TOKENSAVER_CONSOLE_URL=http://localhost:7337
export TOKENSAVER_NO_BANNER=1         # hide ASCII banner on CLI start

Documentation

In this repo Related
docs/connect-control-plane.md Console Docs → Build / Connect
docs/quickstart.md Product · Console / Flux IA
docs/models-and-free-plan.md PyPI tokensaver-cli
docs/claude-code.md Anthropic Claude Code
docs/open-models-glm.md GLM 4.7 Flash — optional open model on Free
examples/ PyPI tokensaver-sdk
docs/README.md Console · Product

Examples (shell):

./examples/01-login-and-route.sh      # SaaS login + route
./examples/02-local-selfhost.sh       # localhost stack
./examples/03-glm-open-model.sh       # Free plan + GLM 4.7 Flash
./examples/04-llm-egress.sh           # OpenAI-compatible egress (no IDE route)
LAUNCH_CLAUDE=1 ./examples/03-glm-open-model.sh   # also launch claude

AI agents / LLMs: read llms.txt in this repo for a compact index.


TokenSaver for teams

The OSS CLI is built for individual developers: install, login, route your agent in minutes — free and MIT-licensed.

Running org-wide governance, SSO, centralized policies, and fleet FinOps across every team is what platform.tokensaver.fr and tokensaver.fr enterprise plans are for.

Request a demo · Early Adopter program


Contributing

Issues and stars welcome on this repo. Source of truth for releases is the private monorepo; this repository is a public mirror synced via scripts/sync-oss-cli.sh.

Releases: push packages/cli to main → CI auto-bumps patch (if needed), syncs the mirror, creates GitHub Release + PyPI. No manual version step.

See CONTRIBUTING.md · SECURITY.md · CHANGELOG.md

git clone https://github.com/tokensaver-ai/tokensaver-cli.git
cd tokensaver-cli
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]" && pytest -q

License

MIT — see LICENSE.


Release files for tokensaver-cli 0.3.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tokensaver-cli 0.3.24
File Size Uploaded
tokensaver_cli-0.3.24.tar.gz 76.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tokensaver-cli 0.3.24
File Interpreter ABI Platform
tokensaver_cli-0.3.24-py3-none-any.whl Python 3 none any Details

Total release size: 153.3 kB

Release files / tokensaver_cli-0.3.24.tar.gz

Download URL tokensaver_cli-0.3.24.tar.gz
Size 76.4 kB
Tags Source
SHA-256 checksum
How to use checksums
90e1d8a5501160d3f01b57b2b0b2d432e60e29cde68ea47bbbdcb834f10a0802
BLAKE2b-256 checksum
How to use checksums
91c367e6af46f77017efe69eaa0d44a35ef456ebbca99dded9d02710dd6e1c02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / tokensaver_cli-0.3.24-py3-none-any.whl

Download URL tokensaver_cli-0.3.24-py3-none-any.whl
Size 76.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da4f83f3a9012776d8c15c9771486676cc0e7033fd8a7457102f3a555cd28b43
BLAKE2b-256 checksum
How to use checksums
a53a2702c414bb12c4375142da07d7a305eb623e3b3dda9f6eade9a63a152e3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

0.3.41

2 release files

0.3.40

2 release files

0.3.39

2 release files

0.3.38

2 release files

0.3.37

2 release files

0.3.36

2 release files

0.3.35

2 release files

0.3.34

2 release files

0.3.33

2 release files

0.3.32

2 release files

0.3.31

2 release files

0.3.30

2 release files

0.3.29

2 release files

0.3.28

2 release files

0.3.27

2 release files

0.3.26

2 release files

0.3.25

2 release files

This release

0.3.24 This release

2 release files

0.3.23

2 release files

0.3.22

2 release files

0.3.21

2 release files

0.3.20

2 release files

0.3.19

2 release files

0.3.18

2 release files

0.3.17

2 release files

0.3.16

2 release files

0.3.15

2 release files

0.3.13

2 release files

0.3.12

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page