API Dokümanı
API Referansı
Entegrasyon kılavuzu
REST API
JSON Yanıtları
Video Oluşturma
Kimlik Doğrulama
Bearer Token
Authorization: Bearer your-api-token-here
Güvenlik: Tokenı gizleyin
Temel URL
İstek adresi:
https://grokimagineapi.com
API Uçları
POST
Video Oluştur
/v1/generateVideo üret
Gövde
{
"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 | Mod |
| prompt | string | Prompt |
| images | string? | Görseller |
| ratio | string | Oran |
💰 Pricing
Each generation consumes 40 credits, approximately 0.4 USD
Yanıt
{
"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
Görev Durumu
/v1/status?task_id=xxxxDurum kontrol et
Sorgu Parametreleri
GET isteği 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"
]
}
}Yanıt Alanları
- consumed_credits: Krediler
- created_at: Oluşturma
- status: Durum
- task_id: Görev 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: İstek
- response: Yanıt
cURL Example
curl -X GET "https://grokimagineapi.com/v1/status?task_id=task_123456789" \ -H "Authorization: Bearer your-api-token"
Hata Yönetimi
Hata kodları
HTTP Kodları
200OK
400Bad Request
401Unauthorized
429Rate Limited
500Server Error
Format
{
"code": 400,
"message": "Invalid request: The prompt parameter is required",
"error": "INVALID_REQUEST"
}Pratik: Hataları yönetin
Sınırlar
100
istek/dk
Ücretsiz
1000
requests/minute
Pro
5000
requests/minute
Kurumsal
Sınır Başlıkları: X-RateLimit-Remaining ve X-RateLimit-Reset başlıkları