Browse ModelsX AIX AI Grok Imagine Image Text To Image

X Ai Grok Imagine Image Text To Image

X Ai Grok Imagine Image Text To Image

Playground

Try it on WavespeedAI!

X-AI Grok Imagine Image enables precise image editing with xAI’s Grok Imagine model. Transform and modify images using text prompts with AI-powered precision. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.

Features

Grok Imagine Image Text-to-Image

Grok Imagine Image is X-AI’s text-to-image generation model that transforms text prompts into high-quality visuals. With extensive aspect ratio options and batch generation support, it delivers creative, detailed images for a wide range of applications.


Why Choose This?

  • Extensive aspect ratios 11 preset options including 2:1, 20:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, and 9:20.

  • Batch generation Generate up to 4 images in a single request for quick iteration.

  • Creative flexibility Excels at stylized content from 3D characters to photorealistic scenes.

  • Prompt Enhancer Built-in tool to automatically improve your prompts for better results.

  • Cost-effective Affordable per-image pricing for high-volume generation.


Parameters

ParameterRequiredDescription
promptYesText description of the image you want to generate
aspect_ratioNoOutput ratio: 2:1, 20:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:20
num_imagesNoNumber of images to generate (1-4, default: 1)

How to Use

  1. Write your prompt — describe the image in detail, including style, mood, and composition.
  2. Select aspect ratio — choose from presets or leave empty for default.
  3. Set num_images — generate 1-4 images per request.
  4. Run — submit and download your images.

Pricing

OutputCost
Per image$0.022

Billing Rules

  • Total cost = $0.022 × num_images
  • Maximum 4 images per request

Examples

  • 1 image → $0.022
  • 2 images → $0.044
  • 4 images → $0.088

Best Use Cases

  • Character Design — Create 3D characters, chibi figures, and toy-style illustrations.
  • Social Media Content — Generate visuals for posts, stories, and ads.
  • Concept Art — Quickly visualize ideas and creative concepts.
  • Marketing Materials — Produce eye-catching imagery for campaigns.
  • Rapid Prototyping — Generate multiple variations to explore design directions.

Pro Tips

  • Use the Prompt Enhancer to refine your descriptions automatically.
  • Be specific about style, texture, lighting, and color palette for better results.
  • Generate multiple images (num_images=4) to explore variations quickly.
  • Match aspect ratio to your target platform: 16:9 for YouTube, 9:16 for TikTok/Reels, 1:1 for Instagram.
  • Use ultra-wide ratios (20:9, 2:1) for cinematic banners and headers.

Notes

  • Maximum 4 images can be generated per request.
  • Aspect ratio can be left empty to use default sizing.
  • For best results, write detailed prompts with specific visual attributes.

Authentication

For authentication details, please refer to the Authentication Guide.

API Endpoints

Submit Task & Query Result


# Submit the task
curl --location --request POST "https://api.wavespeed.ai/api/v3/x-ai/grok-imagine-image/text-to-image" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${WAVESPEED_API_KEY}" \
--data-raw '{
    "num_images": 1,
    "enable_sync_mode": false,
    "enable_base64_output": false
}'

# Get the result
curl --location --request GET "https://api.wavespeed.ai/api/v3/predictions/${requestId}/result" \
--header "Authorization: Bearer ${WAVESPEED_API_KEY}"

Parameters

Task Submission Parameters

Request Parameters

ParameterTypeRequiredDefaultRangeDescription
promptstringYes-The positive prompt for the generation.
aspect_ratiostringNo-2:1, 20:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:20, 1:2Aspect ratio of the generated image.
num_imagesintegerNo11 ~ 4Number of images to be generated.
enable_sync_modebooleanNofalse-If set to true, the function will wait for the result to be generated and uploaded before returning the response. It allows you to get the result directly in the response. This property is only available through the API.
enable_base64_outputbooleanNofalse-If enabled, the output will be encoded into a BASE64 string instead of a URL. This property is only available through the API.

Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
data.idstringUnique identifier for the prediction, Task Id
data.modelstringModel ID used for the prediction
data.outputsarrayArray of URLs to the generated content (empty when status is not completed)
data.urlsobjectObject containing related API endpoints
data.urls.getstringURL to retrieve the prediction result
data.has_nsfw_contentsarrayArray of boolean values indicating NSFW detection for each output
data.statusstringStatus of the task: created, processing, completed, or failed
data.created_atstringISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”)
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds

Result Request Parameters

ParameterTypeRequiredDefaultDescription
idstringYes-Task ID

Result Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
dataobjectThe prediction data object containing all details
data.idstringUnique identifier for the prediction, the ID of the prediction to get
data.modelstringModel ID used for the prediction
data.outputsstringArray of URLs to the generated content (empty when status is not completed).
data.urlsobjectObject containing related API endpoints
data.urls.getstringURL to retrieve the prediction result
data.statusstringStatus of the task: created, processing, completed, or failed
data.created_atstringISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”)
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds
© 2025 WaveSpeedAI. All rights reserved.