跳到主内容

dsh-token-meter 使用指南

提供 ctx.tokenMeter 服务实现会话级 token 计量和预算估算,支持压力计算和会话投影,供 dsh 插件共享 token 统计

本文为派生内容(基于 wiki / faq / compatibility_json 自动组装),非 AI 即时创作。

本文由本站基于该插件已收录的字段自动派生(wiki / faq / compatibility_json / readme),非 AI 即时创作。每节末尾标源字段。

快速上手

提供 ctx.tokenMeter 服务实现会话级 token 计量和预算估算,支持压力计算和会话投影,供 dsh 插件共享 token 统计

— 源: plugins.ai_summary

安装与验证

dsh plugin --profile web add npm:@deepseek-ai/dsh-token-meter

复制以上命令在 DSH Web Profile 内运行。安装完成后在「插件列表」启用即可。

— 源: plugins.install

关键要点

  • measure(session, requestHeader?) returns request pressure and the current priced surface at one consumed-log revision.
  • estimateMessage(message) prices one message with the fixed heuristic.
  • name: '@deepseek-ai/dsh-token-meter'
  • name: '@deepseek-ai/dsh-compaction-basic'
  • The fixed heuristic is approximate — content without reusable provider usage is priced by character count plus structural overhead, not an exact provider tokenizer or request serializer.

— 源: plugin_wiki.readme_zh (fallback readme_raw)

踩坑提醒

安装前请审阅上游仓库;本指南基于已收录字段自动派生,可能滞后于最新版本。如发现与官方文档冲突,请以上游为准。

— 来源:通用规则