CometAPI POST /grok/v1/videos/generations를 사용해 Grok으로 비디오를 생성하고, 프롬프트로 입력 이미지를 애니메이션화하며, request_id로 결과를 폴링합니다.
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"
}request_id가 즉시 반환되므로 비동기 워크플로의 첫 단계로 처리해야 합니다.
model: grok-imagine-video 사용duration은 1, resolution은 480p로 유지image.url 추가data:image/png;base64,<BASE64_IMAGE_DATA>로 유지완료될 때까지 폴링
done이 될 때까지 Get Video Generation Results를 호출합니다.Bearer token authentication. Use your CometAPI key.
Prompt for the video job.
"A candle flickers on a wooden table."
Output aspect ratio.
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 Output duration in seconds. xAI documents a range of 1 to 15 seconds.
Optional source image for image-to-video.
Show child attributes
xAI video model id.
"grok-imagine-video"
Show child attributes
Output resolution.
480p, 720p Deprecated size field. Prefer aspect_ratio and resolution.
Optional end-user identifier.
Request accepted.
Deferred request id used for polling.
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"
}