🍲 The cheapest token is the one you never spend

A local AI assistant that knows when not to use AI.

Runs on your own computer. Does the cheap, deterministic work with scripts β€” for free β€” and saves the model for what actually needs thinking.

Self-hosted β€” your machine Multi-LLM β€” Claude Β· GPT Β· Gemini Β· Groq Β· Ollama Β· any OpenAI-compatible Windows Β· macOS Β· Linux Reach it from browser Β· terminal Β· Telegram Β· Discord Apache-2.0
πŸ”’Privacy by design

Don't want an AI using your personal data?

TokenSoup redacts names, IDs, IBANs, cards and emails before anything is sent to a model.

The safest data is the data that never left your computer.

⚑0 tokens

Why pay a model to run git status?

Deterministic work runs as a local script β€” and reuses the scripts you already trust. No round trip, no cost.

The cheapest token is the one you never spend.

πŸ›‘οΈHuman in the loop

Nothing destructive happens without your yes.

Reject a command and it stays rejected β€” the model can't bypass you by switching tools or rewording the path.

You stay in control of your own machine.

🧠Multi-model teams

One task, the right model for each part.

A coordinator splits the work across parallel agents β€” frontier to plan, cheap or local models for the legwork.

Orchestrate many models, not just pick one.

πŸ”—Over MCP Β· beta

Works with your other tools.

Any MCP client β€” Claude Code, Cursor, Cline β€” can call TokenSoup's tools; TokenSoup can use other MCP servers too.

A good neighbor in your toolchain.

The point

Deterministic work and scripts you already trust shouldn't cost a single token.

Most cloud agents answer β€œgit status” or β€œis this valid JSON” by shipping your context to a model and paying for the round trip. TokenSoup recognizes those, runs a local routine instead, and only reaches for a model β€” the right-sized one β€” when the task genuinely needs reasoning. It runs on your machine, redacts personal data before anything leaves it, and asks before doing anything destructive.

What it is

A finished, self-hosted assistant you launch with a double-click and talk to in your browser, terminal, or a chat app. One API key to start. Built for a computer-comfortable person, not just developers.

What it isn't

Not a developer library you import into your code, and not trying to compete with those. Those are toolkits for engineers building agent systems. TokenSoup is the finished assistant itself.

How it saves tokens

A few ideas, one principle.

Spend nothing where nothing needs spending; spend modestly where a small model suffices; spend fully only on the hard parts.

⚑

Indie Agents

0 tokens

Deterministic tasks β€” git status, file counts, JSON checks, format checks β€” run as built-in indie scripts, not model calls. The smart router recognizes them and runs the local routine automatically. The assistant can also author a new reusable script when it meets a repeatable task β€” shown to you for approval before anything is saved.

🧩

Reuse what works

your scripts, 0 tokens

Already have battle-tested glue in Bash, PowerShell, Python, or Node β€” or a compiled binary? Register it as an indie agent and TokenSoup calls it directly instead of re-implementing, and re-paying for, the same logic in an LLM. Your legacy automation becomes part of the assistant.

🎯

Smart Router

right-sized model

When a model is needed, the router classifies the task and routes it: simple text to a cheap/fast model, standard work to a mid model, heavy work to a frontier model. A semantic cache returns repeated answers with no new call.

πŸ—ΊοΈ

SoupGraph

codebase map, 0 tokens

An AST knowledge graph of your code, built locally with no model calls. Ask about your codebase and TokenSoup feeds the model the exact symbols and file locations instead of dumping whole files β€” far fewer tokens. Build it with one click in the web UI (or /project map); once built, relevant context is added automatically. It can auto-refresh itself after edits (opt-in, incremental, in the background).

πŸ“š

Skills

loaded only when relevant

Short instruction sets β€” testing, git, security, and your own β€” are injected into the prompt only when a message is actually relevant to them, never all at once. Add, remove, and toggle each one from the web UI; a disabled skill is never detected or injected, so it costs nothing.

βœ‚οΈ

Context narrowing

skeleton, not whole files

For large code files, TokenSoup sends a structural skeleton β€” imports and function/class signatures with line numbers β€” instead of the whole file, and the assistant asks for exact line ranges when it needs the body. A Full / Balanced / Lean switch tunes how aggressive this is, and the UI shows how many tokens it saved.

ScenarioTypical baselineWith TokenSoup
Git operations~500 tok / query0 tok Β· indie
Repeated queries~1000 tok0 tok Β· cache
Simple tasks~800 tok Β· large model~200 tok Β· small model
Email triage~2000 tok / email~200 tok Β· small model
Large code file read~36k tok Β· whole fileskeleton + ranges
⚠️ The table figures are illustrative; the end-to-end result is measured. A reproducible benchmark suite ships in benchmark/: the deterministic mechanisms β€” skeletons, skill gating, SoupGraph context β€” are measured directly (run python3 benchmark/suites/run_all.py), and an end-to-end token/cost A/B against a direct frontier-model call is runnable with an API key (benchmark/suites/bench_e2e.py) β€” it shows ~59% lower dollar cost with accuracy preserved. Each test also checks correctness, since saved tokens only count if the answer is still right.
Security-first

An assistant on your machine shouldn't be able to quietly do harm.

Safety is layered, on the assumption that a tool which can run commands needs guardrails β€” not blind trust. This security work is complete and shipped in v1.0, validated by an end-to-end benchmark. See SECURITY.md for the honest trust model & limits.

0

PII Redaction

Emails, IDs, IBANs, phone numbers replaced with placeholders before anything is sent to a model.

1

Injection Scan

User messages checked for prompt-injection patterns.

2

External Content Guard

Web and file content passes the same guard before it can influence the model.

3

Canary Tokens

Secret markers in context detect exfiltration attempts.

4Β·5

Response Validation

The final response is scanned before it's shown to you.

πŸ”

Encrypted KeyVault

API keys encrypted at rest (AES-256-GCM); localhost-only by default.

HITL β€” Human-in-the-Loop Path Guard

Dangerous operations require your explicit approval. Reject a file operation and that path is protected against every tool β€” bash, write_file, edit_file, python -c, shell redirects β€” for the rest of the turn. The model can't bypass your rejection by switching tools or rewording the path, and an already-rejected command won't re-prompt until you ask for it again yourself. Destructive writes that would clobber an existing file require confirmation.

Trust model & honest limits

TokenSoup assumes a single trusted operator per instance. Everything the agent reads from the outside β€” web pages, files, messages β€” is treated as untrusted. It is not a hostile-multi-tenant boundary: to run code for mutually distrusting users, isolate at the infrastructure level (separate instances, credentials, and ideally hosts or VMs).

The layers above reduce risk and limit blast radius β€” they do not make it zero. OS-level isolation (bubblewrap / WSL2 / containers, Enterprise) shares the host kernel and is not a hypervisor; the soft folder sandbox is a parser and can be defeated by obfuscation; prompt injection can attempt to hijack the agent. Channels deny by default until you set their allowlist or pair a user in (or deliberately open them), and an optional audited break-glass can run a command unsandboxed β€” but only for the owner (solo) or an RBAC tools.elevated role (Enterprise), never a paired guest. For adversarial, multi-tenant, or regulated workloads, run TokenSoup inside a dedicated VM and treat these as an inner layer, not the boundary.

Provided under Apache-2.0, β€œAS IS”, without warranty; this is not legal advice. Full details: SECURITY.md.

Under the hood

How a request flows.

Unlike a gateway that fans messages out to channels, TokenSoup sends every request down through layers β€” one engine applies redaction, caching, and routing, then branches to a free local script or a right-sized model, with your approval guarding anything destructive.

Web UI Β· CLI Β· Bots Query Engine single point every request flows through 1 Β· PII redaction strips data before it leaves 2 Β· Semantic cache repeat answers, 0 tokens 3 Β· Smart router classifies the task, picks the cheapest path Indie agents deterministic Β· 0 tokens Model provider right-sized tier when needed + SoupGraph context Β· file skeletons HITL approval gate you approve anything destructive cache hit Β· skips everything Response to you

Works with your other tools β€” over MCP beta

TokenSoup speaks the Model Context Protocol in both directions: any MCP client (Claude Code, Cursor, Cline, …) can call TokenSoup's tools, and TokenSoup can call out to other MCP servers.

MCP clients Claude Code Β· Cursor Cline Β· any MCP client TokenSoup MCP server + MCP client Other MCP servers their tools, used by TokenSoup calls Exposed tools media gen Β· analyze image Β· run-with-model (other LLMs) Β· indie agents Β· flows

Polyglot β€” port a slow function to a faster language alpha

A separate, experimental layer: hand it a slow Python function and it benchmarks, proposes a port to Rust/C/Go/COBOL, waits for your approval, compiles, and verifies the result matches. Registering the artifact as an indie agent is a deliberate second step.

Slow Python benchmark baseline Propose port Rust Β· C Β· Go Β· COBOL You approve HITL gate Compile Β· verify same result? Register as indie reuse it Β· 0 tokens manual second step Experimental / alpha β€” proof of concept, not production-ready

Multi-model orchestration β€” teams of agents

A coordinator breaks a complex task into subtasks and runs workers in parallel β€” and each agent can run a different model, including a local one. Use a frontier model to plan, cheap or local models for the legwork, a strong model to synthesize.

Complex task Coordinator plans & splits Β· any model Worker Β· cheap model parallel Worker Β· local model parallel Β· 0 API cost Worker Β· frontier parallel Synthesizer β†’ answer

And there's more under the hood β€” durable multi-step flows that survive a session restart, an autonomous agent mode, scheduled cron tasks, batch processing, a semantic cache, and per-agent security profiles. TokenSoup is built to bend to how you work, not the other way around.

Get started

Install & run.

First run installs dependencies, asks for one API key, and opens the web UI at http://localhost:7070.

πŸ‘† Easiest: open the tokensoup folder and double-click TokenSoup.bat (or TokenSoup-PS.cmd) β€” that's it.
…or from a terminal:
# From the extracted folder
> cd path\to\tokensoup
> python soup.py
Linux
$ cd tokensoup
$ bash install.sh        # or: python3 soup.py
macOS β€” creates ~/Applications/TokenSoup.app
$ cd tokensoup
$ bash install.sh        # or: python3 soup.py
FlagWhat it does
python soup.pyWeb UI at localhost:7070 (default)
--cliTerminal chat instead of the web UI
--resetRe-enter API keys
--checkCheck installation state
--lang en | srForce English or Serbian
--port 8080Custom port
Reference

Every command.

All commands are typed directly in chat. Arguments in [brackets] are optional. Full reference also lives in COMMANDS.md.

No commands match that filter.

πŸ’¬ Sessions

/new [name]New session /sessionsList all sessions /statusSession status β€” tokens, model, cost /contextContext window details /clearClear conversation history /compactCompress context /memoryShow MEMORY.md /resume [name]Resume previous session

πŸ€– Model

/model <name>Switch model /modelsList available models /lang <code>Interface language

βš™οΈ Configuration

/config get <key>Read setting /config set <key> <val>Set value /config listAll settings /security statusSecurity layer overview /security pii on|offPII redaction /security set <name>Security profile (full/standard/minimal/monitor/off) /vault set <key> <val>Store encrypted value /vault get <key>Get encrypted value

πŸ”‘ API Keys

/config key <provider> <key>Set/update an API key /doctorDiagnostic β€” checks keys & providers web UI Β· SettingsManage keys in the interface

πŸš€ Agent Mode

/agent <task>Run autonomous agent /agent stopStop agent /agent statusAgent status /agent sandbox on|offSandbox isolation /agent capabilitiesAllowed tools /hitl on|offRequire approval before each step /hitl strictApproval for ALL bash commands /hitl trust <category> [session|always|never]Trust policy for a risky-op category /hitl memory [clear]Show/clear remembered trust decisions /approveApprove pending step /observe on|offMonitor agent activity /router statusSmart router status /router set <tier> <model>Model for a tier /si <task>Self-improve agent

⚑ Indie Agents · 0 tokens

Local scripts that run without API calls.

/indie listAll registered agents /indie run <name> [args]Run an agent /indie new <name>Create template /indie register <name> <path>Register a script /indie create "<desc>"LLM generates + registers /indie remove <name>Remove agent /indie info <name>Agent details
Built-in agents
git_statusgit_diffgit_loggit_commitfile_statsfile_findjson_validatejson_formatsystem_infodisk_usageweb_scrapesession_summarysoupgraph_query

πŸ“Š Semantic Cache

/cache on|offToggle semantic cache /cache statusHit rate and stats /cache semanticSemantic matching mode /cache exactExact-match mode only /cache modelShow/set embedding model /cache installInstall sentence-transformers (once) /cache threshold <0-1>Similarity threshold (default 0.85) /cache ttl <sec>Entry time-to-live /cache refreshRe-embed cached entries /cache flushClear cache

πŸ“‹ Batch Processing

Batch API costs 50% less; results within 24h.

/batch create <name>New batch job /batch add <name> <prompt>Add item /batch run <name>Submit /batch status <id>Check status /batch results <id>Get results

πŸ‘₯ Teams (Multi-Agent)

/team create <name>Create team /team add <team> <agent>Add agent /team run <name> <task>Run team task /team status <name>Team status /team listAll teams /economy on|offEconomy mode β€” minimize cost /budget set <type> <amt>Spend limits (session/daily/tokens) /ratelimit set <provider> …Per-provider rate limits

πŸ’Ό Flows (Durable Tasks)

/flow start <name>Start flow /flow listActive flows /flow resume <id>Resume paused flow /flow stop <id>Stop flow /goal <desc>Autonomous run toward a goal /cron listSchedule recurring jobs /notifyNotification channels /changelogShow recent changelog

πŸ“§ Email & Content Β· optional

/email triageTriage inbox /email draft <to> <subject>Draft email /email send <id>Send drafted email /email configEmail settings /generate <image|video|audio> <model> <prompt>Generate media /marketing <topic>Marketing content pipeline /mediaList media generations

πŸ—ΊοΈ SoupGraph

/project mapBuild AST knowledge graph (0 tokens) /project map <query>Search codebase /project loadLoad project context (uses graph) /indie soupgraph_query <query>Search via indie agent

πŸ“š Skills

/skillsList available skills /skill <name>Show a skill web UI Β· Agents β†’ SkillsAdd, remove, enable/disable

πŸ”§ Development

/commitStage & commit with an AI message /diffShow working-tree diff /reviewAI review of current changes /prDraft a pull request from commits /verify on|offVerify model output (read or execute) /improve <task>Propose & apply code improvements /effort low|medium|maxReasoning effort (cost knob) /ultraplan <task>Deep multi-step planning session /auditSecurity audit + history /tasksProject task/TODO manager /polyglot scanPerf layer β€” compiler scan & optimize /project initInitialize project

πŸ”— MCP beta

/mcp connect <url>Connect MCP server /mcp listConnected servers /mcp toolsAvailable MCP tools /mcp disconnect <id>Disconnect server

πŸ’‘ Other

/search <query>Web search /fetch <url>Fetch URL content /saveSave session (memory + snapshot) /dreamConsolidate session memory now /voiceVoice mode /vimVim input mode /doctorFull diagnostic check /help [command]List commands / command help /costToken cost summary /exportExport session to Markdown /versionTokenSoup version
Who it's for

Made for people, not just terminals.

πŸ§‘β€πŸ’»

Computer-comfortable, not a coder

You want a capable assistant you launch with a double-click and talk to in a browser β€” not a CLI tool that assumes you live in a terminal.

πŸ”’

Privacy-minded

You want the assistant on your own machine, with personal data redacted before anything leaves it, and a clear say over destructive actions.

🏒

Small teams Enterprise Β· in development

One self-hosted helper for everyday work. An Enterprise module (in development) will add team features, stronger controls, auditable oversight, and the option of a fully local model behind your firewall β€” all on the same core engine.

Project status & honesty

  • The HITL security path is well-tested β€” path guard, repeated-rejection blocking, .NET/alias-aware destructive-command detection, and destructive-write detection all have dedicated coverage.
  • The token-savings numbers are now measured, not just estimated: an end-to-end A/B (same context, model-locked vs auto router, accuracy checked) shows ~59% lower dollar cost with accuracy preserved. Reproduce with benchmark/suites/bench_e2e.py.
  • Some areas remain opt-in or post-v1.0: the LLM query classifier (off by default for privacy), the semantic-cache embedding model (install to match paraphrases; exact-match works without it), and a self-trained micro-model classifier.
  • The security model has not yet had an independent third-party audit. For high-stakes deployments, commission one before relying on it.