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.
  • Reports when the Codex or Claude CLI is not available on PATH.
  • 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.2

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.2
File Size Uploaded
artificial_intelligence_usage-0.0.2.tar.gz 8.5 kB Details

Built distribution (wheel)

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

Total release size: 14.7 kB

Release files / artificial_intelligence_usage-0.0.2.tar.gz

Download URL artificial_intelligence_usage-0.0.2.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a63f1bcd1a4f2a8ee99fe8e5e73c526f6f446a821fd9471366b545d60a8cdc30
BLAKE2b-256 checksum
How to use checksums
d05febaf72456a40311d12eec604611f59d967bc6f4dfb3388427ea1634e282d
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.2-py3-none-any.whl

Download URL artificial_intelligence_usage-0.0.2-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bca520226ad333771f2b0eb3cb18656a0d3ac3662702f5c53ea0a2b7ffcba63c
BLAKE2b-256 checksum
How to use checksums
b1dca8805f7d4336a71e7ec7fbd7f9ed68053bdeecae9186bbf3bef6982dd2b3
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

0.0.4

2 release files

0.0.3

2 release files

This release

0.0.2 This release

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