Endpoints
| Method | Endpoint | Description |
|---|
| POST | /api/v1/generateTask/grok-video | Create generation task |
| GET | /api/v1/statusTask/grok-video | Query task status |
Authentication
All requests require an API Key in the header:
Authorization: Bearer YOUR_API_KEY
Request Body
{
"request_type": "async",
"callback_url": "https://...",
"provider": "auto",
"input": {
"mode": "text-to-video",
"prompt": "A cinematic city street after rain, soft reflections, slow camera push.",
"duration": 6,
"resolution": "480p",
"aspect_ratio": "3:2",
"style": "normal",
"image_urls": ["https://example.com/ref.jpg"],
"task_id": "task_previous_grok_image",
"index": 0
}
}
Parameters
async (polling) or callback (webhook)
Callback URL, required when request_type=callback (conditional)
Routing strategy: auto, value, or official
Model input parameters
mode
string
default:"text-to-video"
required
text-to-video or image-to-video
Text description, 1-5000 characters
duration
integer
default:"6"
required
Video duration in seconds: 6-30
resolution
string
default:"480p"
required
Output resolution: 480p or 720p
1:1, 3:2, 2:3, 16:9, or 9:16 (text-to-video recommended)
Reference image URL, max 1 (image-to-video option A) (conditional)
Previous grok-image task ID (image-to-video option B) (conditional)
Result index from previous task, range 0-5 (use with task_id) (conditional)
Mode Options:
text-to-video - Generate video from text
image-to-video - Generate video from image (image upload or task continuation)
Example
Text-to-Video
curl -X POST "https://api.apixo.ai/api/v1/generateTask/grok-video" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "async",
"input": {
"mode": "text-to-video",
"prompt": "a peaceful lakeside at sunset with gentle waves",
"duration": 6,
"resolution": "480p",
"aspect_ratio": "3:2",
"style": "normal"
}
}'
Image-to-Video (with reference image)
curl -X POST "https://api.apixo.ai/api/v1/generateTask/grok-video" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "async",
"provider": "value",
"input": {
"mode": "image-to-video",
"prompt": "make this scene into a short cinematic pan",
"duration": 6,
"resolution": "480p",
"image_urls": ["https://example.com/ref.jpg"],
"style": "fun"
}
}'
Image-to-Video (task continuation)
curl -X POST "https://api.apixo.ai/api/v1/generateTask/grok-video" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "callback",
"callback_url": "https://your-server.com/callback",
"provider": "official",
"input": {
"mode": "image-to-video",
"prompt": "turn this character into a walking animation",
"duration": 10,
"resolution": "720p",
"task_id": "task_previous_grok_image",
"index": 0,
"style": "spicy"
}
}'
Response
POST /api/v1/generateTask/grok-video
Returns taskId on success for subsequent status queries.
Success:
{
"code": 200,
"message": "success",
"data": {
"taskId": "task_12345678"
}
}
Error:
{
"code": 400,
"message": "Insufficient credits",
"data": null
}
GET /api/v1/statusTask/grok-video
Query task execution status and results via taskId.
curl -X GET "https://api.apixo.ai/api/v1/statusTask/grok-video?taskId=task_12345678" \
-H "Authorization: Bearer YOUR_API_KEY"
Success:
{
"code": 200,
"message": "success",
"data": {
"taskId": "task_12345678",
"state": "success",
"resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/video.mp4\"]}",
"createTime": 1767965610929,
"completeTime": 1767965652317,
"costTime": 41388
}
}
Failed:
{
"code": 200,
"message": "success",
"data": {
"taskId": "task_12345678",
"state": "failed",
"failCode": "CONTENT_VIOLATION",
"failMsg": "Content does not meet safety guidelines"
}
}
Status Response Fields
Current task state: pending, processing, success, or failed.
JSON string containing resultUrls array. Only present on success. Parse with JSON.parse().
Error code. Only present when state is failed. See Error Codes.
Human-readable error message. Only present when state is failed.
Task creation timestamp (Unix milliseconds).
Task completion timestamp (Unix milliseconds).
Processing duration in milliseconds.
Error Codes
| Code | Description |
|---|
| 400 | Invalid parameters or request error |
| 401 | Invalid or missing API Key |
| 429 | Rate limit exceeded |
| Fail Code | Description |
|---|
CONTENT_VIOLATION | Content violates safety guidelines |
INVALID_IMAGE_URL | Cannot access provided image URL |
INVALID_TASK_ID | Invalid previous task ID or index |
Rate Limits
| Limit | Value |
|---|
| Requests | 60 / minute |
| Concurrent tasks | 10 |
Exceeding limits returns 429 error. Wait and retry.
Tips
- Use 480p with 6-second duration as the cheapest test preset.
- For image-to-video, send either
image_urls or task_id + index, not both.
spicy style is best for continuation/recreation workflows.
- Submit task, wait about 30 seconds, then poll every 5 seconds.
- Result URLs expire after 15 days. Download important outputs promptly.
Prefer callback mode in production workloads to avoid frequent polling.