Skip to main content

py3status-claude-usage

py3status module that shows Claude Code subscription usage (5-hour and 7-day windows) in the i3 bar. One module instance per Claude account.

Personal 49%▄2h13m 77%▆2d11h

Data comes from https://api.anthropic.com/api/oauth/usage, authenticated with the OAuth token in <path>/.credentials.json. The module never refreshes the token (that would rotate the refresh token and log Claude Code out); if the token is expired the bar keeps its last values until Claude Code renews it.

Configuration

claude_usage personal {
    name = 'Personal'          # label, {name}
    path = '~/.claude'         # dir with .credentials.json
    cache_timeout = 300        # seconds between queries (keep >= 60)
    # format is optional:
    format = '{name} {hourly_percent}%{hourly_chart}{hourly_time_remain} {weekly_percent}%{weekly_chart}{weekly_time_remain}'
}
claude_usage abc {
    name = 'ABC'
    path = '~/.claude-abc'
}
order += "claude_usage personal"
order += "claude_usage abc"

Placeholders: {name} {hourly_percent} {hourly_chart} {hourly_time_remain} {weekly_percent} {weekly_chart} {weekly_time_remain}.

The chart is one glyph from blocks (default _▁▂▃▄▅▆▇█, as in battery_level), coloured green 0-75, yellow 76-89, red 90-100. Change with thresholds (a list, or a dict keyed by hourly_percent / weekly_percent) and color_good / color_degraded / color_bad. See examples/i3status.conf.

Installing into py3status

py3status finds third-party modules in two ways.

A. Include path (no pip, recommended on Debian with distro py3status).

mkdir -p ~/.config/py3status/modules
cp contrib/py3status_shim.py ~/.config/py3status/modules/claude_usage.py
# edit the sys.path line if the repo is not in ~/projects/i3status-claude

Needs only requests (python3-requests).

B. Entry point (pip). Install into the interpreter that runs py3status:

pip install py3status-claude-usage                      # from PyPI
uv tool install py3status --with py3status-claude-usage # uv tool, from PyPI
uv pip install --system --break-system-packages -e .   # from a checkout, distro py3status
uv tool install py3status --with /path/to/i3status-claude   # from a checkout

Then:

  1. Add the blocks and order += lines to ~/.config/i3/i3status.conf.
  2. Check: py3status modules list | grep claude_usage
  3. Reload: i3-msg restart; refresh one instance: py3-cmd refresh "claude_usage personal"
  4. Debug: py3status -c ~/.config/i3/i3status.conf -l ~/py3status.log -d

Development

uv sync                      # creates .venv with pytest + responses
uv run pytest
uv run python -m py3status_claude_usage.claude_usage ~/.claude   # one live query

Releasing

  1. Move the [Unreleased] changelog entries under a new version heading and bump version in pyproject.toml.
  2. uv run pytest && uv build
  3. Tag: git tag vX.Y.Z && git push --tags
  4. Publish: uv publish (with a PyPI API token via UV_PUBLISH_TOKEN), or let the Publish GitHub workflow do it on a published release (PyPI trusted publishing).

Metadata

Release files for py3status-claude-usage 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py3status-claude-usage 0.1.0
File Size Uploaded Provenance Actions
py3status_claude_usage-0.1.0.tar.gz 6.1 kB Without provenance Details for py3status_claude_usage-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py3status-claude-usage 0.1.0
File Interpreter ABI Platform Actions
py3status_claude_usage-0.1.0-py3-none-any.whl Python 3 none any Details for py3status_claude_usage-0.1.0-py3-none-any.whl

Total release size: 14.5 kB

Release files / py3status_claude_usage-0.1.0.tar.gz

Download URL py3status_claude_usage-0.1.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1528bbfd6bba757659416f1087e35346c8a26cc6b9ba590b60a14de4d223eed3
BLAKE2b-256 checksum
How to use checksums
de12d785314b216bb356edb3f8f463c64779b760d73d0da367670fbb3e7a9963
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":null,"id":"forky","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / py3status_claude_usage-0.1.0-py3-none-any.whl

Download URL py3status_claude_usage-0.1.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44fc4cf6c9bb522b56c65fe0d9d82ec7af22275a76bdb44a29dbae2c4fc419b6
BLAKE2b-256 checksum
How to use checksums
d0532f81474e0c372ccbc226f5ed9d3de9fe2f933822e9dff62a5388056e049c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":null,"id":"forky","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for py3status-claude-usage 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page