OpenAI Codex
The Codex provider reads your ChatGPT Codex rate-limit windows through the official ChatGPT OAuth flow. Because there is no personal usage API key, the provider authenticates with OAuth tokens instead.
Endpoint
Usage Dashboard queries GET /chatgpt.com/backend-api/wham/usage with the OAuth access token and the OpenAI-Beta: codex-1 header.
Authentication
On the Settings page, choose OpenAI Codex and follow the OAuth handshake. Access, refresh, and optional ID tokens are stored encrypted in the provider secret. Scheduled polling and manual refresh share the same credential lifecycle. They refresh before expiration and can retry usage once after an unexplained 401. Rotated tokens are saved before usage is requested, even if usage then fails. After a refresh, a six-hour cooldown prevents repeated exchanges when the new access token keeps receiving unexplained 401s. Successful usage or credential replacement clears the cooldown. A token with a confirmed expiration can still refresh during that window.
Expiration is read from OAuth metadata or, when available, the access token's exp claim. A legacy opaque token with no expiry or refresh timestamp gets one bootstrap refresh. If the replacement still has no expiry, future refreshes use its refresh age (eight days) or an unexplained 401, not every poll.
The API's POST /api/v1/configs/test checks an unsaved bundle without rotating it. Save the provider to enable refresh. Administrators can check a saved connection with POST /api/v1/configs/{id}/test; this can update encrypted OAuth credentials but does not write usage history.
Metrics
plan_type- your Codex plan.session_remaining_percent/session_reset_at- remaining in the current session window.weekly_remaining_percent/weekly_reset_at- remaining in the weekly window.reset_credits_available- credits available for a rate-limit reset.limit_reached- whether the current window is exhausted.review_session_remaining_percent/review_weekly_remaining_percent- code review windows, when present.
The provider card groups the session (5-hour) and weekly limits into usage-window sections that show the remaining percentage, a progress bar, and a "Resets …" timestamp in the viewer's local timezone whenever the provider supplies one.
Configure Codex as a subscription with your real commitment. Quota percentages are allowance state, not PAYG spend. Hermes can supply model/token workload for API-equivalent value when mapped to this provider.
Notes
- If the issuer rejects the refresh token as expired, revoked, or already used, reconnect the provider from Settings.
- If an exchange may have consumed the token but did not return a usable result (for example, a read timeout or an upstream 5xx), Usage Dashboard will not replay the token, including after a restart. Reconnect before refreshing again.
- Rate limits and failures to establish a connection pause refresh temporarily. An account or workspace access denial is distinct from refresh-token rejection: check account status, subscription, and workspace permissions before reconnecting. If the OAuth exchange itself rejects access or configuration, automatic refresh backs off for 24 hours. Successful usage or reconnecting with a fresh credential can clear the pause sooner.
- One provider configuration can own a refresh token. Import or sign in separately for each configuration. Existing configurations that share a token keep their history, but cannot refresh until reauthorized with separate credentials. Previously used tokens are retired on rotation, replacement, or deletion and cannot be re-imported. Use a fresh authorization when recreating a connection.