Skip to content

feat: add Codex account usage summary to /usage#11177

Closed
abhi152003 wants to merge 1 commit into
NousResearch:mainfrom
abhi152003:feat/codex-usage-summary
Closed

feat: add Codex account usage summary to /usage#11177
abhi152003 wants to merge 1 commit into
NousResearch:mainfrom
abhi152003:feat/codex-usage-summary

Conversation

@abhi152003

Copy link
Copy Markdown

Summary

  • Adds a new hermes_cli/codex_usage.py module that fetches live quota usage
    from the OpenAI Codex API (chatgpt.com/backend-api/wham/usage) using the
    user's stored auth token
  • Surfaces primary_window (e.g. 3h) and secondary_window (e.g. Day/Week)
    quota percentages with countdown-to-reset timers in the /usage command
  • Integrates into both the CLI (cli.py) and Gateway (gateway/run.py) usage
    displays, gated behind is_codex_provider() so it only activates when the
    agent is configured for the Codex provider

Details

  • CodexUsageSnapshot / CodexUsageWindow — frozen dataclasses representing
    the parsed API response
  • fetch_codex_usage_snapshot() — injectable get callable for testability,
    handles both reset_at (epoch) and reset_after_seconds offset fields
  • format_codex_usage_summary() — compact one-liner for status bars
  • format_codex_usage_report_lines() — verbose multi-line output with plan
    info for /usage
  • All integration points wrapped in try/except Exception: pass — silently
    skipped if Codex is not configured or auth is unavailable

Screenshots

image image

@teknium1

Copy link
Copy Markdown
Contributor

Superseded by PR #13428#13428 (merged).

#13428 lands the more complete three-provider implementation (OpenAI Codex + Anthropic OAuth + OpenRouter) that was originally submitted in PR #2486. Your Codex-only summary covered the same ground for one provider, but we went with the broader module since it also handles Anthropic OAuth and OpenRouter credits/key quotas.

Thanks for the contribution!

@teknium1 teknium1 closed this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants