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, followed by the latest versions published under their official
npm packages. Latest-version checks require network access and display
UNKNOWNwhen a lookup fails. - 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), model, GitHub repository, usage, and language. When a session
records multiple models, the table shows the first one. 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.8
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 | Actions |
|---|---|---|---|---|
| artificial_intelligence_usage-0.0.8.tar.gz | 14.7 kB | Without provenance | Details for artificial_intelligence_usage-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| artificial_intelligence_usage-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for artificial_intelligence_usage-0.0.8-py3-none-any.whl |
Total release size: 24.9 kB
Release files / artificial_intelligence_usage-0.0.8.tar.gz
| Download URL | artificial_intelligence_usage-0.0.8.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fd2ae3f98c986b47527ac4588366569a8eac2d0038f602950f90bbd0c95bfe6
|
|
BLAKE2b-256 checksum How to use checksums |
6de3fb5ed2db53aaefaf2d74a84b7dd75620b62750a6510e5d3f46be3db250fa
|
| 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.8-py3-none-any.whl
| Download URL | artificial_intelligence_usage-0.0.8-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c9dfe3d210fb062086a532baff2c86b7a21fe81388d79ab9f40a229be4c051c
|
|
BLAKE2b-256 checksum How to use checksums |
1bcc56de83dfa23aae098a7b86c008280542956f6aff6d42e68d418fe0f5dc1f
|
| 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.8
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.