Artificial Intelligence Usage
artificial-intelligence-usage analyzes local Codex session rollouts and prints a summary of the
latest session followed by daily and per-session prompt, 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.
- Breaks applied prompts down into Normal, Plan, and Goal counts. Goal counts include automatic goal continuations, while background tasks such as guardian reviews are excluded.
- Shows a second table with one row per session, including its start time,
finish time, session name (up to 10 characters), first-prompt preview (up to
20 characters), GitHub repository, usage, and language. A session is finished
when its final rollout event is
task_complete; otherwise its finish value isIn progress. - Reads session names from
~/.codex/session_index.jsonl. Missing names and prompts display asUnknown. - For goal-only sessions, reads the goal objective from
~/.codex/goals_1.sqlitefor the prompt preview and reports its language asUnknown. - Uses
langid, restricted to English and Spanish, for prompt language detection. Sessions without a detectable user prompt showUnknown. - 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
langid1.1.6 (installed automatically with the package)
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.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| artificial_intelligence_usage-0.0.6.tar.gz | 13.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| artificial_intelligence_usage-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.1 kB
Release files / artificial_intelligence_usage-0.0.6.tar.gz
| Download URL | artificial_intelligence_usage-0.0.6.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d7d16f9fa1e2ea109defd4c1baa88e2842752e6e6c1742c8886555f43464258a
|
|
BLAKE2b-256 checksum How to use checksums |
1b020e38e2b35283947befc4ebb9e7869f854fa6705ccc5ca274cf57422525ee
|
| 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.6-py3-none-any.whl
| Download URL | artificial_intelligence_usage-0.0.6-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5fd3ab367d82714fcf70784f0b01286715a2638d3782a33126db82da37c2fd4
|
|
BLAKE2b-256 checksum How to use checksums |
a09fb0f095f908bfe3cb1150509433c4401645ec2d195011ccded14cc9371390
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for artificial-intelligence-usage 0.0.6
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.