Skip to main content
POST
/
grok
/
v1
/
videos
/
generations
curl https://api.cometapi.com/grok/v1/videos/generations \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-video-1.5",
    "prompt": "Animate the still image with a slow camera move and natural motion.",
    "image": {"url": "https://your-image-host/source.jpg"},
    "duration": 1,
    "aspect_ratio": "16:9",
    "resolution": "720p"
  }'
{
  "request_id": "<request_id>"
}
Use this endpoint to start a Grok image-to-video job from one source image and a prompt. It returns a request_id immediately, so treat it as the first step in an async workflow.

Start with a small request

  • Use model: grok-imagine-video-1.5
  • Set image.url to a public JPEG, PNG, or WebP URL
  • For a first request, keep duration at 1 and resolution at 720p
  • Keep prompt explicit so the animation direction is clear
  • If you send base64, keep the docs and OpenAPI example form as data:image/png;base64,<BASE64_IMAGE_DATA>

Duration and resolution

SettingSupported valuesDefaultBoundary behavior
durationinteger 1-158Use shorter clips for first tests; longer clips cost more and take longer to complete.
resolution480p, 720p, 1080p720p in the examplesHigher resolution requests cost more and take longer to complete.
aspect_ratioratio labels such as 1:1, 16:9, or 9:1616:9 in the examplesThis endpoint uses resolution plus aspect_ratio; do not send a separate size field for exact WxH control.
Request combinationIntended output WxH
resolution: 480p, aspect_ratio: 1:1480x480
resolution: 720p, aspect_ratio: 16:91280x720
resolution: 720p, aspect_ratio: 9:16720x1280

Task flow

1

Create the job

Send the prompt and source image, then save the returned request_id.
2

Poll for completion

Call Get xAI video results until the nested provider status becomes done.
3

Persist the output

Copy the final video.url into your own storage if you need it after the provider’s temporary delivery window.

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your CometAPI key.

Body

application/json
prompt
string
required

Prompt describing how the source image should animate. CometAPI requires this field for this route.

Example:

"Animate the still image with a slow camera move and natural motion."

aspect_ratio
enum<string>

Output aspect ratio. Combine with resolution to choose the target frame; for example 480p with 1:1 targets 480x480, 720p with 16:9 targets 1280x720, and 720p with 9:16 targets 720x1280. This endpoint does not expose an exact size field.

Available options:
1:1,
16:9,
9:16,
4:3,
3:4,
3:2,
2:3
duration
integer
default:8

Output duration in seconds. Use an integer from 1 through 15. If omitted, CometAPI treats the request as an 8-second generation for billing and default handling.

image
object

Source image for image-to-video. Use a public JPEG, PNG, or WebP URL, or a data URI such as data:image/png;base64,<BASE64_IMAGE_DATA>.

model
string
default:grok-imagine-video-1.5

xAI video model id. The default example uses Grok Imagine 1.5 for image-to-video.

Example:

"grok-imagine-video-1.5"

output
object
resolution
enum<string>
default:720p

Output resolution. Use 720p for a small image-to-video test, or 1080p when you need a higher resolution tier.

Available options:
480p,
720p,
1080p
size
string

Deprecated size field. Prefer aspect_ratio and resolution.

user
string

Optional end-user identifier.

Response

200 - application/json

Request accepted.

request_id
string
required

Deferred request id used for polling.