메인 콘텐츠로 건너뛰기
POST
Submit a video generation task (text-to-video / image-to-video)
🔒 신청 시 부여되는 GrokOfficial 그룹 필요: Grok Imagine Video는 Default 그룹에 속하지 않으므로 호출하기 전에(이 페이지의 Playground 포함) 접근 권한을 신청해야 합니다. 접근 권한이 없거나 요청당 결제 Token을 사용하는 경우 모든 호출에서 503이(가) 반환됩니다. Grok Imagine Video 개요 - 그룹 설정을 참고하십시오.
오른쪽의 대화형 Playground를 통해 엔드포인트를 직접 테스트할 수 있습니다. Authorization에 API Key를 입력하고(형식: Bearer sk-xxx), model을(를) 선택한 후 prompt / seconds / size을(를) 입력하고 전송하십시오. 이미지 투 비디오(image-to-video)의 경우 input_reference을(를) 추가하십시오. Playground는 1단계(제출)만 수행합니다 — 태스크 id을(를) 받은 후 아래 설명에 따라 폴링 및 다운로드를 진행하십시오.
⚠️ 가장 흔히 발생하는 3가지 주의점
  1. size / seconds이(가) 없으면 기본값은 480p 및 8초이며, 해당 기준에 따라 과금됩니다.
  2. grok-imagine-video에는 1080p가 없습니다: 1920x1080은(는) 400을 반환하므로, 1080p를 사용하려면 -1.5 또는 -1.5-lite을(를) 사용하십시오.
  3. 검토 차단 시에도 과금됩니다: 차단된 태스크도 여전히 completed을(를) 보고하지만, error.code: "moderation_blocked"을(를) 포함하며 동영상이 없습니다.
3단계 비동기 흐름 — 이 페이지에서는 1단계(제출)만 다룹니다
  • 1단계(이 페이지): POST /v1/videos → 태스크 id + status: "queued" 반환
  • 2단계: status이(가) "completed" 또는 "failed"이(가) 될 때까지 GET /v1/videos/{id} 폴링
  • 3단계: GET /v1/videos/{id}/content에서 MP4 다운로드
제출 요청은 몇 초 내에 반환되며 동영상 생성이 완료될 때까지 대기하지 않습니다.

코드 예제

Python (텍스트-동영상, 3단계 전체)

Python (이미지-동영상, base64 입력 이미지)

cURL

Node.js (fetch)

파라미터 빠른 참조

초당 가격 (xAI와 동일):
모델 가격은 공식 사이트 기준을 따르며 변동 시 함께 변경될 수 있습니다. 위 표는 참고용일 뿐이며, 상단 탐색 메뉴의 모델 가격 탭 내용이 공식 기준입니다: 모델 가격.

응답 예시

제출 (1단계):
완료 (2단계 폴링 결과):
모더레이션에 의해 차단됨: status은(는) 여전히 completed이지만, 추가 error 필드가 존재하며 다운로드할 동영상이 없습니다:

관련 문서

인증

Authorization
string
header
필수

API Key from the APIYI console (Token group must include GrokOfficial)

본문

application/json
model
enum<string>
기본값:grok-imagine-video-1.5-lite
필수

Model ID (billed per second × resolution rate):

  • grok-imagine-video — 480p $0.05/s, 720p $0.07/s, no 1080p
  • grok-imagine-video-1.5 — 480p $0.08, 720p $0.14, 1080p $0.25 per second
  • grok-imagine-video-1.5-lite — 480p $0.02, 720p $0.03, 1080p $0.14 per second
사용 가능한 옵션:
grok-imagine-video,
grok-imagine-video-1.5,
grok-imagine-video-1.5-lite
prompt
string

Prompt: scene + subject + action + camera + lighting. Required for text-to-video; for image-to-video it describes motion and camera

예시:

"a red paper boat drifting on a calm lake, gentle ripples, soft morning light"

seconds
string

Duration from 1 to 15 seconds, as a string or a number; default 8. Out-of-range values return 400. Cost scales with seconds — use 1–2 seconds while testing.

예시:

"2"

size
enum<string>
기본값:854x480

Output size in WIDTHxHEIGHT pixels: the shorter side sets the resolution (≥1080 is 1080p, ≥720 is 720p, otherwise 480p) and the aspect ratio snaps to the nearest supported one. You can also pass 480p / 720p / 1080p directly. Without it, the default is 480p.

  • 854x480 — 480p landscape (measured 848×480)
  • 1280x720 / 720x1280 — 720p landscape / portrait
  • 1920x1080 / 1080x1920 — 1080p (1.5 / 1.5-lite only)
사용 가능한 옵션:
854x480,
480x854,
1280x720,
720x1280,
1920x1080,
1080x1920
input_reference
string

Input image for image-to-video: a public image URL or a data:image/jpeg;base64,... data URI. Passing it makes the job image-to-video, and the output frame follows the input image. Each input image costs an extra $0.002 (grok-imagine-video) or $0.01 (1.5 / 1.5-lite).

예시:

"https://example.com/first-frame.jpg"

응답

Task submitted; returns the task id and queued status

id
string

Task ID for polling and download

예시:

"task_xxxxxxxxxxxxxxxx"

object
string

Always video

예시:

"video"

model
string
예시:

"grok-imagine-video-1.5-lite"

status
enum<string>

Task status:

  • queued — submitted, waiting
  • in_progress — generating
  • completed — done, download from /v1/videos/{id}/content; with error.code: moderation_blocked it was blocked and has no video
  • failed — failed
사용 가능한 옵션:
queued,
in_progress,
completed,
failed
예시:

"queued"

progress
integer

Progress 0–100, coarse-grained; not suitable for a precise progress bar

예시:

0

seconds
string

Video duration, returned once done

created_at
integer

Task creation Unix timestamp (seconds)

completed_at
integer

Task completion Unix timestamp (seconds), returned once done