API Documentation

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.

REST API
JSON Responses
Video Generation

Authentication

GrokImagine API uses Bearer Token authentication. Include your API token in the Authorization header:

Authorization: Bearer your-api-token-here

Security Note: Never expose your API token in client-side code or public repositories.

Base URL

All API requests should be made to:

https://grokimagineapi.com

API Endpoints

POST

Generate Video

/v1/generate

Generate 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

ParameterTypeDescription
modestringGeneration mode, supports: fun, normal, spicy
promptstringText prompt for video generation
imagesstring?Optional parameter, array of image URLs, used to generate video from images. Example: ['https://example.com/image.png']
ratiostringAspect 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

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"

Error Handling

GrokImagine API returns standard HTTP status codes and error messages:

HTTP Status Codes

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

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

100
requests/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.

Ready to start building?

Get your API key and start creating amazing videos with Seedance