@kairyou/agent-tools 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/README.zh-CN.md +9 -10
- package/dist/usage/cli.mjs +931 -1
- package/dist/usage/core.mjs +54 -125
- package/integrations/usage/cli.mjs +5 -2
- package/integrations/usage/lib/config.mjs +24 -25
- package/integrations/usage/lib/format.mjs +3 -40
- package/integrations/usage/lib/http.mjs +2 -2
- package/integrations/usage/lib/routes.mjs +37 -96
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,14 +109,12 @@ and never touch your edits or comments.
|
|
|
109
109
|
For API relay / gateway setups: shows the relay's balance / quota inside the
|
|
110
110
|
agent, so when you pay per use or have plan limits you always know how much you
|
|
111
111
|
have spent and how much is left — without opening the gateway console.
|
|
112
|
-
Works with
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
Works with API-key usage endpoints exposed by Sub2API, One API, New API, and
|
|
113
|
+
OpenRouter. Compatibility depends on the gateway version and whether the
|
|
114
|
+
corresponding usage endpoint is enabled.
|
|
115
115
|
|
|
116
116
|
```bash
|
|
117
|
-
npx -y @kairyou/agent-tools@latest usage -a claude
|
|
118
|
-
npx -y @kairyou/agent-tools@latest usage -a codex
|
|
119
|
-
npx -y @kairyou/agent-tools@latest usage -a opencode
|
|
117
|
+
npx -y @kairyou/agent-tools@latest usage -a claude codex opencode
|
|
120
118
|
```
|
|
121
119
|
|
|
122
120
|
- **Claude Code** — installs the `at-usage` skill into `~/.claude/skills`; invoke
|
|
@@ -140,14 +138,17 @@ endpoint and key — and tune `providerUsage` in `~/.agent-tools/config.jsonc`:
|
|
|
140
138
|
```jsonc
|
|
141
139
|
{
|
|
142
140
|
"providerUsage": {
|
|
143
|
-
"preset": "auto", // sub2api |
|
|
144
|
-
"
|
|
145
|
-
"days": 30, // spend window for the "30d" field (max 90)
|
|
141
|
+
"preset": "auto", // auto | sub2api | one-api | new-api | openrouter | <custom-route-id>
|
|
142
|
+
"days": 30, // how many recent days of spend to count
|
|
146
143
|
"debug": false // true: log probes to ~/.agent-tools/logs/usage-debug.log
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
146
|
```
|
|
150
147
|
|
|
148
|
+
Keep `preset` set to `auto` for automatic detection. Select a specific protocol
|
|
149
|
+
only when you know which usage endpoint the gateway exposes; a configured
|
|
150
|
+
custom route id is also accepted.
|
|
151
|
+
|
|
151
152
|
#### Custom gateway routes
|
|
152
153
|
|
|
153
154
|
For gateways the built-in probes cannot reach (e.g. cookie-authenticated
|
|
@@ -217,8 +218,7 @@ Lets a main model that cannot see images ask a multimodal model specific questio
|
|
|
217
218
|
#### Install
|
|
218
219
|
|
|
219
220
|
```bash
|
|
220
|
-
npx -y @kairyou/agent-tools@latest vision -a claude
|
|
221
|
-
npx -y @kairyou/agent-tools@latest vision -a codex claude opencode
|
|
221
|
+
npx -y @kairyou/agent-tools@latest vision -a claude codex opencode
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
Uninstalling keeps your vision provider config. The installer registers the
|
package/README.zh-CN.md
CHANGED
|
@@ -102,13 +102,11 @@ npx -y @kairyou/agent-tools@latest statusline -a claude
|
|
|
102
102
|
|
|
103
103
|
面向使用 API 中转的场景: 在 agent 内直接显示中转网关的余额/额度, 按量付费或
|
|
104
104
|
有套餐限额时, 随时知道花了多少, 还剩多少, 不用切出去登录网关后台.
|
|
105
|
-
支持 Sub2API,
|
|
106
|
-
|
|
105
|
+
支持 Sub2API, One API, New API 与 OpenRouter 提供的 API Key 用量接口.
|
|
106
|
+
具体兼容性取决于网关版本及其是否开放相应接口.
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
|
-
npx -y @kairyou/agent-tools@latest usage -a claude
|
|
110
|
-
npx -y @kairyou/agent-tools@latest usage -a codex
|
|
111
|
-
npx -y @kairyou/agent-tools@latest usage -a opencode
|
|
109
|
+
npx -y @kairyou/agent-tools@latest usage -a claude codex opencode
|
|
112
110
|
```
|
|
113
111
|
|
|
114
112
|
- **Claude Code** — 把 `at-usage` skill 装入 `~/.claude/skills`; 调用
|
|
@@ -130,14 +128,16 @@ provider 的 `base_url` 和密钥; Claude Code: 读取 `ANTHROPIC_BASE_URL` 与
|
|
|
130
128
|
```jsonc
|
|
131
129
|
{
|
|
132
130
|
"providerUsage": {
|
|
133
|
-
"preset": "auto", // sub2api |
|
|
134
|
-
"
|
|
135
|
-
"days": 30, // "30d" 字段的统计窗口(最大 90)
|
|
131
|
+
"preset": "auto", // auto | sub2api | one-api | new-api | openrouter | <自定义 route id>
|
|
132
|
+
"days": 30, // 统计最近多少天的消耗
|
|
136
133
|
"debug": false // true: 探测过程写入 ~/.agent-tools/logs/usage-debug.log
|
|
137
134
|
}
|
|
138
135
|
}
|
|
139
136
|
```
|
|
140
137
|
|
|
138
|
+
保持 `preset: "auto"` 即可自动探测. 只有明确知道网关开放的是哪种用量协议时,
|
|
139
|
+
才指定相应的内置 preset 或已配置的自定义 route id.
|
|
140
|
+
|
|
141
141
|
#### 自定义网关路由
|
|
142
142
|
|
|
143
143
|
内置探测覆盖不到的网关(比如 cookie 认证的中转), 可以自己写路由模块并在
|
|
@@ -204,8 +204,7 @@ API | balance $362 | today $61.7 | 30d $566
|
|
|
204
204
|
#### 安装
|
|
205
205
|
|
|
206
206
|
```bash
|
|
207
|
-
npx -y @kairyou/agent-tools@latest vision -a claude
|
|
208
|
-
npx -y @kairyou/agent-tools@latest vision -a codex claude opencode
|
|
207
|
+
npx -y @kairyou/agent-tools@latest vision -a claude codex opencode
|
|
209
208
|
```
|
|
210
209
|
|
|
211
210
|
卸载默认保留 vision provider 配置. 安装器会为每个 agent 注册 `inspect_image`
|