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 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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| artificial_intelligence_usage-0.0.1.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| artificial_intelligence_usage-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.3 kB
Release files / artificial_intelligence_usage-0.0.1.tar.gz
| Download URL | artificial_intelligence_usage-0.0.1.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3eea15dd4320009e5945cf1dcfafaf3276b758e800c9de95667d482ca67ffb36
|
|
BLAKE2b-256 checksum How to use checksums |
7019e936ed4f62936d0bda09f4b6dfa2adf6d87f0bc16514b38af26bffb4bbb9
|
| 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.1-py3-none-any.whl
| Download URL | artificial_intelligence_usage-0.0.1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
edcc049ed2ac1c25f533a28d851844ae6d76c15c35ef7db8aa4bad9e3e63ec21
|
|
BLAKE2b-256 checksum How to use checksums |
995e0e9f7a91bd3dd34b09977e55af14699e28c7022bee90e8eb9b27cc8b1b95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|