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 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), 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 is In progress.
  • Reads session names from ~/.codex/session_index.jsonl. Missing names and prompts display as Unknown.
  • For goal-only sessions, reads the goal objective from ~/.codex/goals_1.sqlite for the prompt preview and reports its language as Unknown.
  • Uses langid, restricted to English and Spanish, for prompt language detection. Sessions without a detectable user prompt show Unknown.
  • 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
  • langid 1.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.7

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.7
File Size Uploaded Provenance Actions
artificial_intelligence_usage-0.0.7.tar.gz 13.8 kB Without provenance Details for artificial_intelligence_usage-0.0.7.tar.gz

Built distribution (wheel)

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

Total release size: 23.4 kB

Release files / artificial_intelligence_usage-0.0.7.tar.gz

Download URL artificial_intelligence_usage-0.0.7.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f23b1ec254710a758173ff745dc9637457ef51f92d81f595d048a71ee2612c8b
BLAKE2b-256 checksum
How to use checksums
e616983c28b49656de4381eb2cea84f34b9790339ff55b53f984ddec6858c14a
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.7-py3-none-any.whl

Download URL artificial_intelligence_usage-0.0.7-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d0502eac0e9d55c6726853d27a0cdd8490e8d7dff93dfb00a74425d30c07d38
BLAKE2b-256 checksum
How to use checksums
23db066f00ee2406cfadc57fdbef3b2f44629dba23903f3fb5ee43625924b600
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.7

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.

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