mirror of
https://github.com/openai/codex.git
synced 2026-12-03 00:41:03 +00:00
## Why Clients need to show the spend and cap for the account behind a thread's model provider. The existing ChatGPT usage read cannot provide those figures for a gateway account. ## What changed - Route `account/rateLimits/read` through the provider's configured `usage_url` using the provider's credentials. An optional `threadId` selects a loaded thread's provider for the account-wide read. Omitting it selects the default provider. - Return `usageUnavailable` for a thread whose provider has neither a usage endpoint nor first-party authentication. Surface gateway errors without falling back to ChatGPT usage. - Report monthly gateway spend in `individualLimit` as exact USD decimal strings, with `limit: "unlimited"` for uncapped accounts. Use `spendControlReached` for the gateway's cap status. Spend snapshots identify their unit as `usd` or `credit`, with omitted units defaulting to `credit` for compatibility. ## Testing Add integration coverage for thread-specific provider selection, gateway usage taking precedence over ChatGPT without fallback, and reuse of an existing gateway OAuth session without interactive login. GitOrigin-RevId: e6ec9d83eecc3084fcc98e72e2c031bd3e53a2cd