TokenTally by Harlo

dev.workers.mike-tusa.tokentally由 tokentally.mike-tusa.workers.dev 发布官方发布者v0.1.0更新于 Nov 1, 2026

Count tokens (o200k/cl100k), truncate to a budget, chunk text for RAG and estimate LLM cost.

已验证Streamable HTTP可网页运行数据与分析AI 与机器学习

概览

AI 生成的概览

远程 MCP 服务器,用于统计 token 数量、按 token 预算截断与切分文本,并估算 LLM 调用成本。

可以做什么
  • 并排统计文本在 o200k_base 与 cl100k_base 下的 token 数,并给出 Claude、Gemini、Llama 的近似值
  • 按最大 token 数截断文本,可保留开头或结尾
  • 按段落或句子边界把文本切成受 token 限制的块,附带字符偏移、token 数与可选重叠
  • 根据文本或输入/输出 token 数,用带日期的价格表估算各模型的美元成本
适用场景
适合在为特定上下文窗口准备提示词或文档、为 RAG 切分文本估算规模,或在调用付费模型前核对大致花费时使用。
运行要求
需要远程 streamable HTTP 端点,无需本地安装。可选提供 Authorization 请求头(Bearer 密钥)以提高速率限制,不提供密钥也可使用。单次输入上限为 256 KB。
安装前请注意
只有 OpenAI 分词器计数是精确的;Claude、Gemini 与 Llama 的计数为近似值,偏差可达 10-20% 甚至更多,不宜用于硬性上限判断。成本来自带日期的价格表,属于估算而非实时计费。文本会发送给第三方托管服务,尽管其声明为无状态且不记录日志。

安装

在 SourceWeft 中

  1. 打开 控制台中的 TokenTally by Harlo,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/dev.workers.mike-tusa.tokentally%2Ftokentally/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "tokentally-by-harlo": {
      "type": "http",
      "url": "https://tokentally.mike-tusa.workers.dev/mcp"
    }
  }
}

工具

4

count_tokens

Count tokens

Count tokens for text in o200k_base and cl100k_base side by side, plus approximate Claude/Gemini/Llama counts with method notes. OpenAI counts (o200k_base, cl100k_base) are exact for those tokenizers. Claude, Gemini and Llama counts are APPROXIMATE (proxy encoding; real tokenizers differ, often by 10-20%, and newer Claude tokenizers by ~30% or more). Cost estimates use a dated price table (prices_as_of 2026-10-27) and are estimates, not live billing. Stateless: text is not stored or logged; no URL fetching. Max input is 256 KB. A single unbroken run of characters near that cap may hit a CPU timeout (503); normal text at the cap is supported.

输入参数text必填

truncate_to_budget

Truncate to token budget

Truncate text to max_tokens (keep start or end) for an encoding or model.

输入参数keeptext必填modelencodingmax_tokens必填

chunk_text

Chunk text for RAG

Split text into token-bounded chunks on paragraph/sentence boundaries with character offsets, token counts and optional overlap.

输入参数text必填modelencodingchunk_tokensoverlap_tokens

estimate_cost

Estimate LLM cost

Estimate USD cost per model from text or input_tokens plus output_tokens using a dated price table (prices_as_of 2026-10-27). Estimates, not live billing.

输入参数textmodelsinput_tokensoutput_tokens

版本历史

1
  1. v0.1.0最新Nov 1, 2026

评分

已满足适用检查项的 83%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分

    请声明包含 README 的 GitHub 仓库,或在 OAuth 受保护资源元数据中提供 resource_documentation。

  • 许可证不适用

    托管服务按其提供方的条款使用,因此这里不要求许可证。此检查项不计入百分比。