메인 콘텐츠로 건너뛰기
POST
Submit a video generation task (text-to-video / image-to-video)
🔒 신청을 통해 부여되는 GrokOfficial 그룹 필요: Grok Imagine Video는 Default 그룹에 포함되지 않습니다. 호출하려면 먼저 액세스를 요청해야 합니다(이 페이지의 플레이그라운드 포함). 액세스 권한이 없거나 요청당 결제 Token을 사용하는 경우 모든 호출이 503을 반환합니다. Grok Imagine Video 개요 - 그룹 설정을 참조하십시오.
오른쪽의 대화형 플레이그라운드에서 엔드포인트를 직접 테스트할 수 있습니다. Authorization에 API 키를 입력하고(형식: Bearer sk-xxx), model을 선택한 다음 prompt / seconds / size을 입력하고 전송하십시오. 이미지-동영상 변환을 사용하려면 input_reference을 추가하십시오. 플레이그라운드는 1단계(제출)만 수행합니다 — 작업 id을 받은 후 아래 설명에 따라 폴링하고 다운로드하십시오.
⚠️ 가장 흔한 세 가지 실수
  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 다운로드
제출 결과는 수 초 내에 반환되며 동영상이 완료될 때까지 기다리지 않습니다.

코드 예제

파이썬 (텍스트-동영상, 모든 세 단계)

파이썬 (이미지-동영상, 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