Skip to main content
POST
/
grok
/
v1
/
videos
/
generations
curl --request POST \
  --url https://api.cometapi.com/grok/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "A candle flickers on a wooden table."
}
'
{
  "request_id": "4b2cd27e-0b0d-3dec-c31c-7572daf74bb3"
}
Use this endpoint to start a Grok video job from text, or from text plus one source image. 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
  • For a first request, keep duration at 1 and resolution at 480p
  • Add image.url only when you want image-to-video
  • 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, 720p480p720p requests are billed at the higher resolution tier.
aspect_ratioratio labels such as 1:1, 16:9, or 9:161:1 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 save the returned request_id.
2

Poll for completion

Call Get Video Generation 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 for the video job.

Example:

"A candle flickers on a wooden table."

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

Optional source image for image-to-video.

model
string
default:grok-imagine-video

xAI video model id.

Example:

"grok-imagine-video"

output
object
resolution
enum<string>
default:480p

Output resolution. Use 480p for faster first tests or 720p for the higher resolution tier.

Available options:
480p,
720p
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.