GrokImagine API Reference
Complete API documentation for integrating GrokImagine AI into your applications. Generate high-quality videos from text prompts and images with multiple creative modes.
Authentication
GrokImagine API uses Bearer Token authentication. Include your API token in the Authorization header:
Security Note: Never expose your API token in client-side code or public repositories.
Base URL
All API requests should be made to:
API Endpoints
Generate Video
/v1/generateGenerate high-quality videos from text prompts and images using AI models.
Request Body
{
"mode": "fun",
"prompt": "a beautiful landscape with mountains",
"images": ["https://example.com/image.png"],
"ratio": "1:1"
}Parameters
| Parameter | Type | Description |
|---|---|---|
| mode | string | Generation mode, supports: fun, normal, spicy |
| prompt | string | Text prompt for video generation |
| images | string? | Optional parameter, array of image URLs, used to generate video from images. Example: ['https://example.com/image.png'] |
| ratio | string | Aspect ratio, supports: 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"
Error Handling
GrokImagine API returns standard HTTP status codes and error messages:
HTTP Status Codes
Error Response Format
{
"code": 400,
"message": "Invalid request: The prompt parameter is required",
"error": "INVALID_REQUEST"
}Best Practice: Always handle errors gracefully and check HTTP status codes before processing the response body.
Rate Limits
Rate Limit Headers: Each response includes X-RateLimit-Remaining and X-RateLimit-Reset headers to track your current usage.
Ready to start building?
Get your API key and start creating amazing videos with Seedance