← 返回
开发者工具 Key 中文

new-api-usage

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-l...
{ "answer": "查询用户指定 new-api 端点的用量统计与配额。适用于查询 API 配额、使用记录、Token 消耗等场景。" }
wang48
开发者工具 clawhub v1.0.1 1 版本 99795.1 Key: 需要
★ 0
Stars
📥 487
下载
💾 7
安装
1
版本
#latest

概述

New API Usage Query

Query quota and usage from a new-api deployment with explicit inputs.

Safety Rules

  • Require explicit --base-url and --key; never auto-read local config or keychain.
  • Never print the full API key in output.
  • Only perform read-only GET requests to usage endpoints.
  • If the endpoint is unknown, ask user to confirm before querying.

Usage

# Summary (today's records only)
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 \
  --quota-only

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

Options

OptionDescription
---------------------
--base-urlRequired. new-api base URL, e.g. https://xxx.com
--keyRequired. API key
--todayOnly keep today's records (default)
--all-recordsDisable today's filter
--limit NNumber of records shown in table (default: 100)
--by-modelShow grouped usage by model
--quota-onlyOnly show quota/balance
--jsonPrint raw JSON payload
--timeoutHTTP timeout seconds (default: 15)

API Endpoints

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

Notes

  • Quota conversion in script uses 500000 quota = $1.
  • --today uses local timezone date boundaries.

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-30 16:13 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,801
developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 427 📥 118,203
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 324,172