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 smoke test, 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>

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.

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

Output duration in seconds. xAI documents a range of 1 to 15 seconds.

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>

Output resolution.

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.