Skip to content
English

Grok Imagine Image to Video API

POST /v1/tasks

All models are called through the Unified Async API POST /v1/tasks endpoint; only the input fields differ (see input parameters below).

Model summary

Model name grok-imagine/image-to-video
Type Video generation (image-to-video)
Endpoint POST /v1/tasks
Pricing See HiAPI Pricing

Grok Imagine image-to-video animates one or more reference images into a cinematic short clip, guided by an optional motion prompt, with selectable aspect ratio, motion mode, and duration (6-30s), all through one HiAPI API key.

Production guidance

Production guidance
  • For production, pass callback.url at the top level of the request body so HiAPI can notify your service when the task reaches a terminal state.
  • GET /v1/tasks/:id is better for local debugging, low-volume jobs, or fallback reconciliation if a callback is missed.
  • Use callback.when=final. Both success and fail are terminal states, so your service should deduplicate by taskId.

Best suited for

Animate product shots

Pass a product shot or poster as reference to generate an ad clip with camera motion.

image_urlsprompt
Dynamic portrait clips

Turn portrait photos into natural motion clips for social and demos.

image_urlsduration
Add motion to static scenes

Add camera moves like push-ins to landscape or scene stills.

image_urlsmode
Multi-image reference

Pass up to 7 reference images and reference them with @image1 etc. in the prompt.

image_urls

Request parameters

model string required

Fixed value grok-imagine/image-to-video.

example grok-imagine/image-to-video
input object required

Business parameters. Put Grok Imagine Image to Video-specific configuration here.

image_urls string[] required

Reference image URLs or asset:// asset IDs, up to 7. Supports JPEG/PNG/WEBP, 10MB each. SVG is not supported. Reference specific images with @image1 etc. in the prompt.

prompt string optional

Text prompt describing the desired video motion (optional, English works best), up to 5000 characters.

aspect_ratio enum optional

Aspect ratio of the output video.

default 2:3 enum: 2:33:21:116:99:16
mode enum optional

Generation mode affecting motion style and intensity. fun is more creative, normal is more balanced.

default normal enum: funnormal
duration integer optional

Video duration in seconds. Billed per second.

default 6
resolution enum optional

Output video resolution. 720p is higher quality, 480p is faster and cheaper.

default 480p enum: 480p720p
callback object optional

Optional callback configuration. When set, HiAPI notifies your service when the task reaches a terminal state.

url string required

Required when callback is set; HTTPS URL that receives terminal task notifications.

example https://your-domain.com/hiapi/callback
when enum optional

Callback trigger timing. Use final.

default final enum: final

Example requests

Basic image-to-video

One reference image + motion prompt, lowest-cost validation.

Request body
{
  "model": "grok-imagine/image-to-video",
  "input": {
    "image_urls": [
      "https://example.com/reference.jpg"
    ],
    "prompt": "camera slowly pushes forward, gentle motion",
    "duration": 6,
    "resolution": "480p"
  }
}
HD image-to-video

720p output for higher quality.

Request body
{
  "model": "grok-imagine/image-to-video",
  "input": {
    "image_urls": [
      "https://example.com/reference.jpg"
    ],
    "prompt": "the subject slowly turns and smiles, hair gently moving",
    "mode": "normal",
    "duration": 8,
    "resolution": "720p",
    "aspect_ratio": "16:9"
  }
}

Getting the result

  1. The response returns a taskId immediately without waiting for generation to finish.
  2. In production, prefer waiting for callback.url to receive the terminal notification. For local debugging, poll GET /v1/tasks/:id.
  3. When status=success, download the generated video from output[].url.
  4. When status=fail, fix the request based on the returned error instead of retrying the same invalid payload.

FAQ

What is Grok Imagine image-to-video?

Grok Imagine image-to-video is an AI video generation API on HiAPI that animates reference images into a cinematic short clip, called via POST /v1/tasks with model set to grok-imagine/image-to-video.

How many reference images can I pass?

image_urls accepts up to 7 images (JPEG/PNG/WEBP, 10MB each). SVG is not supported. You can reference specific images with @image1 etc. in the prompt.

Is the prompt required?

For image-to-video the prompt is optional and describes the desired motion direction and pacing; you can generate with just reference images.

Next steps