TokenWise — Measurement-Driven Model Router
Overview
The upstream package advertises model-tier routing, local NDJSON usage logs and an A/B comparison command. Evaluate those capabilities only in an installed, reviewed revision with the user's authorized model budget and actual workload. Task difficulty, response-quality rubrics and reported costs remain estimates unless independently measured.
This entry describes the upstream workflow; it does not bundle its commands or measurement implementation. Verify the installed revision, supported models and actual routing behavior before relying on a report. A user's workload and billing plan determine whether routing reduces paid usage.
When to use
- Cutting Claude Code token spend without sacrificing output quality
- Validating whether Haiku/Sonnet is "good enough" for a specific task class before trusting auto-routing
- Auditing where Opus tokens are actually being burned
- Logging per-session cost data for finance or chargeback
Subcommands
/tokenwise:install — guided installer with diff preview, automatic backups, and --dry-run mode
/tokenwise:report — per-session token + cost summary vs all-Opus baseline
/tokenwise:summary [--week|--month|--all] — historical aggregate with trend
/tokenwise:ab "<task>" — A/B test the same task at multiple tiers, generates a markdown comparison
/tokenwise:undo — restore CLAUDE.md / settings.json from backup
Routing taxonomy
| Tier |
Model |
Task class |
| Mechanical |
Haiku 4.5 |
file reads, grep, format, rename, simple edits, doc lookups |
| Scoped reasoning |
Sonnet 4.6 |
single-file refactor, scoped research, test writing |
| Synthesis |
Opus 4.7 |
architecture decisions, multi-file refactor, security review |
Safety caps:
- Haiku never spawns further subagents
- Max spawn depth = 2
- Subagents that need a smarter model return to parent — they never escalate on their own
- Tasks under 100 chars with no file context run inline (subagent overhead > savings)
- Subagent context >30k tokens bumps a tier
Privacy
Upstream describes project-local logs at .tokenwise/log.ndjson. Inspect the installed revision and dependencies for log contents, redaction, retention and network behavior; this single-file catalog entry cannot establish zero telemetry. Model routing and A/B runs send task context to the selected provider. Exclude secrets and obtain authorization for additional provider usage; keep logs out of public commits.
Install
In any Claude Code session:
/plugin marketplace add CodeShuX/tokenwise
/plugin install tokenwise@tokenwise
Then run /tokenwise:install and follow the guided prompts.
Limitations
- Treat reported costs as estimates until reconciled with actual provider usage and current pricing; no billing-error bound is established by this catalog entry
- A/B test mode costs extra tokens (one task × N tiers) — intentional one-time validation
- Anthropic-only by design (use LiteLLM, OpenRouter, or Bifrost for cross-vendor)
- Verify the selected model in actual execution evidence; do not assume a model parameter or an installer probe guarantees that a specific client build honored routing
Source
1---2name: tokenwise3description: "Measurement-driven model router for Claude Code. Routes Haiku/Sonnet/Opus per task class, logs every routed task with real $ numbers, and A/B tests cheaper tiers before you trust the savings."4category: developer-tools5risk: critical6source: community7source_repo: CodeShuX/tokenwise8source_type: community9date_added: "2026-05-12"10author: CodeShuX11tags: [model-routing, token-optimization, cost-reduction, anthropic, haiku, sonnet, opus, claude-code, ab-testing, measurement]12tools: [claude]13license: "MIT"14license_source: "https://github.com/CodeShuX/tokenwise/blob/main/LICENSE"15plugin:16 targets:17 codex: blocked18 claude: blocked19metadata:20 source: https://skillmd.com/skills/sickn33/tokenwise21---2223# TokenWise — Measurement-Driven Model Router2425## Overview2627The upstream package advertises model-tier routing, local NDJSON usage logs and an A/B comparison command. Evaluate those capabilities only in an installed, reviewed revision with the user's authorized model budget and actual workload. Task difficulty, response-quality rubrics and reported costs remain estimates unless independently measured.2829This entry describes the upstream workflow; it does not bundle its commands or measurement implementation. Verify the installed revision, supported models and actual routing behavior before relying on a report. A user's workload and billing plan determine whether routing reduces paid usage.3031## When to use3233- Cutting Claude Code token spend without sacrificing output quality34- Validating whether Haiku/Sonnet is "good enough" for a specific task class before trusting auto-routing35- Auditing where Opus tokens are actually being burned36- Logging per-session cost data for finance or chargeback3738## Subcommands3940- `/tokenwise:install` — guided installer with diff preview, automatic backups, and `--dry-run` mode41- `/tokenwise:report` — per-session token + cost summary vs all-Opus baseline42- `/tokenwise:summary [--week|--month|--all]` — historical aggregate with trend43- `/tokenwise:ab "<task>"` — A/B test the same task at multiple tiers, generates a markdown comparison44- `/tokenwise:undo` — restore CLAUDE.md / settings.json from backup4546## Routing taxonomy4748| Tier | Model | Task class |49|---|---|---|50| Mechanical | Haiku 4.5 | file reads, grep, format, rename, simple edits, doc lookups |51| Scoped reasoning | Sonnet 4.6 | single-file refactor, scoped research, test writing |52| Synthesis | Opus 4.7 | architecture decisions, multi-file refactor, security review |5354Safety caps:55- Haiku never spawns further subagents56- Max spawn depth = 257- Subagents that need a smarter model return to parent — they never escalate on their own58- Tasks under 100 chars with no file context run inline (subagent overhead > savings)59- Subagent context >30k tokens bumps a tier6061## Privacy6263Upstream describes project-local logs at `.tokenwise/log.ndjson`. Inspect the installed revision and dependencies for log contents, redaction, retention and network behavior; this single-file catalog entry cannot establish zero telemetry. Model routing and A/B runs send task context to the selected provider. Exclude secrets and obtain authorization for additional provider usage; keep logs out of public commits.6465## Install6667In any Claude Code session:6869```70/plugin marketplace add CodeShuX/tokenwise71/plugin install tokenwise@tokenwise72```7374Then run `/tokenwise:install` and follow the guided prompts.7576## Limitations7778- Treat reported costs as estimates until reconciled with actual provider usage and current pricing; no billing-error bound is established by this catalog entry79- A/B test mode costs extra tokens (one task × N tiers) — intentional one-time validation80- Anthropic-only by design (use LiteLLM, OpenRouter, or [Bifrost](https://github.com/maximhq/bifrost) for cross-vendor)81- Verify the selected model in actual execution evidence; do not assume a model parameter or an installer probe guarantees that a specific client build honored routing8283## Source8485- Repo: https://github.com/CodeShuX/tokenwise86- License: MIT87- Author: CodeShuX