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 by default and are written by the Codex CLI on login. When CODEX_HOME is set, the direct compatibility fallback reads $CODEX_HOME/auth.json. The preferred app-server path leaves credential resolution to Codex.

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)

Metadata

Release files for codex-cli-usage 0.1.10

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-cli-usage 0.1.10
File Size Uploaded
codex_cli_usage-0.1.10.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codex-cli-usage 0.1.10
File Interpreter ABI Platform
codex_cli_usage-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 23.4 kB

Release files / codex_cli_usage-0.1.10.tar.gz

Download URL codex_cli_usage-0.1.10.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2183f345cee8bccba3a864332420d78c0c9a8e2f9b7667041d4b40029c4a6885
BLAKE2b-256 checksum
How to use checksums
7f3ef0f925ee47c7249c66cb210439fe0e40e75c9259d6eb19b972312b697f6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / codex_cli_usage-0.1.10-py3-none-any.whl

Download URL codex_cli_usage-0.1.10-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8749c1ed8d8a7f54b9892df0df0d361648093045d1a4f8b1fa8e4fa9dd55ffa
BLAKE2b-256 checksum
How to use checksums
310b18595a502e20d5cf34ee302d47201a110d5468c893a6a9ce0a22af4d780d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.0

2 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