API Dokümantasyonu

GrokImagine API Referansı

GrokImagine AI’yi uygulamalarınıza entegre etmek için eksiksiz API dokümantasyonu. Metin ve görsellerden yüksek kaliteli videolar üretin.

REST API
JSON Yanıtları
Video Oluşturma

Kimlik Doğrulama

GrokImagine API, Bearer Token kimlik doğrulaması kullanır. API tokenınızı Authorization başlığına ekleyin:

Authorization: Bearer your-api-token-here

Güvenlik Notu: API tokenınızı istemci tarafı kodunda veya herkese açık depolarda asla paylaşmayın.

Temel URL

Tüm API istekleri şu adrese gönderilmelidir:

https://grokimagineapi.com

API Uç Noktaları

POST

Video Oluştur

/v1/generate

Metin ve görsellerden yüksek kaliteli videolar üretmek için yapay zeka modellerini kullanır.

İstek Gövdesi

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

Parametreler

ParametreTürAçıklama
modestringOluşturma modu: fun, normal, spicy
promptstringVideo oluşturma için metin girdisi
imagesstring?Opsiyonel, görüntüden video oluşturmak için URL dizisi. Örnek: ['https://example.com/image.png']
ratiostringEn-boy oranı: 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"

Hata Yönetimi

GrokImagine API standart HTTP durum kodları ve hata mesajları döndürür:

HTTP Durum Kodları

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

Hata Formatı

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

En iyi uygulama: Her zaman hataları düzgün yönetin ve yanıt gövdesini işlemeden önce HTTP durum kodlarını kontrol edin.

Oran Sınırları

100
istek/dakika
Ücretsiz Plan
1000
requests/minute
Pro Plan
5000
requests/minute
Enterprise

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

Başlamaya hazır mısınız?

API anahtarınızı alın ve Seedance ile harika videolar oluşturun