API-Dokumentation

GrokImagine API Referenz

Vollständige API-Dokumentation zur Integration von GrokImagine AI in Ihre Anwendungen. Generieren Sie hochwertige Videos aus Text-Prompts und Bildern mit mehreren kreativen Modi.

REST API
JSON Antworten
Videoerstellung

Authentifizierung

GrokImagine API verwendet Bearer Token Authentifizierung. Fügen Sie Ihr API-Token im Authorization Header ein:

Authorization: Bearer your-api-token-here

Sicherheitshinweis: Veröffentlichen Sie Ihr API-Token niemals im Client-Code oder öffentlichen Repositories.

Basis-URL

Alle API-Anfragen sollten an folgende URL gesendet werden:

https://grokimagineapi.com

API Endpunkte

POST

Video generieren

/v1/generate

Erstellen Sie hochwertige Videos aus Text-Prompts und Bildern mithilfe von KI-Modellen.

Request Body

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

Parameter

ParameterTypBeschreibung
modestringGenerierungsmodus, unterstützt: fun, normal, spicy
promptstringTextprompt für die Videogenerierung
imagesstring?Optional, Array von Bild-URLs zur Bild-zu-Video-Generierung. Beispiel: ['https://example.com/image.png']
ratiostringSeitenverhältnis, unterstützt: 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"

Fehlerbehandlung

GrokImagine API gibt standardisierte HTTP-Statuscodes und Fehlermeldungen zurück:

HTTP-Statuscodes

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

Fehlerformat

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

Best Practice: Behandeln Sie Fehler stets sauber und prüfen Sie den Statuscode, bevor Sie die Antwort verarbeiten.

Rate Limits

100
Anfragen/Minute
Free 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.

Bereit zum Start?

Holen Sie sich Ihren API-Schlüssel und erstellen Sie beeindruckende Videos mit Seedance