Files
cc-switch/docs/guides
ellerty aa42a93d52 feat(codex): add configurable pre-exhaustion quota protection (#8395)
Add an opt-in guard that pauses official ChatGPT requests routed through the
Codex local proxy before the five-hour or weekly quota is exhausted, so Codex
does not fall into Reserve mode while third-party models stay usable.

- Read usage from the x-codex-* rate-limit headers on official responses and
  cache it per account; only query wham/usage (5s timeout) when no fresh
  reading exists (older than 5 minutes or past a window reset).
- Fail open: unknown or unreachable usage admits the request.
- Blocked requests get a local 403 with code cc_switch_codex_quota_protection
  and are not failed over.
- Disabled by default; thresholds (default 95% five-hour / 98% weekly) are
  configurable under Settings -> App config -> Codex.

Co-authored-by: ellerty <136543985+ellerty@users.noreply.github.com>
Co-authored-by: Jason <farion1231@gmail.com>
2026-11-02 20:53:02 +08:00
..