메인 콘텐츠로 건너뛰기
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"
}
이 엔드포인트를 사용하면 텍스트만으로, 또는 텍스트와 하나의 소스 이미지를 함께 사용해 Grok 비디오 작업을 시작할 수 있습니다. request_id가 즉시 반환되므로 비동기 워크플로의 첫 단계로 처리해야 합니다.

작은 요청으로 시작하기

  • model: grok-imagine-video 사용
  • 스모크 테스트의 경우 duration1, resolution480p로 유지
  • image-to-video가 필요할 때만 image.url 추가
  • base64를 보내는 경우, 문서와 OpenAPI 예제 형식은 data:image/png;base64,<BASE64_IMAGE_DATA>로 유지

작업 흐름

1

작업 생성

프롬프트를 보내고 반환된 request_id를 저장합니다.
2

완료될 때까지 폴링

중첩된 provider status가 done이 될 때까지 Get Video Generation Results를 호출합니다.
3

출력 저장

provider의 임시 전달 기간 이후에도 필요하다면 최종 video.url을 자체 스토리지에 복사합니다.

CometAPI에서 달라지는 점

xAI는 비디오 생성을 시작 -> 폴링의 2단계 흐름으로 문서화합니다. CometAPI는 동일한 요청 형식과 동일한 핵심 model id를 유지하지만, CometAPI 키로 인증하고 CometAPI base URL을 사용합니다. 실제 1초 480p 요청은 2026-03-12에 성공적으로 완료되었고 실제 결과 URL을 반환했습니다.

인증

Authorization
string
header
필수

Bearer token authentication. Use your CometAPI key.

본문

application/json
prompt
string
필수

Prompt for the video job.

예시:

"A candle flickers on a wooden table."

aspect_ratio
enum<string>

Output aspect ratio.

사용 가능한 옵션:
1:1,
16:9,
9:16,
4:3,
3:4,
3:2,
2:3
duration
integer
기본값: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
기본값:grok-imagine-video

xAI video model id.

예시:

"grok-imagine-video"

output
object
resolution
enum<string>

Output resolution.

사용 가능한 옵션:
480p,
720p
size
string

Deprecated size field. Prefer aspect_ratio and resolution.

user
string

Optional end-user identifier.

응답

200 - application/json

Request accepted.

request_id
string
필수

Deferred request id used for polling.