Skip to main content

Interactive TUI for querying sub2api backend usage stats (Claude / OpenAI / Gemini)

Project description

sub2api-usage

CI PyPI Python License: MIT

sub2api 后台用量查询的命令行工具。终端里直接看请求数、Token、成本、明细,支持今天 / 7 天 / 30 天 / 全部切换。

安装

# 推荐:uv tool install (隔离环境)
uv tool install sub2api-usage

# 或者用 pipx
pipx install sub2api-usage

# 或者直接 pip
pip install sub2api-usage

用法

# 首次运行会引导填写账号、密码、后台地址、时区,
# 配置保存到 ~/.config/sub2api-usage/config.json (chmod 600)
sub2api-usage

# 重新配置账号
sub2api-usage setup

# 非交互打印 (脚本 / 管道用)
sub2api-usage print
sub2api-usage print --period week --list --page-size 20
sub2api-usage print --period month --json

交互面板键位

功能
1 / 2 / 3 / 4 今天 / 7 天 / 30 天 / 全部
/ 在标签间切换
n / p 下一页 / 上一页
r 刷新
q 退出

单位

数量统一用计算机领域的 K/M/G/T,耗时按 ms/s/min/h/d 自动选择最适合的尺度。

开发

git clone https://github.com/kadaliao/sub2api-usage.git
cd sub2api-usage
uv sync
uv run sub2api-usage --help

发布流程

CI 在每次 push 都会构建包;推 v*.*.* tag 时通过 Trusted Publishing 自动发布到 PyPI。

git tag v0.1.0
git push --tags

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sub2api_usage-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sub2api_usage-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file sub2api_usage-0.1.0.tar.gz.

File metadata

  • Download URL: sub2api_usage-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sub2api_usage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e7258f468c432e1fd80443239026f0b069eb76a85652a6a6b15119ea43401e10
MD5 b324f6d69b69ec21e6a587f4161b12d9
BLAKE2b-256 a7ed4d21688e0a672c4df6d4443fede31f1d938fd51421c0aca11aca3745f010

See more details on using hashes here.

Provenance

The following attestation bundles were made for sub2api_usage-0.1.0.tar.gz:

Publisher: publish.yml on kadaliao/sub2api-usage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sub2api_usage-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sub2api_usage-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sub2api_usage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74e5d5b7c2bfa18d7ae31b6d18b4e74bf748230dd1af1527a7165b1bd1fea9ef
MD5 9b90b8b2867780682b3bfda76a81f5dd
BLAKE2b-256 1e269d1daa4152188dd35f0e9693738d520c14b15c7387f4609a2293e280bcc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sub2api_usage-0.1.0-py3-none-any.whl:

Publisher: publish.yml on kadaliao/sub2api-usage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page