# Grok Imagine Video API xAI의 Grok Imagine 비디오 생성 모델에 대한 완전한 API 레퍼런스입니다. ## 모델 변형 이 API는 두 가지 모델 변형을 지원합니다: | 모델 | ID | 설명 | |-------|-----|-------------| | **Grok Imagine Text to Video** | `grok-imagine-text-to-video` | 텍스트-비디오 생성 | | **Grok Imagine Image to Video** | `grok-imagine-image-to-video` | 이미지-비디오 애니메이션 | ## 빠른 비교 | 기능 | Text to Video | Image to Video | |---------|---------------|----------------| | 입력 | 텍스트 프롬프트 | 참조 이미지 배열 + 텍스트 프롬프트 | | 참조 이미지 | 지원 안 함 | 필수 (`images`) | ## Grok Imagine Text to Video ### 엔드포인트 ``` POST /api/v1/video/task ``` ### 요청 파라미터 #### 필수 | 파라미터 | 타입 | 설명 | |-----------|------|-------------| | `model_name` | string | `"grok-imagine-text-to-video"`이어야 합니다 | | `prompt` | string | 비디오 생성 프롬프트 | #### 선택 사항 | 파라미터 | 타입 | 설명 | |-----------|------|-------------| | `duration` | number | 비디오 길이(초): `6` 또는 `10` | | `resolution` | string | 출력 해상도: `"480p"` 또는 `"720p"` | | `aspect_ratio` | string | 비디오 화면 비율: `"16:9"`, `"1:1"` 또는 `"9:16"` | ### 요청 예시 ```javascript const response = await fetch('https://api.flaq.ai/api/v1/video/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'grok-imagine-text-to-video', prompt: 'A robot walking through a futuristic city', duration: 6, resolution: '720p', aspect_ratio: '16:9' }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## Grok Imagine Image to Video ### 요청 파라미터 #### 필수 | 파라미터 | 타입 | 설명 | |-----------|------|-------------| | `model_name` | string | `"grok-imagine-image-to-video"`이어야 합니다 | | `prompt` | string | 비디오 생성 프롬프트 | | `images` | string[] | 비디오 생성에 사용할 참조 이미지 URL 배열 | #### 선택 사항 | 파라미터 | 타입 | 설명 | |-----------|------|-------------| | `duration` | number | 비디오 길이(초): `6` 또는 `10` | | `resolution` | string | 출력 해상도: `"480p"` 또는 `"720p"` | ### 요청 예시 ```javascript { model_name: 'grok-imagine-image-to-video', images: ['https://example.com/reference.jpg'], prompt: 'Camera slowly zooms in on the subject', duration: 6, resolution: '720p' } ``` ## 응답 형식 ### 초기 응답 두 모델 모두 폴링을 위한 `task_id`를 반환합니다: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "submitted" } } ``` ### 폴링 응답 `GET /api/v1/video/{taskId}`를 폴링하여 상태를 확인합니다: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "succeed", "task_status_msg": null, "task_result": { "credit": 0.2, "videos": [ { "url": "https://example.com/generated-video.mp4" } ] } } } ``` ### 상태 값 - `submitted`: 작업이 제출되었으며 처리 대기 중 - `processing`: 비디오 생성 진행 중 - `succeed`: 비디오 생성 완료 - `failed`: 비디오 생성 실패 ## 처리 시간 일반적인 처리 시간: 2-5분. ## 모범 사례 1. **창의적인 프롬프트**: Grok Imagine Video는 상상력이 풍부하고 상세한 장면 설명에서 뛰어난 성능을 발휘합니다 2. **동작 설명**: 프롬프트에 카메라 움직임과 피사체 동작을 포함하세요 3. **이미지 품질**: 이미지-비디오 변환 시 고품질 입력 이미지를 사용하세요