Skip to main content

Artificial Intelligence Usage

artificial-intelligence-usage analyzes local Codex session rollouts and prints a summary of the latest session followed by daily session, turn, token, and rate-limit usage.

Behavior

  • Reads rollout files below ~/.codex/sessions.
  • Shows the installed Codex and Claude CLI versions when those commands are available.
  • Shows status details from the most recently modified session.
  • Reports sessions from the last 14 calendar days by default, including today.
  • Counts user turns and cumulative tokens for each session.
  • Shows the remaining five-hour and weekly allowance recorded in each day's last session.
  • Ignores malformed JSON lines and incomplete status events.

The tool only reads local session files and does not modify them.

Requirements

  • Python 3.10 or newer

Building

Testing

Run the unit tests from the project root:

python3 -m unittest discover -s tests -v

Package artifact

Build and validate the package artifacts:

./build-package.sh

This creates the wheel and source distribution under dist/ and checks the package metadata with Twine.

Publish artifact

Publish the generated artifacts to PyPI:

./publish-pypi.sh

The publish script checks that Twine is available, creates a local .venv for Twine when needed, verifies that dist/ contains generated artifacts, and then uploads them. If PyPI rejects a version that was already published, increment the version in pyproject.toml, rebuild, and publish again.

Install artifact

Install the package in a virtual environment:

python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install artificial-intelligence-usage

Usage

After installation, run:

artificial-intelligence-usage

Choose a different reporting window with --days:

artificial-intelligence-usage --days 30

From a source checkout, ./artificial-intelligence-usage.py is the canonical launcher and ./script-sessions.py remains available for compatibility.

Help

usage: artificial-intelligence-usage [-h] [--days DAYS]

Analyze recent Codex sessions.

options:
  -h, --help   show this help message and exit
  --days DAYS  number of calendar days to analyze, including today (default: 14)

Metadata

Release files for artificial-intelligence-usage 0.0.4

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

Source distribution (sdist)

Source distribution for artificial-intelligence-usage 0.0.4
File Size Uploaded
artificial_intelligence_usage-0.0.4.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for artificial-intelligence-usage 0.0.4
File Interpreter ABI Platform
artificial_intelligence_usage-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / artificial_intelligence_usage-0.0.4.tar.gz

Download URL artificial_intelligence_usage-0.0.4.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fc57ef7e3e877c3c3f5c479f31bfd0b21434bb2742e09b1c58ab90f8d64c0c43
BLAKE2b-256 checksum
How to use checksums
441be9e4345b4266ff2d69a5ca47ce1e619ec7b29bec673bcd8fee5bb22e9f62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / artificial_intelligence_usage-0.0.4-py3-none-any.whl

Download URL artificial_intelligence_usage-0.0.4-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac277a80479aed86e5025341a83c870d43ad47eda16cade36be2e18eed5e87ad
BLAKE2b-256 checksum
How to use checksums
47cc9bdbcc58389b178be27d91b6b366c595009b1418e680a75a05ecfcf5ac0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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