@kairyou/agent-tools 0.4.0 → 0.5.0
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 +4 -3
- package/README.zh-CN.md +3 -3
- package/dist/statusline/claude-statusline.mjs +866 -61
- package/dist/usage/core.mjs +1199 -377
- package/integrations/statusline/claude-statusline.mjs +6 -65
- package/integrations/usage/core.mjs +13 -1103
- package/integrations/usage/lib/cache.mjs +110 -0
- package/integrations/usage/lib/config.mjs +99 -0
- package/integrations/usage/lib/context.mjs +138 -0
- package/integrations/usage/lib/format.mjs +265 -0
- package/integrations/usage/lib/http.mjs +186 -0
- package/integrations/usage/lib/routes.mjs +265 -0
- package/integrations/usage/lib/urls.mjs +48 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,8 +109,9 @@ it preserves top-of-file comments and existing values.
|
|
|
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
|
-
|
|
112
|
+
Works with the usage APIs of Sub2API, NewAPI/OneAPI-family panels (OneHub,
|
|
113
|
+
DoneHub, Veloera, ...), and OpenRouter; compatibility can vary with a
|
|
114
|
+
deployment's version and auth scheme.
|
|
114
115
|
|
|
115
116
|
```bash
|
|
116
117
|
npx -y @kairyou/agent-tools@latest usage -a claude
|
|
@@ -139,7 +140,7 @@ endpoint and key — and tune `providerUsage` in `~/.agent-tools/config.jsonc`:
|
|
|
139
140
|
```jsonc
|
|
140
141
|
{
|
|
141
142
|
"providerUsage": {
|
|
142
|
-
"preset": "auto", // sub2api | new-api | veloera |
|
|
143
|
+
"preset": "auto", // sub2api | new-api | veloera | openrouter | ...
|
|
143
144
|
"userId": "", // some NewAPI/Veloera panels require your panel user id
|
|
144
145
|
"days": 30, // spend window for the "30d" field (max 90)
|
|
145
146
|
"debug": false // true: log probes to ~/.agent-tools/logs/usage-debug.log
|
package/README.zh-CN.md
CHANGED
|
@@ -102,8 +102,8 @@ npx -y @kairyou/agent-tools@latest statusline -a claude
|
|
|
102
102
|
|
|
103
103
|
面向使用 API 中转的场景: 在 agent 内直接显示中转网关的余额/额度, 按量付费或
|
|
104
104
|
有套餐限额时, 随时知道花了多少, 还剩多少, 不用切出去登录网关后台.
|
|
105
|
-
|
|
106
|
-
与 OpenRouter
|
|
105
|
+
支持 Sub2API, NewAPI/OneAPI 系面板 (OneHub, DoneHub, Veloera 等)
|
|
106
|
+
与 OpenRouter 的用量接口; 同类网关的部署版本和鉴权方式不同, 兼容性可能有差异.
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
109
|
npx -y @kairyou/agent-tools@latest usage -a claude
|
|
@@ -130,7 +130,7 @@ provider 的 `base_url` 和密钥; Claude Code: 读取 `ANTHROPIC_BASE_URL` 与
|
|
|
130
130
|
```jsonc
|
|
131
131
|
{
|
|
132
132
|
"providerUsage": {
|
|
133
|
-
"preset": "auto", // sub2api | new-api | veloera |
|
|
133
|
+
"preset": "auto", // sub2api | new-api | veloera | openrouter | ...
|
|
134
134
|
"userId": "", // 部分 NewAPI/Veloera 面板需要填面板用户 id
|
|
135
135
|
"days": 30, // "30d" 字段的统计窗口(最大 90)
|
|
136
136
|
"debug": false // true: 探测过程写入 ~/.agent-tools/logs/usage-debug.log
|