API-Dokumentation
API-Referenz
Dokumentation für Integration
REST API
JSON Antworten
Videogenerierung
Authentifizierung
Bearer Token
Authorization: Bearer your-api-token-here
Sicherheit: Token nicht teilen
Basis-URL
Anfragen an:
https://grokimagineapi.com
API-Endpunkte
POST
Video generieren
/v1/generateVideoerstellung
Anfragekörper
{
"mode": "fun",
"prompt": "a beautiful landscape with mountains",
"images": ["https://example.com/image.png"],
"ratio": "1:1"
}Parameter
| Parameter | Typ | Beschreibung |
|---|---|---|
| mode | string | Modus |
| prompt | string | Prompt |
| images | string? | Bilder |
| ratio | string | Verhältnis |
💰 Pricing
Each generation consumes 40 credits, approximately 0.4 USD
Antwort
{
"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
Status abrufen
/v1/status?task_id=xxxxStatus prüfen
Parameter
GET-Anfrage 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"
]
}
}Antwortfelder
- consumed_credits: Credits
- created_at: Erstellt am
- status: Status
- task_id: Task-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: Anfrage
- response: Antwort
cURL Example
curl -X GET "https://grokimagineapi.com/v1/status?task_id=task_123456789" \ -H "Authorization: Bearer your-api-token"
Fehlerbehandlung
Fehlercodes
HTTP-Codes
200OK
400Bad Request
401Unauthorized
429Rate Limited
500Server Error
Format
{
"code": 400,
"message": "Invalid request: The prompt parameter is required",
"error": "INVALID_REQUEST"
}Praxis: Fehler behandeln
Limits
100
Anfr/Min
Kostenlos
1000
requests/minute
Pro
5000
requests/minute
Enterprise
Limit-Header: Header X-RateLimit-Remaining und X-RateLimit-Reset