Generate and edit images using xAI’s Grok Imagine model. Supports text-to-image generation and reference-based image editing.

Model

xai/grok-imagine-image

Parameters

ParameterTypeRequiredDefaultDescription
promptstringYesText description or edit instruction
aspect_ratiostringNo"1:1""1:1", "2:3", "3:2", "9:16", "16:9"
image_urlsstring[]Nonull1–5 reference image URLs (triggers edit mode)
image_countintNo214 results to generate (edit mode only)
When image_urls is provided, the model runs in edit mode — it merges or edits the reference images based on your prompt. Otherwise it generates a new image from the prompt.

Example Request

Text to Image

curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "xai/grok-imagine-image",
    "input": {
      "prompt": "A robot dancing in a field of sunflowers",
      "aspect_ratio": "16:9"
    }
  }'

Image Editing

curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "xai/grok-imagine-image",
    "input": {
      "prompt": "Merge these images into one scene",
      "image_urls": [
        "https://example.com/img1.jpg",
        "https://example.com/img2.jpg"
      ],
      "image_count": 2
    }
  }'

Response

{
  "code": 200,
  "success": true,
  "data": {
    "task_id": "abc123def456",
    "status": "pending"
  }
}

Pricing

$0.04/image