API 문서

GrokImagine API 레퍼런스

GrokImagine AI를 애플리케이션에 통합하기 위한 전체 API 문서입니다. 텍스트와 이미지를 기반으로 고품질 영상을 생성할 수 있습니다.

REST API
JSON 응답
영상 생성

인증

GrokImagine API는 Bearer Token 인증 방식을 사용합니다. Authorization 헤더에 API 토큰을 포함하세요:

Authorization: Bearer your-api-token-here

보안 주의: API 토큰을 클라이언트 코드나 공개 저장소에 노출하지 마십시오.

베이스 URL

모든 API 요청은 다음 주소로 전송해야 합니다:

https://grokimagineapi.com

API 엔드포인트

POST

영상 생성

/v1/generate

AI 모델을 사용해 텍스트 또는 이미지 기반으로 고품질 영상을 생성합니다.

요청 본문

{
  "mode": "fun",
  "prompt": "a beautiful landscape with mountains",
  "images": ["https://example.com/image.png"],
  "ratio": "1:1"
}

파라미터

파라미터유형설명
modestring생성 모드: fun, normal, spicy
promptstring영상 생성을 위한 텍스트 프롬프트
imagesstring?옵션, 이미지 URL 배열 (이미지 기반 영상 생성). 예:['https://example.com/image.png']
ratiostring비율: 2:3, 3:2, 1:1
💰 Pricing

Each generation consumes 40 credits, approximately 0.4 USD

Response

{
  "code": 200,
  "message": "success",
  "data": {
    "task_id": "task_123456789"
  }
}
cURL Example
curl -X POST https://grokimagineapi.com/v1/generate \
  -H "Authorization: Bearer your-api-token" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "fun",
    "prompt": "a beautiful landscape with mountains",
    "ratio": "1:1"
  }'
GET

Get Task Status

/v1/status?task_id=xxxx

Check the status of an ongoing or completed video generation task.

Query Parameters

Use GET request with query parameter task_id=xxxx

Response

{
  "code": 200,
  "message": "success",
  "data": {
    "consumed_credits": 40,
    "created_at": "2024-01-01T00:00:00Z",
    "status": "completed",
    "task_id": "task_123456789",
    "request": {
      "mode": "fun",
      "prompt": "a beautiful landscape with mountains",
      "ratio": "1:1"
    },
    "response": [
      "https://cdn.example.com/generated/video1.mp4",
      "https://cdn.example.com/generated/video2.mp4"
    ]
  }
}
📋 Response Fields
  • consumed_credits: Number of credits consumed
  • created_at: Task creation timestamp
  • status: Task status
  • task_id: Task ID
  • request: Original request data
  • response: Video URL string array
cURL Example
curl -X GET "https://grokimagineapi.com/v1/status?task_id=task_123456789" \
  -H "Authorization: Bearer your-api-token"

오류 처리

GrokImagine API는 표준 HTTP 상태 코드와 오류 메시지를 반환합니다:

HTTP 상태 코드

200OK
400Bad Request
401Unauthorized
429Rate Limited
500Server Error

오류 형식

{
  "code": 400,
  "message": "Invalid request: The prompt parameter is required",
  "error": "INVALID_REQUEST"
}

베스트 프랙티스: 응답 본문을 처리하기 전에 항상 HTTP 상태 코드를 확인하고 오류를 안정적으로 처리하세요.

요청 제한

100
요청/분
무료 플랜
1000
requests/minute
프로 플랜
5000
requests/minute
엔터프라이즈

Rate Limit Headers: Each response includes X-RateLimit-Remaining and X-RateLimit-Reset headers to track your current usage.

지금 시작해보세요!

API 키를 받아 Seedance와 함께 멋진 영상을 만들어보세요