API 문서

API 레퍼런스

통합 가이드

REST API
JSON 응답
영상 생성

인증

Bearer Token 방식

Authorization: Bearer your-api-token-here

보안: 노출 주의

베이스 URL

요청 주소:

https://grokimagineapi.com

API 엔드포인트

POST

영상 생성

/v1/generate

영상 만들기

요청 본문

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

파라미터

파라미터유형설명
modestring모드
promptstring프롬프트
imagesstring?이미지
ratiostring비율
💰 Pricing

Each generation consumes 40 credits, approximately 0.4 USD

응답

{
  "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

상태 조회

/v1/status?task_id=xxxx

상태 확인

쿼리 파라미터

GET 요청 사용 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",
    "error_message": null,
    "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"
    ]
  }
}
필드 설명
  • consumed_credits: 소모 크레딧
  • created_at: 생성일
  • status: 상태
  • task_id: 작업 ID
  • error_message: Error details if the task failed. Examples: 'File type not supported', 'Inappropriate content, please try another prompt.', 'grok imagine build failed', 'Network error, please try again later.'
  • request: 요청
  • response: 응답
cURL Example
curl -X GET "https://grokimagineapi.com/v1/status?task_id=task_123456789" \
  -H "Authorization: Bearer your-api-token"

오류 처리

오류 코드

HTTP 코드

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

형식

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

권장 사항: 오류 처리

제한

100
회/분
무료
1000
requests/minute
Pro
5000
requests/minute
기업

제한 헤더: X-RateLimit-Remaining 및 X-RateLimit-Reset

준비되었나요?

키 발급