跳到正文
Skillpedia
智能体48k · #6303

tokenwise

它能做什么

TokenWise 能帮你选择既能完成任务、又最便宜的 AI 模型,从而节省 AI 使用费用。它会记录每个任务花了多少钱,还能让你测试哪种模型最适合你。

适用场景

  • ✓在不降低回复质量的前提下削减成本。
  • ✓检查更简单的模型是否足以应付你的任务。
  • ✓了解 AI 费用都花在了哪里。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/skills/tokenwise/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/skills/tokenwise/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我想测试一下 Haiku 模型能不能把这段文字改写得更简单。”

每周 5 个新技能,1 分钟读完。

工作原理

TokenWise 会分析你的任务,并把它交给最合适、性价比最高的 AI 模型。它会记录每个任务的确切花费,还允许你对比不同模型,确保你用的是最佳选项。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

TokenWise — Measurement-Driven Model Router

Overview

A Claude Code skill that auto-routes subtasks to the cheapest model that can handle them (Haiku for grunt work, Sonnet for scoped reasoning, Opus only for synthesis), then logs every routed task to a local NDJSON with real token + cost numbers. Includes an A/B test subcommand that runs the same task across multiple tiers and scores quality, so the routing decisions are verified against the user's real workload — not estimated.

Anthropic's own bug tracker (Issue #27665) reports 93.8% of Max-subscriber Claude Code tokens flow to Opus. Existing routers (claude-router, wshobson, VoltAgent) either pin models statically or route by vibes-based heuristics with no measurement. TokenWise fills the measurement gap.

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

Zero telemetry. All logs in .tokenwise/log.ndjson local to the project. Task descriptions truncated to 80 chars and stripped of file contents before logging. No analytics endpoint exists in the source.

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

  • Token counts approximate to ±2% vs Anthropic billing
  • A/B test mode costs extra tokens (one task × N tiers) — intentional one-time validation
  • Anthropic-only by design (use LiteLLM or OpenRouter for cross-vendor)
  • Subagent model: param has known silent-fail bugs on some Claude Code builds — skill probes for this at install and refuses to configure if routing is broken

Source

常见问题

TokenWise 如何选择合适的模型?

它依据一份预设清单:简单、快速的任务交给 Haiku,需要一定推理的任务交给 Sonnet,而像规划软件架构这类复杂任务则交给 Opus。如果任务比预期复杂,它还能升级为更强的模型。

TokenWise 会把我的数据发送到别处吗?

不会,它完全是私密的。所有费用信息和任务都只保存在你的电脑上,敏感数据也受到保护。

什么是 A/B 测试?

这是一项功能,允许你让不同的 AI 模型同时执行同一个任务。这样你就能看出哪个模型在你的具体用途中质量最好,确保省钱不会影响结果。

详情

作者的原始描述

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.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#6303
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能