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。

  • 授權條款不適用

    託管服務按其提供方的條款使用,因此這裡不要求授權條款。此檢查項不計入百分比。