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.
Kimlik Doğrulama
GrokImagine API, Bearer Token kimlik doğrulaması kullanır. API tokenınızı Authorization başlığına ekleyin:
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:
API Uç Noktaları
Video Oluştur
/v1/generateMetin 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
| Parametre | Tür | Açıklama |
|---|---|---|
| mode | string | Oluşturma modu: fun, normal, spicy |
| prompt | string | Video oluşturma için metin girdisi |
| images | string? | Opsiyonel, görüntüden video oluşturmak için URL dizisi. Örnek: ['https://example.com/image.png'] |
| ratio | string | En-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 Task Status
/v1/status?task_id=xxxxCheck 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ı
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ı
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