Repository navigation
Add an xAI preset: images, videos and speech with Grok Imagine - #89
Merged
Merged
Conversation
lcode mcp add xai asks for an xAI API key and runs lcode-mcp-xai, a new MCP server shipped with lcode for xAI's Grok Imagine and text to speech APIs: generate_image (1-10 images, aspect ratio, 1k/2k), edit_image (a local image, sent as a data URL), generate_video (1-15 s, optionally from a local start image; waits up to 10 minutes and downloads the MP4), video_status (for one that took longer) and text_to_speech (26 voices, MP3 or WAV). Files are saved in generated/ in the project or where the model is asked to save them. xAI's error messages, such as a moderation refusal or a bad key, reach the model. xAI has no music API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
lcode mcp add xaifirst asks for an xAI API key: typed hidden, or taken fromXAI_API_KEYif it's set. It then runslcode-mcp-xai, a new MCP server shipped with lcode for xAI's Grok Imagine and text to speech APIs.generate_imagePOST /v1/images/generations: 1–10 images, aspect ratio, 1k/2k, modelgrok-imagine-image-2.0(or-quality, or the basic one), as base64edit_imagePOST /v1/images/edits, with the local image as a data URLgenerate_videoPOST /v1/videos/generations, then pollsGET /v1/videos/{id}: 1–15 s, up to 1080p, optionally from a local start image. Waits up to 10 minutes and downloads the MP4video_statustext_to_speechPOST /v1/tts: 26 voices, 20 languages, MP3 or WAVgenerated/in the project, or a path the model is asked for. An extension is added when missing, and nothing is overwritten.XAI_API_KEY) or a rate or credit limit."allow"inmcp.jsonturns that off per tool.Tests
tests/test_xai.py(6 tests) uses a fake xAI API. It covers:video_status;generate_image,text_to_speechandgenerate_videowith the image as the start frame, and all three files were saved.🤖 Generated with Claude Code