FEAT: Add tts and image generation support to xai extension#68694
Conversation
Greptile SummaryThis PR adds image generation and TTS/speech providers to the xAI extension, following established patterns from the OpenAI and video-generation providers. The new Two unscoped changes in
Confidence Score: 3/5Not safe to merge as-is due to two unscoped changes in model-definitions.ts — an undocumented 4× context-window bump and a breaking type change on a public API export. Two P1 findings in model-definitions.ts are outside the stated scope of the PR and could affect model capability reporting and downstream consumers of the public api.ts barrel. The new providers themselves look correct, but these collateral changes need explicit confirmation or revert before landing. extensions/xai/model-definitions.ts — XAI_DEFAULT_CONTEXT_WINDOW value change and XAI_DEFAULT_MODEL_REF type change both warrant explicit reviewer sign-off.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e28dfee9ec
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14cbe70abd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edfa1f1058
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f438f8dea5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 272402a6d3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f7c132fee
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39e244f148
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fabe25d5a3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa5b93eee5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa319ef90c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8284faf78b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Landed via temp rebase onto
Validation:
Thanks @KateWilkins! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9909151713
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return undefined; | ||
| } | ||
| const normalized = trimmed.toLowerCase(); | ||
| if (normalized === "auto" || /^[a-z]{2,3}(?:-[a-z]{2,4})?$/.test(normalized)) { |
There was a problem hiding this comment.
Accept full BCP-47 subtags in xAI language normalization
normalizeXaiLanguageCode currently allows only xx, xxx, or a single -subtag form, so valid BCP-47 values with multiple subtags (for example zh-Hant-TW or sr-Latn-RS) are rejected before the request is sent. This means multilingual/script-specific TTS requests fail locally despite the provider path and docs describing BCP-47 language support.
Useful? React with 👍 / 👎.
Summary
generateImage(both/v1/images/generations+/v1/images/editswith exact user-provided payload{image: {url, type:"image_url"}}), both models (grok-imagine-imagedefault +grok-imagine-image-pro), main provider URL, b64 handling, and provider-http reuse (no duplication).image-generation-provider.ts+ test (modeled on openai + xai/video patterns), registration/manifest updates, model defs, and fixed all surfaced lint/TS errors (unused OpenAI imports/consts, SDK reexports forasFiniteNumber/trimToUndefined, type assertions,no-unused-vars/no-explicit-any).Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
N/A
Root Cause (if applicable)
N/A
Regression Test Plan (if applicable)
sufficient + new unit test
extensions/xai/image-generation-provider.test.ts+plugin-registration.contract.test.tsmain URL, exact edit payload with singular
imageobject, b64 -> assetconversion
contract + xAI-specific payload/HTTP path
video pattern tests
User-visible / Behavior Changes
xAI now registers as an image generation provider (models selectable via
XAI_IMAGE_MODELS; edit support via standardinputImages). No config/UI changes.Diagram (if applicable)
N/A
Security Impact (required)
resolveProviderHttpRequestConfig+postJsonRequest)Yes, explain risk + mitigation: N/ARepro + Verification
Environment
models.providers.xai.apiKey=...Steps
openclaw config set models.providers.xai.apiKey=...xai(prompt orinputImagesfor edit)Expected
Actual
Evidence
pnpm test extensions/xai)Human Verification (required)
image: {url: dataUrl, type: "image_url"}, b64 conversion, model selection, main provider URLpairing impact
Review Conversations
this PR.
maintainer judgment.
Compatibility / Migration
Risks and Mitigations
None.