Skip to content

fix: support shared weekly limits for Grok Web Imagine - #998

Merged
chenyme merged 2 commits into
mainfrom
usages
Aug 24, 2026
Merged

fix: support shared weekly limits for Grok Web Imagine#998
chenyme merged 2 commits into
mainfrom
usages

Conversation

@chenyme

@chenyme chenyme commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Accept Grok Web Imagine availability-only quota responses when windowSizeSeconds is present but remainingQueries is omitted.
  • Treat missing product counters as shared weekly quota for confirmed Super/Heavy accounts.
  • Keep Basic/Free accounts isolated from paid weekly quota fallback.
  • Refresh both weekly usage and Imagine product availability after successful media requests.
  • Preserve the previous quota snapshot when the paid weekly endpoint temporarily fails.
  • Continue rejecting genuinely incomplete quota structures.

Why

Grok Web can return Imagine products such as imagePro with:

{
  "available": true,
  "windowSizeSeconds": 64800
}

This is a valid availability-only response for accounts governed by the shared weekly pool. The previous parser incorrectly required remainingQueries, causing quota synchronization to fail with:

Grok Web Imagine 配额字段 imagePro 结构不完整

Safety

  • Explicit product quota windows take precedence over weekly fallback.
  • available=false still installs an exhausted product window.
  • Basic/Free accounts never inherit paid weekly quota.
  • A failed weekly refresh cannot erase the last valid quota snapshot.
  • Missing or invalid windowSizeSeconds remains an error.

Test plan

  • Accept the Issue [Bug]: Grok Web Imagine 配额字段 imagePro 结构不完整 #972 availability-only payload.
  • Reject availability-only products without a valid window size.
  • Preserve the old snapshot when paid weekly synchronization fails.
  • Verify Super/Heavy routing falls back to weekly.
  • Verify Basic routing does not use weekly.
  • Verify product-specific windows override weekly.
  • Verify media finalization refreshes weekly and Imagine availability.
  • go test -race for affected packages.
  • go build ./...
  • go vet ./...
  • go test ./...

Fixes #972

@chenyme
chenyme merged commit 79fea70 into main Aug 24, 2026
9 checks passed
gnayhz added a commit to gnayhz/grok2api that referenced this pull request Aug 24, 2026
…, console quota reconcile, provider-prefix models, access-cookie auth, privacy diagnostics, doom-loop guards

Functional picks from upstream: chenyme#995 SuperGrok Plus paid-tier recognition, chenyme#998 shared weekly limits for Web Imagine, chenyme#1002 statsig refresh on stale-page media rejection, chenyme#1003 console quota reconciliation after 429 (transient 5xx/429 no longer cascade into durable cooldowns), chenyme#1001 provider prefixes preserved in public model names, chenyme#1000 scoped access-cookie fallback for stripped bearer auth, chenyme#983 privacy-safe request diagnostics with bounded retention, chenyme#994 output doom-loop guards with split content/reasoning thresholds, serde hardening (output_text.annotations, model backfill, Anthropic marker filtering).

Excluded: upstream quality-guard sidecar and its tooling/pages/config (superseded by the built-in quarantine/rotation guard), account-egress lease-block routing tests (superseded by scopeless pools). Kept our semantics where they diverge: strike-preserving clear-cooldown endpoint plus a new explicit /clear-cooldown-force, strict routing targets, RSC-clean confirmation gate, rotating fixed targets.
@chenyme
chenyme deleted the usages branch August 25, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Grok Web Imagine 配额字段 imagePro 结构不完整

1 participant