Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/ayuayue/pideck/usage-probenpx skills add ayuayue/PiDeck --skill usage-probegit clone --depth 1 https://github.com/ayuayue/PiDeckWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/ayuayue/pideck/usage-probe)<a href="https://agentmods.dev/skills/ayuayue/pideck/usage-probe"><img src="https://agentmods.dev/badge/skills/ayuayue/pideck/usage-probe.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00104 | $0.02361 |
| Opus 5 | $0.00052 | $0.01180 |
| Sonnet 5 | $0.00021 | $0.00472 |
| Haiku 4.5 | $0.00010 | $0.00236 |
Grade A, and why
usage-probe scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 193 lines — stays where its author put it; the contents beside it link to each section on GitHub.
用量查询辅助(usage-probe)
这是什么
供应商的用量/余额显示在「设置 → 配置管理 → 模型/认证」的 供应商卡片底部 (学 cc-switch:所有卡片同一位置、右对齐:相对时间 + 彩色数值 + 刷新按钮)。 支持分三层:
- 内置模板(零配置):命中内置候选的供应商开箱即用,弹窗里已识别、无需配置。
当前内置:
- 官方余额:DeepSeek(
/user/balance)、OpenRouter(/api/v1/keyper-key 额度)、 Moonshot 官方余额(/users/me/balance); - 套餐额度:Kimi For Coding(
/usages,含 Boost 点数)、智谱 GLM Coding Plan (5h 滚动窗 / 周窗 / MCP 月度窗)、OpenCode Go(/usage三档百分比); - 官方订阅(登录态 OAuth,凭据来自 auth.json):Codex/ChatGPT(
/wham/usage)、 xAI Grok(billing 预检链); - 通用 OpenAI 兼容网关兜底:实现了官方
/v1/usage({ balance, unit })的中转站自动显示余额。
- 官方余额:DeepSeek(
- 声明式模板(弹窗内可选):不在内置列表时,弹窗提供两个模板——
- 通用模板:请求
/usage(OpenAI 兼容),API Key / 请求地址可覆盖(留空用供应商的); - New API:New API / OneAPI 中转站,填 访问令牌 + 用户 ID(积分自动换算)。
- 通用模板:请求
- 旧版探针数组(AI 兜底):上面都覆盖不了的接口(如自建网关的自定义余额端点),
由 AI 写
~/.pi/agent/usage-probes.json的probes数组(见下文),运行时按 baseUrl 关键字匹配合入探测。
配置文件位置(和 models.json 同一个目录):
~/.pi/agent/usage-probes.json
改完立刻生效(无需重启)。顶层 providers 映射由弹窗维护,AI 不要手改;
probes 数组才是开放给 AI 写的部分。
改完立刻生效(无需重启),下次打开供应商卡片就能读到新配置。
你(AI)的工作流程
当用户说「帮我让 XX 供应商显示用量」时,按下面顺序做:
- 先判断是否已内置:读
~/.pi/agent/models.json找到该 provider 的baseUrl, 对照上面的内置清单。命中就直接告诉用户「已内置,无需配置,卡片底部会自动显示」, 不需要写任何文件。apiKey 的位置不用读出来,也不要把 key 贴到任何地方。 - 没内置 → 引导弹窗模板:让用户在供应商卡片点「用量查询」打开弹窗:
- OpenAI 兼容站点(有
/usage端点)→ 选「通用模板」,必要时填请求地址(留空用供应商的); - New API / OneAPI 中转站 → 选「New API」,填访问令牌和用户 ID;
- 两个模板都覆盖不了 → 继续第 3 步。
- OpenAI 兼容站点(有
- 写旧版 probes 数组:确认该供应商的「余额 / usage / balance / credits」接口
(拿不到文档时让用户 F12 抓包,把 URL 路径和返回 JSON 发给你;记得提醒用户
抹掉 key/token),确定「剩余额度」字段后按下面结构生成
probes数组。 - 验证:让用户打开供应商卡片看底部用量行。不显示就继续对齐字段路径。
重要安全边界:配置文件里不要写 apiKey。鉴权统一走
Authorization: Bearer <key>, 主进程自动从 auth.json/models.json 取 key;只有个别接口用非标准鉴权头时才用"headers": { "X-API-Key": "{{apiKey}}" }占位。
配置文件结构
顶层 providers 映射由弹窗维护(开关/模板/超时/间隔),AI 不要手改。
下面这个 probes 数组是开放给 AI 写的兜底部分,每条是一个供应商。字段含义:
{
"probes": [
{
// (可选)只是给自己看的名字,不影响功能
"name": "我的中转站",
// 匹配条件:你的供应商 baseUrl 里包含的任意关键字(小写匹配)
"match": {
"baseUrlContains": ["api.myprovider.com"]
},
// 发什么请求
"request": {
"path": "/user/balance", // 相对 baseUrl 的路径,必须以 / 开头
"method": "GET", // 可选,GET 或 POST,缺省 GET
// "body": { ... }, // 可选,POST 时的请求体
// "headers": { "X-API-Key": "{{apiKey}}" } // 可选,非标准鉴权头
},
// 怎么从响应里取数(三种形态选一种)
"parse": {
"kind": "balance",
"valuePath": "balance_infos[0].total_balance", // 剩余额度的字段路径
"currencyPath": "balance_infos[0].currency" // 可选,币种
}
}
]
}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 193 lines · 104 tokens per session scan A d0e4c331c0b7
usage-probe is a skill published in the GitHub repository ayuayue/PiDeck (742 stars, last pushed today), licensed MIT. It adds 104 tokens to every session and 2,361 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
local-tools
Access local system resources including Calendar on macOS and Windows. Use this skill when you need to manage user's schedule directly on their device.
article-writer
Multi-style article creation skill. Supports 5 writing styles (deep analysis, practical guide, story-driven, opinion, news brief), including complete workflow: material collection → outline → content → formatting. Activated when users mention "write article", "write post", "create", or "draft".
skin-creator
Create and apply a two-asset LobsterAI visual skin from the user's style description. Use only when the AI Skin Designer kit supplies the structured skinpack workflow marker; do not use for ordinary theme or image requests.
content-planner
WeChat Official Account topic planning and content calendar management. Based on WeChat article search and trending analysis, generates differentiated topic recommendations and outputs structured content calendars. Activated when users mention "topic", "planning", "content calendar", "trending", or "what to write next…
music-search
Search cloud drives for downloadable music resources (songs, albums, lossless audio). Use this skill when the user wants to download a specific song or album. Do NOT use for general music information, lyrics, or recommendations.
skill-vetter
Security-first skill vetting for AI agents. Use before installing any skill from ClawdHub, GitHub, or other sources. Checks for red flags, permission scope, and suspicious patterns.