Repository navigation
feat(api): support Grok subscription image generation - #15423
Merged
diegosouzapw merged 7 commits intoOct 7, 2026
Merged
diegosouzapw merged 7 commits into
diegosouzapw merged 7 commits into
Conversation
Register the xai-oauth and grok-cli image routes, and remap OpenAI quality high/hd, only when GROK_SUBSCRIPTION_IMAGES_ENABLED is true. While the flag is off, the API-key xAI image path stays on the existing request. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw
merged commit Oct 7, 2026
4e1f541
into
diegosouzapw:release/v3.8.52
7 of 9 checks passed
diegosouzapw
added a commit
that referenced
this pull request
Oct 7, 2026
Records the Onda B quality drift on the post-squash tip `9214916a`. Product squashes do not carry the baseline.
File-size ceilings inside `frozen`, measured with `split("\n").length`:
- `browser-worker.ts` 4398 → 4467 (#15615)
- `EndpointPageClient.tsx` 2493 → 2531 (#15565)
- `SystemStorageTab.tsx` 1611 → 1619 (#15565)
- `imageGeneration.ts` 3346 → 3377 (#15423, #15513)
- `catalog.ts` 2127 → 2130 (#15701)
- `auth.ts` 3666 → 3668 (#15624)
`node scripts/check/check-file-size.mjs` passed. The legacy string map was not edited.
⚠️ base-red inherited: #15306
This was referenced Oct 8, 2026
Merged
diegosouzapw
added a commit
that referenced
this pull request
Oct 8, 2026
Drains 9 v3.8.52 tip unit reds: 3 production defects — MCP bundle startup deadlock (async ESM init cycle from #13739; lazy-load cleanModelName), client bundles pulling server-only DB via imageRegistry→featureFlags (#15423; dependency-free resolver bridge, DB override preserved, default OFF), zh-CN/zh-TW glossary violations (#15138/#15092) — plus regenerated route namespaces, env-isolated guide-settings test, auth-test alignments that keep (and tighten to count=2) the loopback/management guards, quota-card guard following #15138 redesign, and stryker listing of 2 tip covering tests. Combined-board validation with #15903: 327/329 on the previously red files, typechecks, lint, 22 gates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Grok subscription OAuth connections previously could not resolve image models through
/v1/images/generations. Register Grok Imagine Image 2.0 and the existing Imagine models forgrok-cli/gcandxai-oauth/xao, and add Image 2.0 to xAI API-key connections. Requests reuse the existing OAuth refresh, persistence and account-selection path and dispatch to the xAI image endpoint.Translate OpenAI pixel sizes into xAI aspect ratio/resolution, preserve explicit native options, map
high/hdtomediumandstandardtolow, and validate options before dispatch. Older Imagine models reject the unsupported quality option. Document the callable model IDs and request contract.Validation
npm run test:vitest: 54 files / 493 tests passednpm run typecheck:corenpm run lint(full repository) and ESLint on all changed TypeScript filesnode scripts/check/check-api-typecheck.mjs(new diagnostic fixed; existing baseline preserved)npm run check:provider-consistencyandnpm run check:provider-assetsprovider-translate-path-golden.test.ts: 2 passed / 1 failed on macOS; the only snapshot differences are existing Copilotuser-agentplatform strings (linuxversusdarwin). This PR does not change the chat provider builders or their golden snapshot.npm run check:docs-allnpm run test:unitwas started and stopped after failures outside the image change. A separate run on unmodified company main (48bcfc9556) reproduced failures in stream-chunk lifecycle, early keepalive logging, Claude cooldown escalation and relay error handling (25 passed / 6 failed). These files and their implementation are unchanged by this PR.docs/architecture/QUALITY_GATES.md, and generatedomni-providersskill drift (unchanged generator inputs). The feature guide is a separate document; the API reference translation drift introduced by the initial draft was removed.Tests Added Or Updated
tests/unit/image-xai-subscription.test.ts: provider aliases/catalog, native options, size and quality mapping, invalid inputs and legacy model behavior.tests/unit/image-generation-route.test.ts: API-key and both OAuth providers, catalog visibility, token refresh persistence and validation before upstream dispatch.Coverage Notes
The new adapter's branches are exercised by deterministic payload tests; route tests cover credential selection, actual dispatch and persisted token rotation. No credentials or generated media are included in this change.
Reviewer Notes
Before implementation, a live subscription OAuth call to
https://api.x.ai/v1/images/generationswithgrok-imagine-image-2.0,aspect_ratio: "3:2",resolution: "1k",quality: "medium"andresponse_format: "b64_json"returned HTTP 200 and an image. Entitlements and quota remain upstream-controlled.Provider contract: https://docs.x.ai/developers/model-capabilities/images/generation