Skip to content

[Bug] Max monthly subscription quota exhaustion returns HTTP 400, preventing client cooldown #1149

Open

Description

@rpchen

Summary

When the monthly included usage quota of a Command Code Max subscription is exhausted, the Provider API returns HTTP 400 Bad Request, rather than an actionable quota-limit response such as HTTP 429 Too Many Requests.

This breaks automatic cooldown and account rotation in third-party AI clients/gateways that interpret 429 as temporary quota exhaustion and 400 as an invalid request.

Observed behavior

  • Plan: Max
  • Exhausted allowance: monthly subscription quota, not a 5-hour or weekly usage window
  • Observed HTTP status: 400
  • Effect: The client cannot detect the monthly exhaustion through its standard HTTP 429 cooldown handling.

I am reporting the actual HTTP status observed on my Max account; I have not included an unverified response body or guessed a reset timestamp.

Steps to reproduce

  1. Authenticate to the Command Code Provider API with an API key from a Max subscription.
  2. Exhaust the Max subscription's monthly included quota.
  3. Send another otherwise-valid model request.
  4. Observe an HTTP 400 response instead of a quota-limit response that an API client can use to initiate cooldown.

Expected behavior

  1. Use HTTP 429 for temporary monthly subscription quota exhaustion, consistent with the existing 429 RATE_LIMITED behavior reported for other subscription usage windows, rather than treating a valid request as a 400 Bad Request.
  2. Return a stable machine-readable error code distinguishing monthly subscription quota exhausted from transient RPM/TPM rate limiting, upstream availability, and malformed requests.
  3. Expose the actual renewal/reset time in machine-readable form, preferably an absolute UTC reset timestamp and/or a standard Retry-After header. For a monthly quota this may be days or weeks away; clients must not retry every few seconds.
  4. Apply consistent HTTP status and recovery semantics to OpenAI-compatible and Anthropic-compatible Provider API routes, while preserving each API's appropriate JSON error envelope.
  5. If the quota is not automatically replenished (e.g., a separate purchased-credit balance), expose a distinct terminal error instead of suggesting a short cooldown. This report concerns automatically renewing Max monthly quota.

Why this matters

Many clients and API gateways make fallback and cooldown decisions based on HTTP status codes:

  • 400 → invalid request; no account cooldown.
  • 429 → rate/quota limit; temporarily disable the affected account and retry or route elsewhere, ideally until Retry-After / reset time.
  • 5xx → transient server-side failure.

As a result, returning 400 for a monthly subscription limit prevents automatic cooldown for potentially the entire remainder of the billing period.

Related reports

Request

Could the team make monthly subscription quota exhaustion (including Max) a reliably machine-detectable, time-bound quota error, preferably HTTP 429 with a stable error code and actual reset time? This would let standard third-party clients stop routing to the exhausted account and recover automatically when the monthly quota renews.

Activity

  1. vipulgupta2048 commented on Nov 17, 2026

    @vipulgupta2048
    Member

    Confirmed. 5-hour and weekly limits already return 429, but an exhausted monthly quota returned 400 Bad Request, so gateways never cooled the key down. Fix in review: on /v1/chat/completions, /v1/responses and /v1/messages, an exhausted monthly quota now returns 429 insufficient_quota with x-should-retry: false. Purchased and free credits running out still return 400 — https://github.com/CommandCodeAI/commandcode/pull/6803

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions