A previous release had provenance metadata, but this release does not. View details.
crs-usage
通过本地 Codex 配置查询 claude-relay-service 用量、限额、速率窗口与模型细分的 CLI。零依赖,单文件实现。
读 ~/.codex/config.toml 的 [model_providers.*],按 provider 的 env_key 或 ~/.codex/auth.json 解析 API key,并发调用:
{base_origin}/apiStats/api/user-stats— 累计用量、限额、速率窗口{base_origin}/apiStats/api/user-model-stats— 按 daily / monthly / alltime 拆分的模型细分
快速开始
最简单的方式(无需安装):
uvx crs-usage
或直接从 GitHub 跑:
uvx --from git+https://github.com/kadaliao/crs-usage crs-usage
也可以装到本地工具集:
uv tool install crs-usage
crs-usage
用法
crs-usage [--provider NAME] [--key KEY] [--base-url URL]
[--config PATH] [--auth PATH] [--json] [--timeout SEC]
[--period {daily,monthly,alltime,all}] [--top N]
[--no-models] [--wide]
常用参数:
--provider <name>只查指定 provider--key <key> --base-url <url>跳过 codex 解析,直接查任意 CRS 实例--period <p>模型细分时段,默认all(同时拉 daily / monthly / alltime)--top N文本输出每个时段展示前 N 个模型,默认 5;0表示全部--no-models关闭模型细分查询(只看用量/限额)--wide文本输出使用完整数字(默认按 K/M/B 紧凑显示)--json输出原始 JSON(含模型细分,适合jq)--timeout <sec>HTTP 超时,默认 15
Key 解析优先级
--key命令行参数[model_providers.<name>].env_key指定的环境变量(如CRS_OAI_KEY)~/.codex/auth.json中的OPENAI_API_KEY
输出示例
■ aihezu https://cc.aihezu.dev key 来源 env:CRS_OAI_KEY
Key: Kada id=07825a09-37f3-46f7-b65f-847795eeb2f2 启用 永不过期
📊 累计用量
请求 72.9K Tokens 5.56B 费用 $2,977.1663
输入 438M / 输出 29.6M / 缓存创建 64.9M / 缓存读取 5.03B
💰 限额
今日费用 $9.1212 / $100.0000 (9.1%)
总费用 $2,977.1663(无上限)
速率窗口 未配置
🧠 模型细分
[今日] 3 个模型
模型 请求 Tokens 输入/输出 缓存写/读 费用
──────────── ──── ────── ────────── ───────── ───────
gpt-5.5 89 5.7M 553K/42.3K 0/5.1M $6.5654
gpt-5.4 57 2.4M 497K/35.6K 0/1.9M $2.2545
gpt-5.4-mini 6 388K 384K/2.9K 0/1.0K $0.3014
[本月] 4 个模型
...
[累计] 23 个模型
...
(还有 18 个模型未列出,--top 0 显示全部)
默认输出按 K/M/B 紧凑显示数字,宽度控制在约 80 列内。需要原始整数时加
--wide。 key 配置了 rate limit 窗口时,「速率窗口」会显示窗口长度(自动按Hh/m换算)、剩余时间,以及当前窗口内的请求数 / Tokens / 费用与对应限额。
要求
- Python ≥ 3.11(依赖 stdlib
tomllib,零第三方依赖) - 一个本地
~/.codex/config.toml配置(或通过--key--base-url直接指定)
License
Metadata
Release files for crs-usage 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Loss of provenance
These files do not have provenance metadata, despite files in a prior release including this data.
We recommend further investigation before installing these files. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| crs_usage-0.2.1.tar.gz | 9.6 kB | Without provenance | Details for crs_usage-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| crs_usage-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for crs_usage-0.2.1-py3-none-any.whl |
Total release size: 20.0 kB
Release files / crs_usage-0.2.1.tar.gz
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | crs_usage-0.2.1.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7430e0dc644353e6f18feffcd7eafb4db407c6f968432daa174d7303cbf0496
|
|
BLAKE2b-256 checksum How to use checksums |
a993565db469cdee6ed29207e743c7ff5a67faa0854abad5eddc288f64f54bcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / crs_usage-0.2.1-py3-none-any.whl
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | crs_usage-0.2.1-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d48b5b9f99a57535c9c1c78edd374522cf88ce41421bb5749a4ead30be5f25b
|
|
BLAKE2b-256 checksum How to use checksums |
9a05da47680abe7b38d550beb959bb7b9b8757c99c9d78e1730bb5ed04571642
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Security for crs-usage 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Loss of provenance
A previous release of these files had provenance metadata, but this release does not.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Release comparison
- Removed 0.1.0 2 files With provenance
- Added 0.2.1 2 files Without provenance
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.