跳到正文
Simon Willison·· 1 天前精选AI 评分30

llm-echo 0.5 更新模拟 token 用量统计

llm-echo 0.5

AI 导读

Simon Willison 更新 llm-echo 0.5 调试插件,改进模拟 token 用量统计,使其计入工具调用、系统提示词和推理 token。该插件提供不调用 LLM、只重复输入提示词的“模型”;示例显示输入用量为 2 个 token、输出用量为 24 个 token。

正文 · AI 翻译

我正在为新的 LLM 版本做准备,测试 PR 让我重新审视了 llm-echo 调试插件。这个插件提供了一个完全不涉及 LLM 的“模型”——它只会重复返回传入的提示。新版本现在会更新模拟的 token 用量统计,将工具调用、系统提示和推理 token 纳入考量。

使用示例:

uvx --with llm-echo llm -m echo 'hi there' -o thinking 1 --usage

输出:

First I consider the prompt, then I decide what to say.
{
  "prompt": "hi there",
  "system": "",
  "attachments": [],
  "stream": true,
  "previous": []
}
Token usage: 2 input, 24 output

来源:Simon Willison · simonwillison.net