Query claude-relay-service usage and limits using your local Codex config
Project description
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 拉取使用量。
快速开始
最简单的方式(无需安装):
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]
常用参数:
--provider <name>只查指定 provider--key <key> --base-url <url>跳过 codex 解析,直接查任意 CRS 实例--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 from env:CRS_OAI_KEY
Key: my-key id=07825a09-... active=true expires=never
Usage (total):
Requests : 72,642
Tokens : 5,548,253,083 (in 436,025,255 / out 29,521,295 / cache_create 64,869,062 / cache_read 5,017,837,471)
Cost : $2961.17
Limits:
Daily Cost : $19.7727 / $100.0000 (19.8%)
Total Cost : unlimited
Rate Window: 13/100 req, 234,567/1,000,000 tok, $0.4500/$10.0000 window=60m 剩余 12m34s
要求
- Python ≥ 3.11(依赖 stdlib
tomllib,零第三方依赖) - 一个本地
~/.codex/config.toml配置(或通过--key--base-url直接指定)
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crs_usage-0.1.0.tar.gz.
File metadata
- Download URL: crs_usage-0.1.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd0a9fe182ef477c05c5cb4c3116b93e4f9982f8a2306584d92816b3492db3f9
|
|
| MD5 |
c93a2939169bebd96122e45a32942423
|
|
| BLAKE2b-256 |
e233fd3be516935eaf6ab05d1d30830663e5d2f8fbab78925971dad8625d6900
|
Provenance
The following attestation bundles were made for crs_usage-0.1.0.tar.gz:
Publisher:
release.yml on kadaliao/crs-usage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crs_usage-0.1.0.tar.gz -
Subject digest:
fd0a9fe182ef477c05c5cb4c3116b93e4f9982f8a2306584d92816b3492db3f9 - Sigstore transparency entry: 1572880969
- Sigstore integration time:
-
Permalink:
kadaliao/crs-usage@6e8e2e44607c700a756a0bc432338ec9888a4229 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/kadaliao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6e8e2e44607c700a756a0bc432338ec9888a4229 -
Trigger Event:
push
-
Statement type:
File details
Details for the file crs_usage-0.1.0-py3-none-any.whl.
File metadata
- Download URL: crs_usage-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a81cbbd3c81e5be163f81a46bd5851284a29c4f526d75964c40cdb287ed40597
|
|
| MD5 |
40f704ddd3a135b746a7a0038fb68e5c
|
|
| BLAKE2b-256 |
811cc4dbbc580942b4f3a54dc9017c98a73ab424cd03c5b0b6aa6ffa7a5b6af0
|
Provenance
The following attestation bundles were made for crs_usage-0.1.0-py3-none-any.whl:
Publisher:
release.yml on kadaliao/crs-usage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crs_usage-0.1.0-py3-none-any.whl -
Subject digest:
a81cbbd3c81e5be163f81a46bd5851284a29c4f526d75964c40cdb287ed40597 - Sigstore transparency entry: 1572881021
- Sigstore integration time:
-
Permalink:
kadaliao/crs-usage@6e8e2e44607c700a756a0bc432338ec9888a4229 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/kadaliao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6e8e2e44607c700a756a0bc432338ec9888a4229 -
Trigger Event:
push
-
Statement type: