Files
codex/codex-rs/app-server-protocol/schema/json/v2/NullableGetAccountRateLimitsParams.json
T
alexsong-oai 986dc881be Expose gateway spend in app-server account rate limits (#65193)
## 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
2026-12-02 07:59:18 +00:00

35 lines
1.2 KiB
JSON
Generated

{
"$schema": "http://json-schema.org/draft-07/schema#",
"anyOf": [
{
"$ref": "#/definitions/GetAccountRateLimitsParams"
},
{
"type": "null"
}
],
"definitions": {
"GetAccountRateLimitsParams": {
"description": "Provider selection and client capabilities for an account rate-limit read.",
"properties": {
"excludeResetCreditDetails": {
"description": "Skip the separate reset-credit detail lookup for background usage polls. The usage response still includes the available count; omitted/false preserves detailed reads.",
"type": "boolean"
},
"supportsLunaReserve": {
"description": "The client supports automatic Luna Reserve fallback. For eligible ChatGPT CLI users, allow the backend to record experiment exposure after ordinary usage is blocked.",
"type": "boolean"
},
"threadId": {
"description": "Use the loaded thread's provider for this account-wide read. Omit for the default provider.",
"type": [
"string",
"null"
]
}
},
"type": "object"
}
},
"title": "Nullable_GetAccountRateLimitsParams"
}