Skip to main content

codex-cli-usage

Codex CLI usage monitor. Fetches your rate limit data through Codex and displays it in the terminal.

Example output

codex-cli-usage command:

Plan: plus
  Weekly               39%  resets 143h26m

Codex statusline (self-caching — refreshes from API when stale, no daemon needed):

weekly:39% plus reset:143h26m

Install

uv tool install codex-cli-usage

Then run:

# Check usage once
codex-cli-usage

# Run the daemon (keeps usage-limits.json updated)
codex-cli-usage daemon

Commands

Command Description
codex-cli-usage Show current usage (colored terminal output)
codex-cli-usage json Print raw JSON
codex-cli-usage daemon [-i SECS] Run in foreground, refresh every 5 min (customizable)
codex-cli-usage statusline Compact statusline (self-caching, no daemon needed)
codex-cli-usage install Print setup instructions

How Codex CLI rate limiting works

Discovered by inspecting the Codex CLI and its authentication flow.

Data sources

codex-cli-usage gets rate limit data from:

  1. codex app-server --stdio — Preferred. Codex owns authentication and returns rate limits through account/rateLimits/read.
  2. /backend-api/codex/usage endpoint — Compatibility fallback when Codex is missing or its app-server does not support the rate-limit method.

Rate limit types

Type Description
primary_window Primary window; duration comes from limit_window_seconds
secondary_window Secondary window; duration comes from limit_window_seconds
additional_rate_limits Per-model limits (e.g. specific model caps)
code_review_rate_limit Code review usage limit

Window names are derived from limit_window_seconds, not from whether the backend calls a window primary or secondary. Approximately 5-hour, daily, weekly, monthly, and annual windows receive duration labels. Other or missing durations are shown as Primary or Secondary. Additional per-model limits remain available in JSON for compatibility but are not shown in normal output.

Cache format

Schema version 2 stores aggregate windows by their backend role while retaining their actual duration:

{
  "schema_version": 2,
  "primary": {
    "pct": 39,
    "resets_at": "2026-07-18T20:00:00+00:00",
    "window_secs": 604800
  }
}

Legacy 5h and 7d aliases are written only when the corresponding aggregate window actually classifies as 5-hour or weekly. Readers should prefer primary and secondary.

Authentication

The OAuth tokens live at ~/.codex/auth.json, written by the Codex CLI on login.

Codex owns automatic token refresh and credential persistence. The compatibility fallback reads auth.json but never modifies credentials.

Local files

File Written by Contains
~/.codex/auth.json Codex CLI OAuth tokens (access, refresh, id_token)
~/.codex/usage-limits.json codex-cli-usage daemon Cached API usage data (this tool)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codex_cli_usage-0.1.8.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codex_cli_usage-0.1.8-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file codex_cli_usage-0.1.8.tar.gz.

File metadata

  • Download URL: codex_cli_usage-0.1.8.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codex_cli_usage-0.1.8.tar.gz
Algorithm Hash digest
SHA256 cf8cc091d02528fe0eae98e26ffaace3554020dd355a7b511217f54127bef244
MD5 db13bed99bfceeee64b27d843fe43b0a
BLAKE2b-256 d07998aa875855eb479760e7e8d9814bf1a17770591ce6f8e3364b87c695feb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_cli_usage-0.1.8.tar.gz:

Publisher: publish.yml on wakamex/codex-cli-usage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codex_cli_usage-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for codex_cli_usage-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fbb88ce4b01913c44c29a9549b6e4916633864bc7d83cddfc137c9b7acde86a3
MD5 737596251dfc7eb40c82944a47d8d14c
BLAKE2b-256 d7754b2151a4fc23d689c334c808c2ee285ba850e661701333fc6727c157bad9

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_cli_usage-0.1.8-py3-none-any.whl:

Publisher: publish.yml on wakamex/codex-cli-usage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.10

2 files

0.1.9

2 files

This release

0.1.8 This release

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.0

2 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