Skip to main content

codex-usage

CLI tool to track OpenAI Codex usage with multi-account support and automatic account cycling.

Features

  • Usage Tracking: Check 5-hour and weekly usage limits for Codex CLI accounts
  • Multi-Account Management: Add, switch, remove, and list multiple Codex accounts
  • Automatic Cycling: Automatically switch accounts when usage limits are exhausted
  • Multiple Output Formats: Table, JSON, and compact oneline formats
  • Caching: 5-minute cache to reduce API calls

Installation

macOS

# Using Homebrew (coming soon)
brew install Liam-Deacon/tap/codex-usage

Linux

# Download from releases
curl -L https://github.com/Liam-Deacon/codex-usage/releases/latest/download/codex-usage-x86_64-unknown-linux-gnu -o codex-usage
chmod +x codex-usage
sudo mv codex-usage /usr/local/bin/

Windows

# Using Scoop (coming soon)
scoop bucket add Liam-Deacon https://github.com/Liam-Deacon/scoop-bucket
scoop install codex-usage

Node.js (npx / bunx)

npx codex-usage-cli --help
bunx codex-usage-cli --help

Python (uvx)

uvx codex-usage --help

Docker

docker pull ghcr.io/liam-deacon/codex-usage:latest
docker run --rm ghcr.io/liam-deacon/codex-usage:latest --help

Build from Source

cargo build --release
sudo cp target/release/codex-usage /usr/local/bin/

Quick Start

  1. Login to Codex (if not already):

    codex login
    
  2. Add your account:

    codex-usage accounts add myaccount
    
  3. Check usage:

    codex-usage status
    

Usage

Check Usage

# Check active account usage
codex-usage status

# Check all connected accounts
codex-usage status --all

# Output as JSON
codex-usage status --json

# Compact oneline output
codex-usage status --oneline

# Force refresh (skip cache)
codex-usage status --refresh

Account Management

# List all connected accounts
codex-usage accounts list

# Add current Codex auth as new account
codex-usage accounts add myaccount

# Switch to another account
codex-usage accounts switch myaccount

# Switch with force (override safety check)
codex-usage accounts switch myaccount --force

# Remove an account
codex-usage accounts remove myaccount

Automatic Cycling

Configure automatic account switching when usage limits are exhausted:

# Show cycle status
codex-usage cycle status

# Configure thresholds
codex-usage cycle config --five-hour 0 --weekly 10 --mode or

# Enable cycling
codex-usage cycle enable

# Disable cycling
codex-usage cycle disable

# Manually trigger cycle check
codex-usage cycle now

# View cycle history
codex-usage cycle history

# Reorder accounts in cycle
codex-usage cycle reorder account1 account2 account3

Wakeup

Trigger Codex to utilize daily/weekly limits:

# Run wakeup now
codex-usage wakeup --run

# Run wakeup for specific account
codex-usage wakeup --run --account myaccount

# Force wake even if Codex is running
codex-usage wakeup --run --force

# Install wakeup schedule (e.g., daily at 8am and 2pm)
codex-usage wakeup install --at 08:00 --at 14:00

# Install with interval between --at times
codex-usage wakeup install --at 08:00 --interval 1h

# List current wakeup schedules
codex-usage wakeup list

# Remove wakeup schedule
codex-usage wakeup remove

# Attempt to wake system from sleep (macOS)
codex-usage wakeup --run --wake-system

Watch

Continuously monitor usage with live updates:

# Watch active account (default 10s interval)
codex-usage watch

# Watch with custom interval
codex-usage watch --interval 30s

# Watch all accounts
codex-usage watch --all

# Force refresh on each poll (skip cache)
codex-usage watch --refresh

History

Track and analyze usage over time:

# Manage background recording daemon
codex-usage history daemon start --interval 5m
codex-usage history daemon stop
codex-usage history daemon status

# Show usage history
codex-usage history show
codex-usage history show --period week
codex-usage history show --from 2025-01-01 --to 2025-01-31
codex-usage history show --account myaccount

# Show terminal bar chart
codex-usage history chart
codex-usage history chart account1 account2

# Show allowance analysis
codex-usage history allowance
codex-usage history allowance --projected
codex-usage history allowance --dead-time

# Configure notifications
codex-usage history notify --enable
codex-usage history notify --disable
codex-usage history notify --hours-before 2
codex-usage history notify --status

# Export history data
codex-usage history export
codex-usage history export --output usage.json
codex-usage history export --period month --format json

Configuration

Config Directory

Default: ~/.codex-usage/

Override with:

codex-usage --config-dir /path/to/config status

Or set environment variable:

export CODEX_USAGE_DIR=/path/to/config

Files

  • config.json - Main configuration
  • accounts/ - Stored account auth files
  • cycle.json - Cycle configuration
  • cycle_history.jsonl - Cycle history
  • usage_cache.json - Usage data cache
  • wakeup.json - Wakeup configuration

Environment Variables

Variable Description
CODEX_USAGE_DIR Override config directory
CODEX_USAGE_VERBOSE Enable verbose logging

License

MIT License - see LICENSE file.

Related

Release files for codex-usage 0.1.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codex-usage 0.1.19
File Size Uploaded
codex_usage-0.1.19.tar.gz 80.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for codex-usage 0.1.19
File
codex_usage-0.1.19-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
codex_usage-0.1.19-cp38-abi3-manylinux_2_39_x86_64.whl CPython 3.8 abi3 Linux glibc 2.39+ x86-64 Details
codex_usage-0.1.19-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
codex_usage-0.1.19-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 10.8 MB

Release files / codex_usage-0.1.19.tar.gz

Download URL codex_usage-0.1.19.tar.gz
Size 80.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8a308a451ae48bbabc23b794aa9a4559443a4c37bb2eb80799a4b014a7b88586
BLAKE2b-256 checksum
How to use checksums
cccf6a846470169931854fcfd32f39ddfaf43a7e97a75377bd99de1487b137b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.

Transparency log

Release files / codex_usage-0.1.19-cp38-abi3-win_amd64.whl

Download URL codex_usage-0.1.19-cp38-abi3-win_amd64.whl
Size 2.6 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
69dc06f01f049b49ae614ab5c2556a6a99936778d59a7ce7bee08aed6d966c5b
BLAKE2b-256 checksum
How to use checksums
71267434753b23dafa67d0da99d4c2308674eb4e056d80ec4f93598618ef8eb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.

Transparency log

Release files / codex_usage-0.1.19-cp38-abi3-manylinux_2_39_x86_64.whl

Download URL codex_usage-0.1.19-cp38-abi3-manylinux_2_39_x86_64.whl
Size 2.9 MB
Tags CPython 3.8 Linux glibc 2.39+ x86-64 abi3
SHA-256 checksum
How to use checksums
b6d4c88d1028d76b91b25c0e74f906cde443157eb1411a1060db3d499a566897
BLAKE2b-256 checksum
How to use checksums
ab5f945deefab9a9e6eb13d891860c93f6ba19c94f415aa6df2c5ba31d8f0e61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.

Transparency log

Release files / codex_usage-0.1.19-cp38-abi3-macosx_11_0_arm64.whl

Download URL codex_usage-0.1.19-cp38-abi3-macosx_11_0_arm64.whl
Size 2.5 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ef7c776eaef6bfb9ce934cd7dd3258ef1c74cc9bac2f5c7d72ffcbfd7ad5101e
BLAKE2b-256 checksum
How to use checksums
880810b326d2c6d1053575b699d8421c0fd4a55013640bb706d841cfe28ab0bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.

Transparency log

Release files / codex_usage-0.1.19-cp38-abi3-macosx_10_12_x86_64.whl

Download URL codex_usage-0.1.19-cp38-abi3-macosx_10_12_x86_64.whl
Size 2.7 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
025b882557a910162af4b276363ba004e5f3850d24f2187090a726e70d65ace1
BLAKE2b-256 checksum
How to use checksums
f2cc91bb1bda8fd6fee9a4bfa277b7fc7b5a7242ed9fcd7098aa20ba68247cfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.19 This release

5 release files

0.1.18

5 release files

0.1.17

5 release files

0.1.16

5 release files

0.1.15

5 release files

0.1.14

5 release files

0.1.13

5 release files

0.1.12

5 release files

0.1.11

5 release files

0.1.10

5 release files

0.1.8

5 release files

0.1.7

5 release files

0.1.6

5 release files

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