grok-imagine-videoxAI Grok Imagine API integration for image generation, text-to-video, image-to-video, and editing via natural language. Use when you need to generate images or videos from text prompts, edit existing images, animate static images into videos, or edit existing videos with natural language instructions. Supports conversational generation across messaging platforms with async polling, progress updates, and automatic delivery.
Install via ClawdBot CLI:
clawdbot install DevvGwardo/grok-imagine-videoGenerate videos using xAI's Grok Imagine API directly from your messaging interface.
Important: You need your own xAI API key. Get it from https://console.x.ai/
For full installation instructions, see README.md
Quick setup:
# Set your xAI API key (YOUR key, not pre-configured)
export XAI_API_KEY="your-api-key-here"
User says: "Create an image of a cyberpunk cityscape at night"
python3 - << 'EOF'
import os
import sys
sys.path.insert(0, 'scripts')
from grok_video_api import GrokImagineVideoClient
client = GrokImagineVideoClient(os.getenv("XAI_API_KEY"))
result = client.generate_image("A cyberpunk cityscape at night, neon lights reflecting on wet streets")
print(f"Image URL: {result}")
EOF
Images are generated instantly (no polling needed). Download promptly as URLs are temporary.
User says: "Edit this image ā make it look like a watercolor"
python3 - << 'EOF'
import os
import sys
sys.path.insert(0, 'scripts')
from grok_video_api import GrokImagineVideoClient
client = GrokImagineVideoClient(os.getenv("XAI_API_KEY"))
result = client.edit_image(
image_url="https://example.com/photo.jpg",
prompt="Make it look like a watercolor painting"
)
print(f"Edited image: {result}")
EOF
User says: "Generate a video of a sunset over the ocean"
# Use the Python client
python3 - << 'EOF'
import os
import sys
sys.path.insert(0, 'scripts')
from grok_video_api import GrokImagineVideoClient
client = GrokImagineVideoClient(os.getenv("XAI_API_KEY"))
result = client.text_to_video("A beautiful sunset over the ocean", duration=10)
print(f"Job started: {result['job_id']}")
EOF
Video generation takes 1-3 minutes. Poll with progress:
python3 - << 'EOF'
import os
import sys
sys.path.insert(0, 'scripts')
from grok_video_api import GrokImagineVideoClient
client = GrokImagineVideoClient(os.getenv("XAI_API_KEY"))
def progress(response):
print(f"Polling... {'Done!' if 'video' in response else 'Pending'}")
final = client.wait_for_completion("request-id-here", progress_callback=progress)
print(f"Video ready: {final['video']['url']}")
EOF
Download the completed video to the workspace:
python3 - << 'EOF'
import os
import sys
sys.path.insert(0, 'scripts')
from grok_video_api import GrokImagineVideoClient
client = GrokImagineVideoClient(os.getenv("XAI_API_KEY"))
output = "/data/workspace/videos/sunset.mp4"
client.download_video(final, output) # pass the full response dict
print(f"Downloaded: {output}")
EOF
Animate an image:
from grok_video_api import GrokImagineVideoClient
client = GrokImagineVideoClient(api_key)
result = client.image_to_video(
image_url="https://example.com/photo.jpg",
prompt="Make the clouds move slowly",
duration=10
)
Edit an existing video:
result = client.edit_video(
video_url="https://example.com/source.mp4",
edit_prompt="Add a warm sunset filter and slow down to 50% speed"
)
Important: Get your own API key from https://console.x.ai/ - do NOT use pre-configured keys.
export XAI_API_KEY="sk-..."
For OpenClaw integration, add to workspace .env or manage via gateway config.
See README.md for complete setup instructions.
Common errors and responses:
export XAI_API_KEY="your-key" - See README.md for detailsAlways wrap API calls in try/except and provide user-friendly messages.
Prompt engineering (images):
n=4) to explore interpretationsPrompt engineering (videos):
Performance:
User experience:
See references/api_reference.md for full API documentation.
ffmpeg-video-editor for post-processing (trimming, concatenation, filters)fal-ai for additional video effectsimage-generation skills for source imagesJob stuck in "pending": Check API key and quota
Video generation slow: Try 720p instead of 1080p
Failed jobs: Check error_code in response; see API reference
Download errors: Verify video_url is accessible and has not expired
Generated Mar 1, 2026
Creators can generate custom images and short videos for platforms like Instagram and TikTok using text prompts, such as producing a cyberpunk cityscape image or a 10-second sunset video. This enables rapid prototyping of visual content without requiring graphic design or video editing skills, enhancing engagement with unique, AI-generated media.
Online retailers can create product images and videos from descriptions, like generating a watercolor-style image of a product or animating a static product photo into a video. This helps showcase items in various styles and contexts, improving customer appeal and reducing photoshoot costs for small businesses.
Educators can produce instructional videos from text, such as animating a diagram into a video to explain a concept or editing existing videos with natural language instructions. This supports creating engaging learning materials quickly, ideal for online courses and training modules in fields like science or art.
Marketing teams can generate and edit video ads from prompts, like creating a video of a golden retriever in a meadow or applying a warm filter to existing footage. This accelerates campaign testing and customization, allowing for rapid iteration on visual concepts to target specific audiences effectively.
Individuals or small businesses can create custom images and videos for occasions, such as generating a watercolor painting for a birthday card or animating a family photo into a short video. This offers a unique, on-demand service for personalized gifts, leveraging AI to produce creative content without artistic expertise.
Offer tiered monthly plans for access to image and video generation, with limits on usage (e.g., basic for images, premium for videos). Revenue comes from recurring fees, targeting freelancers and small businesses needing regular content creation, with potential upsells for higher-quality outputs or faster processing.
Charge per generation request, such as a fee for each image or video created, with pricing based on duration or complexity. This model appeals to developers and enterprises integrating the skill into custom applications, generating revenue from high-volume usage in sectors like advertising or e-commerce.
License the skill to other companies for embedding in their products, like social media apps or educational tools, with customization options. Revenue is generated through licensing fees and support contracts, targeting tech firms looking to enhance their offerings with AI-generated media capabilities.
š¬ Integration Tip
Set up the XAI_API_KEY environment variable securely in your workspace .env file to avoid unauthorized errors, and implement async polling with progress updates for video tasks to improve user experience.
Generate spectrograms and feature-panel visualizations from audio with the songsee CLI.
Best practices for Remotion - Video creation in React
Best practices for Remotion - Video creation in React
Long-form AI video production: the frontier of multi-agent coordination. CellCog orchestrates 6-7 foundation models to produce up to 4-minute videos from a single prompt ā scripted, filmed, voiced, lipsync'd, scored, and edited automatically. Create marketing videos, product demos, explainer videos, educational content, spokesperson videos, training materials, UGC content, news reports.
HeyGen AI video creation API. Use when: (1) Using Video Agent for one-shot prompt-to-video generation, (2) Generating AI avatar videos with /v2/video/generat...
Complete toolkit for programmatic video creation with Remotion + React. Covers animations, timing, rendering (CLI/Node.js/Lambda/Cloud Run), captions, 3D, charts, text effects, transitions, and media handling. Use when writing Remotion code, building video generation pipelines, or creating data-driven video templates.