返回顶部
n

new-api-usage新API用量查询

Query usage statistics and quota from a user-specified new-api endpoint. Use when the user asks to check API quota, usage records, token consumption, model-level usage, or remaining balance. Requires explicit --base-url and --key input.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
250
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

new-api-usage

新 API 使用查询

通过显式输入查询新 API 部署的配额和使用情况。

安全规则

  • - 要求显式提供 --base-url 和 --key;绝不自动读取本地配置或密钥链。
  • 绝不在输出中打印完整的 API 密钥。
  • 仅对使用情况端点执行只读 GET 请求。
  • 如果端点未知,在查询前要求用户确认。

使用方法

bash

摘要(仅今日记录)


uv run python scripts/query_usage.py \
--base-url https://your-new-api.example.com \
--key sk-xxxxx

仅配额

uv run python scripts/query_usage.py \ --base-url https://your-new-api.example.com \ --key sk-xxxxx \ --quota-only

按模型聚合所有记录

uv run python scripts/query_usage.py \ --base-url https://your-new-api.example.com \ --key sk-xxxxx \ --all-records \ --by-model

选项

选项描述
--base-url必填。新 API 基础 URL,例如 https://xxx.com
--key
必填。API 密钥 | | --today | 仅保留今日记录(默认) | | --all-records | 禁用今日筛选 | | --limit N | 表中显示的记录数(默认:100) | | --by-model | 按模型显示分组使用情况 | | --quota-only | 仅显示配额/余额 | | --json | 打印原始 JSON 数据 | | --timeout | HTTP 超时秒数(默认:15) |

API 端点

  • - GET /api/usage/token/
  • GET /api/log/token?key={api_key}

备注

  • - 脚本中的配额换算使用 500000 配额 = $1。
  • --today 使用本地时区的日期边界。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 new-api-usage-1776199910 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 new-api-usage-1776199910 技能

通过命令行安装

skillhub install new-api-usage-1776199910

下载

⬇ 下载 new-api-usage v1.0.1(免费)

文件大小: 3.96 KB | 发布时间: 2026-4-15 14:00

v1.0.1 最新 2026-4-15 14:00
**Requires explicit base URL and API key for all queries. Safer, manual-only usage.**

- Removed auto-detection and config reading; now requires `--base-url` and `--key` for every query.
- No more local config or keychain access; never prints full API keys in output.
- Added safety rules: only allows read-only GET requests, asks for user confirmation on unknown endpoints.
- Updated documentation and usage examples to reflect manual, explicit workflow.
- Refined option descriptions and usage instructions.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部