J
Jwrede/tokentoll
Catch LLM cost changes in code review. Infracost for LLM spend.
无 SECURITY.md
在 GitHub 查看 ↗链接已于 2026-11-12 核查 · HTTP 200 · 打开的是厂商自己的官网
安装与配置
- 复制上面的命令
- 粘成
claude_desktop_config.json里mcpServers的一项(本地服务器用 command + args,示例见 客户端接法) - 重启客户端
取自该仓库的安装命令
pip install tokentoll
解析自我们于 2026-10-26 抓取的该仓库 README;我们未执行过。
这条是仓库自己写的安装方式,不是 MCP 客户端配置,所以不生成 JSON。
配置项的键名以你的客户端为准:客户端与 CLI
- ★ 数取值
- 4 ★ · Jwrede/tokentoll · 取自 GitHub 搜索 API · (2026-11-13 20:00:50 核对)
- 来源明细
- 收录自 punkpeye/awesome-mcp-servers 榜单(我们从中收集的条目之一) · 条目类型:MCP 服务
- 收录与活跃
- 收录于 2026-10-23 · 最近见到 2026-11-14 · 共见到 26 次 · 被 23 个来源列出
- 评分构成
- 综合分 2,300 · 4 ★ · 23 个来源 · mcp
- 安装
pip install tokentoll
常见问题(答案都来自我们的记录)
怎么安装?
该仓库给出的安装命令是
pip install tokentoll。我们的记录里它是仓库自己提供的;不保证在你的客户端上直接可用。它适合谁 / 用来做什么?
我们把它归在这些标签下: MCP 服务。标签来自条目自身,不是我们强加的分类。
谁维护它、还在更新吗?
仓库
Jwrede/tokentoll;我们收录于 2026-10-23;最近见到 2026-11-14。这里没有"官方认证"或"质量评级"——我们只记录来源与时间。# tokentoll
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
> Prevent LLM cost regressions before production.
tokentoll is a CI gate for LLM cost. It statically analyzes Python, JavaScript, and TypeScript for LLM API calls, scores every pull request against a policy you control, and posts a PASS/WARN/FAIL verdict directly on the PR. Optionally, it fails the workflow when the policy is violated, so cost regressions cannot be merged.
## Live demo
Jwrede/tokentoll-demo is a small polyglot LLM app (Python + TypeScript) wired up to the tokentoll cost gate. Two PRs are already open against it:
PR #1: Add Anthropic Haiku translation helper. New call site, well within budget. Verdict: PASS, workflow green.
PR #2: switch supportbot to gpt-4o. A model swap that trips two policy rules. Verdict: FAIL, workflow red.
Open each PR's conversation tab to see the verdict comment tokentoll actually posts.
## The verdict comment
When a PR violates your policy, tokentoll comments with a verdict and a blocking-findings list, then exits non-zero so the check fails. Example:
md
## tokentoll verdict: FAIL
Blocking findings (2):
src/agent.py:42 - per-call cost grew 15.0x (threshold 5x)
total monthly delta +$812.00 exceeds budget $250.00
> Required action: revert the regression, raise the threshold in .tokentoll.yml, or add an exemption.
When the PR is clean, the verdict is PASS and the comment shows only the cost delta table. When no policy is configured, tokentoll posts an informational delta comment with no verdict.
## Quick start (60 seconds)
Add .github/workflows/tokentoll.yml:
yaml
name: tokentoll
on:
pullrequest:
paths:
".py"
".ts"
".tsx"
".js"
".jsx"
permissions:
contents: read
pull-requests: write
jobs:
cost-gate:
runs-on: ubuntu-latest
steps:
uses: actions/checkout@v4
with:
fetch-depth: 0
uses: Jwrede/tokentoll@v0.7.0
with:
fail-on-policy-violation: true
Then add .tokentoll.yml to your repo root:
yaml
budgets:
maxmonthlydeltausd: 250
maxcallsitemonthlyusd: 100
maxrelativeincrease: 5.0
policies:
blockunknownmodels: true
failonpolicyviolation: true
Future PRs receive a verdict comment. PRs that exceed the thresholds fail the workflow.
For SHA-pinned installs and minimal-permissions setups, see docs/github-action.md. For the full policy schema, see docs/policy.md. For the security posture, see docs/security.md.
## What it detects
Python
| SDK | Patterns |
| OpenAI | chat.completions.create, responses.create |
| Anthropic | messages.create, messages.stream |
| Google GenAI | models.generatecontent |
| LiteLLM | completion, acompletion |
| LangChain | ChatOpenAI, ChatAnthropic, initchatmodel |
| Zhipu AI | ZhipuAiClient, ZhipuAI (GLM models) |
JavaScript / TypeScript (parsed via tree-sitter, handles .js, .jsx, .ts, .tsx)
| SDK | Patterns |
| OpenAI Node SDK | client.chat.completions.create, client.responses.create, client.embeddings.create |
| Anthropic SDK | client.messages.create, client.messages.stream |
| Vercel AI SDK | generateText, streamText, generateObject, streamObject, embed, embedMany |
| LangChain.js | new ChatOpenAI, new ChatAnthropic, new ChatGoogleGenerativeAI, ... |
| OpenAI-compatible | same shape as OpenAI Node SDK, picked up automatically |
## Policy rules
The policy block in .tokentoll.yml controls when a PR fails:
tokentoll is a CI gate for LLM cost. It statically analyzes Python, JavaScript, and TypeScript for LLM API calls, scores every pull request against a policy you control, and posts a PASS/WARN/FAIL verdict directly on the PR. Optionally, it fails the workflow when the policy is violated, so cost regressions cannot be merged.
## Live demo
Jwrede/tokentoll-demo is a small polyglot LLM app (Python + TypeScript) wired up to the tokentoll cost gate. Two PRs are already open against it:
PR #1: Add Anthropic Haiku translation helper. New call site, well within budget. Verdict: PASS, workflow green.
PR #2: switch supportbot to gpt-4o. A model swap that trips two policy rules. Verdict: FAIL, workflow red.
Open each PR's conversation tab to see the verdict comment tokentoll actually posts.
## The verdict comment
When a PR violates your policy, tokentoll comments with a verdict and a blocking-findings list, then exits non-zero so the check fails. Example:
md
## tokentoll verdict: FAIL
Blocking findings (2):
src/agent.py:42 - per-call cost grew 15.0x (threshold 5x)
total monthly delta +$812.00 exceeds budget $250.00
> Required action: revert the regression, raise the threshold in .tokentoll.yml, or add an exemption.
When the PR is clean, the verdict is PASS and the comment shows only the cost delta table. When no policy is configured, tokentoll posts an informational delta comment with no verdict.
## Quick start (60 seconds)
Add .github/workflows/tokentoll.yml:
yaml
name: tokentoll
on:
pullrequest:
paths:
".py"
".ts"
".tsx"
".js"
".jsx"
permissions:
contents: read
pull-requests: write
jobs:
cost-gate:
runs-on: ubuntu-latest
steps:
uses: actions/checkout@v4
with:
fetch-depth: 0
uses: Jwrede/tokentoll@v0.7.0
with:
fail-on-policy-violation: true
Then add .tokentoll.yml to your repo root:
yaml
budgets:
maxmonthlydeltausd: 250
maxcallsitemonthlyusd: 100
maxrelativeincrease: 5.0
policies:
blockunknownmodels: true
failonpolicyviolation: true
Future PRs receive a verdict comment. PRs that exceed the thresholds fail the workflow.
For SHA-pinned installs and minimal-permissions setups, see docs/github-action.md. For the full policy schema, see docs/policy.md. For the security posture, see docs/security.md.
## What it detects
Python
| SDK | Patterns |
| OpenAI | chat.completions.create, responses.create |
| Anthropic | messages.create, messages.stream |
| Google GenAI | models.generatecontent |
| LiteLLM | completion, acompletion |
| LangChain | ChatOpenAI, ChatAnthropic, initchatmodel |
| Zhipu AI | ZhipuAiClient, ZhipuAI (GLM models) |
JavaScript / TypeScript (parsed via tree-sitter, handles .js, .jsx, .ts, .tsx)
| SDK | Patterns |
| OpenAI Node SDK | client.chat.completions.create, client.responses.create, client.embeddings.create |
| Anthropic SDK | client.messages.create, client.messages.stream |
| Vercel AI SDK | generateText, streamText, generateObject, streamObject, embed, embedMany |
| LangChain.js | new ChatOpenAI, new ChatAnthropic, new ChatGoogleGenerativeAI, ... |
| OpenAI-compatible | same shape as OpenAI Node SDK, picked up automatically |
## Policy rules
The policy block in .tokentoll.yml controls when a PR fails:
收录徽章(可选)
想把收录标记放进 README 就复制这行,可选,不影响收录。
[](https://anclum.com/zh/s/jwrede-tokentoll/)
- 来源
- awesome · https://github.com/Jwrede/tokentoll
- 按领域浏览
- MCP 服务
- Traction
- 4 ★
- 收录来源
- 23 个独立来源
- 收录于
- 今天
- 安全策略
- 我们没在该仓库根目录找到
SECURITY.md(这不代表不安全)
同类推荐
所属领域与标签
每个标签都能点进去看同类的全部条目。数字是当前库里的真实条数。