Main product · Free · 100% local · Apache-2.0
Prompt Router
Prompt Router is the flagship product of TokenCalc AI: a local preflight layer that reads a prompt before it reaches an AI agent, estimates the work, and recommends where the task should run. Nothing is uploaded, the CLI makes no network calls, and routing writes no state.
What does Prompt Router decide before an AI model call?
Prompt Router reads a prompt locally and reports five things before a provider call: a token and cost estimate, the task type, the best agent, a model route with an alternate and an open-weight option, and the estimated savings versus the model you were about to use.
Expand the details
- No uploads: The CLI performs zero network calls; raw prompts, context, responses, and credentials never leave your machine.
- No state for route: The routing command writes nothing to disk, so you can preflight a prompt without creating a local log.
- Any AI agent: Plain Node.js with no dependencies. Any agent that can run a local command can use the CLI; OpenCode catalog support is optional.
- Local pricing: Cost estimates use local catalog data, so the recommendation works offline.
What Prompt Router decides
Before a provider call, the route command prints a short summary or a complete JSON object with --json. Each decision is a starting point, not a hard clamp: you can keep the current model, ask your agent to switch, or add caps with policy.
- Token and cost estimate. Approximate input tokens, output tokens, total tokens, and the likely cost on the model you are about to call.
- Task type. Classifies the request as code, research, reasoning, creative, simple, long-context, tool-heavy, or mixed.
- Best agent. Suggests a code-agent, research-agent, reasoning-agent, writing-agent, local-agent, or general-agent for the job.
- Model route. Returns a best choice, an alternate, and an open-weight option, each with a plain-language reason.
- Estimated savings. Shows the difference between your current model and the recommended route so you can decide whether to switch.
Routing rules by task type
The route table maps task signals to an agent type and three model families. Simple extraction work favours local weights, code and long-form work can move to Claude, research and large-context tasks lean on Gemini, and general agent work can stay on GPT.
| Task signal | Agent | Preferred | Alternate | Open weight |
|---|---|---|---|---|
| Summarize, list, rewrite, translate, extract | local-agent | Qwen 2.5 72B | Gemini 3.8 Flash | Qwen 2.5 72B |
| Implement, refactor, debug, test suite | code-agent | Claude Sonnet 5.5 | GPT-6.1 Sol | Qwen 2.5 72B |
| Research, audit, citations, source comparison | research-agent | Gemini 4 Neon | Claude Opus 5.5 | DeepSeek Flash |
| Math, proof, statistics, reasoning puzzle | reasoning-agent | Gemini 4 Neon | GPT-6 Astra | DeepSeek V4 Pro |
| Brainstorm, story, marketing copy, script | writing-agent | Claude Sonnet 5.5 | GPT-6.1 Sol | Mistral Large 2 |
| Three or more planned tool calls | code-agent | GPT-6.1 Sol | Claude Sonnet 5.5 | Qwen 2.5 72B |
| More than 20,000 context tokens | research-agent | Gemini 4 Neon | Claude Opus 5.5 | DeepSeek Flash |
| Mixed or unclear request | general-agent | GPT-6.1 Sol | Gemini 4 Neon | Qwen 2.5 72B |
Route, gate, call, finish, report
- Route. Run route before any non-trivial model call. Read the estimate, task type, and reason; keep your current model if you disagree.
- Gate. Run gate to trim duplicate or oversized context, cap output, and produce a forward payload for the agent you already use.
- Call. Send the payload to your existing model or API. TokenCalc AI does not proxy the provider and never holds your credentials.
- Finish. Record the real outcome, tokens, tools, files, tests, commits, retries, and verification steps locally.
- Report. Review local savings, spend, waste, and contribution scores to find the next routing improvement.
node agent-battery-saver/scripts/agent-saver.mjs route \
--prompt-file ./prompt.txt \
--context-file ./context.txt \
--model gpt-6-astra \
--tool edit_file --tool run_testsInstall Prompt Router locally
Download the bundle from the latest public GitHub release or use a one-line installer. The install directory stays agent-battery-saver/ for compatibility. Set PROMPT_ROUTER_SKILLS_DIR (or OPENCODE_SKILLS_DIR) to install it wherever your agent loads skills; the default remains ~/.config/opencode/skills. Then give the instruction below to any agent that can run a local command. OpenCode catalog support is optional.
- Any agent: load
agent-battery-saver/SKILL.mdas a skill, add it to your system prompt orAGENTS.md, or call the CLI by its local path. - macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/vishvaisadev123/agent-battery-saver-skill/main/install.sh | sh - Windows PowerShell:
iwr -useb https://raw.githubusercontent.com/vishvaisadev123/agent-battery-saver-skill/main/install.ps1 | iex - Optional OpenCode catalog: https://raw.githubusercontent.com/vishvaisadev123/agent-battery-saver-skill/main/catalog/
Use Prompt Router (agent-battery-saver) before any model call: run route, report the token and cost estimate, use gate's forward payload for the real call, then finish with verified evidence. Never upload prompts, context, responses, or credentials.The one-time catalog or release download is the only network request. After installation the CLI runs offline.
Community feedback
Downloaded Prompt Router? Tell us how it went.
Share what worked, what didn't, and which route you chose. Feedback is published on the public board — please never include prompts, credentials, or private code.
Recent Prompt Router feedback
Loading feedback…
Privacy boundary
Prompt Router separates what stays in your calling app from the small local fields the skill stores in .agent-saver/. Add that directory to your .gitignore if you do not want reports committed.
| Stays in your app | Stored locally in .agent-saver/ |
|---|---|
| Raw prompt text | Hashed prompt and cache keys |
| Retrieved context and documents | Redacted prompt and task summaries |
| Provider responses | Normalized token counts and costs |
| Provider credentials | Model routing, tool names, and retries |
| Full conversation history | Files, tests, commits, outcome and waste scores |
Prompt Router FAQ
7 short answers — tap a question to expand.
Is Prompt Router free?
Yes. Prompt Router is Apache-2.0, downloadable without an account from the public GitHub repository, and runs entirely on your own machine.
Does Prompt Router send prompts to a server?
No. The CLI makes no network requests, and route does not create the local state directory. Raw prompt text, retrieved context, provider responses, and credentials are never written to disk by the skill.
Which model families does Prompt Router recommend?
Open-weight families such as Qwen, Llama, Mistral, and DeepSeek, plus Anthropic Claude, Google Gemini, and OpenAI GPT. The choice depends on task type, context size, output cap, and tool count.
Does Prompt Router replace a token calculator?
No. It uses local pricing data to estimate a route before the call. TokenCalc calculators remain useful for comparing models and understanding token costs after the fact.
Does Prompt Router work with any AI agent?
Yes. The CLI is plain Node.js with no dependencies, so any agent that can run a local command can use it — Claude Code, Cursor, Codex, Gemini CLI, OpenCode, or a custom agent. Load the bundled SKILL.md, add the one-line instruction to your agent prompt, or call the CLI directly. OpenCode catalog support is optional.
How do I leave feedback after downloading Prompt Router?
Use the public feedback section on this page. Clicking Download opens the GitHub release in a new tab and expands the feedback form when you return. Share your name, a short title, and your experience; never include prompts, credentials, or private code.
Can I get a feedback reminder one day after downloading?
Yes. After downloading, you can opt in to browser notifications. One day later you will get an on-page prompt when you return and, if the tab is open and permission was granted, a desktop notification. Only a timestamp is stored in your browser; no prompt content is sent anywhere.