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, session name (up to 10 characters), first-prompt preview (up to 20 characters), GitHub repository, usage, and language.
- 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.5
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.5.tar.gz | 13.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| artificial_intelligence_usage-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.5 kB
Release files / artificial_intelligence_usage-0.0.5.tar.gz
| Download URL | artificial_intelligence_usage-0.0.5.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6e0a2e41ef0f4263c3fa2988fd7033a11b9e43df86ecea8bd965923d20f814e
|
|
BLAKE2b-256 checksum How to use checksums |
7209c413cc8de3fba53b17258f3b81937be4308a9ccfc2897d29b89ba8058bff
|
| 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.5-py3-none-any.whl
| Download URL | artificial_intelligence_usage-0.0.5-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c2f6a738602cfd6dff875f2509faf1ea516de687ec1315bd2b780a20e8a105f
|
|
BLAKE2b-256 checksum How to use checksums |
dcd1caa510b0f62fb20b69ed805aaf884372dabdb971691860d5696cc338abd1
|
| 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.5
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.