Grok Videos Generation API
POSThttps://api.acedata.cloud/grok/videos

Grok video generation API — create a Grok Imagine video from a text prompt and an input image.

Request Headers

acceptstring
Specify the format of the response returned by the server. If not specified, the default is `application/json`. If `application/x-ndjson` is specified, the response will be returned in a streamed block format separated by newline characters in JSON format.
Please select
authorizationstring
Bearer token

Request Body

promptstring
Describe the text prompts for generating video content. Required when generating text with `grok-imagine-video-1.5-fast`; optional when providing `image_url`.
modelstring
Models used for generating videos. `grok-imagine-video-1.5-fast` supports text-to-video generation and image-to-video generation, with a maximum duration of 30 seconds; `grok-imagine-video-1.5` only supports image-to-video generation and requires an `image_url`, with a maximum duration of 15 seconds.
image_urlstring
Input image URL for image generation video. Required when `model` is `grok-imagine-video-1.5`.
reference_image_urlsarray
An optional array of reference image URLs to guide the style or content of the generated video.
aspect_ratiostring
Generate the aspect ratio of the video.
resolutionstring
The output resolution for the video can be selected as `480p`, `720p`, or `1080p`.
durationinteger
The duration of the generated video, in seconds. `grok-imagine-video-1.5-fast` value range is 1–30, `grok-imagine-video-1.5` value range is 1–15, default is 8.
callback_urlstring
Callback URL, after the video generation is complete, the result will call this address. After providing this parameter, the request will immediately return `task_id`, and the result will be delivered asynchronously.
asyncboolean
Whether to process in asynchronous mode. When set to `true`, the interface immediately returns `task_id`, without the need to provide `callback_url`, and then the result can be obtained by polling the corresponding task query interface; if `callback_url` is also provided, the result will be pushed to that callback address.
Please select

Response

Grok
Allow Use General Balance

When 'Allow General Balance' is enabled, the general balance is used automatically if an app's balance is insufficient.

Shell

Python

JavaScript

Java

Go

PHP

Kind reminder: For streaming requests, the above code may not be fully applicable. Please refer to the integration documentation for changes.