Skip to main content

Documentation Index

Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Grok Video is an xAI video model for text-to-video generation and image-to-video workflows. Use this page when you are ready to call the API after trying the model in the APIXO playground.
CapabilityValue
Model IDgrok-video
Modestext-to-video, image-to-video
Prompt length1-5000 characters
Duration6-30 seconds
Resolutions480p, 720p
Aspect ratios1:1, 3:2, 2:3, 16:9, 9:16
Image-to-video sources1 image URL, or a completed grok-image task with task_id and index
OutputMP4 video URL in resultJson.resultUrls

Endpoint and authentication

Base URL:
https://api.apixo.ai/api/v1
MethodEndpointPurpose
POST/generateTask/grok-videoSubmit a generation task
GET/statusTask/grok-video?taskId={taskId}Poll task status and retrieve results
All requests require your APIXO API key:
Authorization: Bearer YOUR_API_KEY
Submit requests also require:
Content-Type: application/json

Copy-paste async quickstart

This minimal request submits a text-to-video task and returns a taskId.
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"
    }
  }'
Successful response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
Save the taskId; you need it to poll for the final result.

Poll for result

curl -X GET "https://api.apixo.ai/api/v1/statusTask/grok-video?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
Processing response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
Success response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/xxx.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965655929,
    "costTime": 45000
  }
}
Failed response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "SensitiveContent",
    "failMsg": "Content violates provider policy, please adjust the prompt",
    "createTime": 1767965610929,
    "completeTime": 1767965620132
  }
}
Parse resultJson after state becomes success:
const payload = JSON.parse(data.resultJson);
const videoUrls = payload.resultUrls;

Request body

Text-to-video

{
  "request_type": "async",
  "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-to-video with an image URL

{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "make this scene into a short cinematic pan",
    "image_urls": [
      "https://example.com/ref.jpg"
    ],
    "duration": 10,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "style": "fun"
  }
}

Image-to-video from a Grok Image task

{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "turn this character into a walking animation",
    "task_id": "task_previous_grok_image",
    "index": 0,
    "duration": 10,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "style": "spicy"
  }
}

Parameters

request_type
string
default:"async"
Result delivery mode. Omit this field or use async for polling with statusTask, or use callback for webhook delivery.
callback_url
string
Required when request_type is callback. Provide a public HTTPS URL that can receive the final task payload. See Webhooks.
input
object
required
Grok Video input parameters.

Response format

Submit task response

POST /generateTask/grok-video returns a task ID when the task is accepted:
code
integer
API status code. 200 means the task was accepted.
message
string
Human-readable status message.
data.taskId
string
Unique task identifier used with the status endpoint.

Status response fields

taskId
string
Unique task identifier.
state
string
Current task state: processing, success, or failed.
resultJson
string
JSON string containing the generated video URLs in resultUrls. Present when state is success.
failCode
string
Machine-readable failure code. Present when state is failed.
failMsg
string
Human-readable failure message. Present when state is failed.
createTime
integer
Task creation timestamp in Unix milliseconds.
completeTime
integer
Task completion timestamp in Unix milliseconds. Present after completion.
costTime
integer
Processing duration in milliseconds. Present after completion.

Webhook callback mode

Use callback mode when your backend should receive the final result automatically instead of polling.
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/webhooks/apixo",
    "input": {
      "mode": "text-to-video",
      "prompt": "a clean product reveal video with a slow camera push-in",
      "duration": 6,
      "resolution": "480p",
      "aspect_ratio": "3:2",
      "style": "normal"
    }
  }'
Callback delivery uses the same final payload shape as the status response. See Webhooks for delivery requirements and retry behavior.

Billing

Grok Video is billed per second. The selected resolution determines the per-second unit price, and the submitted duration determines the billable seconds.
ResolutionAPIXO priceMinimum valid request cost
480p$0.015 / second$0.09 for 6 seconds
720p$0.03 / second$0.18 for 6 seconds
Formula:
total cost = duration * resolution unit price
For current route and market comparison pricing, see Pricing.

Latency and polling

The user manual lists typical Grok Video generation time at about 40s-60s. Actual latency may vary by prompt complexity, duration, resolution, provider queue load, and storage transfer time.
WorkloadTypical generation timeRecommended first pollPoll interval
480p or 720p, 6-30 secondsAbout 40s-60s30s after task creation5s
For production workloads, use callback mode to avoid frequent polling while video tasks run.
Result URLs are valid for 15 days. Download and store important outputs promptly. For image-to-video, use exactly one source method: either image_urls, or task_id with index. Public image URLs should point directly to JPG, PNG, or WebP files and should be accessible by APIXO. Prompts can be written in English or Chinese. More specific camera motion, scene timing, subject action, lighting, and style details usually produce better results. Rate limits and concurrency can vary by account, API key, and route. If you receive 429, slow down requests and retry with backoff. For account-level details, see System APIs.

Errors and troubleshooting

HTTP errors

CodeMeaningWhat to do
400Invalid request body, missing mode, missing prompt, invalid duration, invalid resolution, malformed image input, or invalid task_id / indexFix the request before retrying
401Missing or invalid API keyCheck the Authorization header
402Insufficient balance or quotaAdd balance or switch account/key
404Task not found when pollingCheck the taskId
429Rate limit or concurrency limit reachedRetry with exponential backoff
500Internal error or unknown task failureRetry with backoff or contact support if it persists
502Upstream provider or network errorRetry with backoff
503Service temporarily unavailableRetry later
504Upstream timeoutRetry later or use callback mode for long-running jobs

Validation notes

ParameterBackend behavior
input.modeRequired for routing. Must be text-to-video or image-to-video.
input.promptRequired string. Must not be empty and must not exceed 5000 characters.
input.durationRequired. Accepts an integer or an integer string. Must resolve to a value from 6 through 30.
input.resolutionRequired string. 480p and 720p are accepted after trimming and lowercasing.
input.aspect_ratioOptional. Must be one of 1:1, 3:2, 2:3, 16:9, 9:16 when provided. Defaults are 3:2 for text-to-video and 16:9 for image-to-video.
input.image_urlsFor image-to-video, one accepted source method. Must be an array of non-empty strings and cannot contain more than 1 URL.
input.task_idFor image-to-video, the alternate source method. Must be an existing completed APIXO grok-image task.
input.indexRequired with task_id. Must be an integer from 0 through 5.
input.styleOptional. Must be fun, normal, or spicy; defaults to normal when omitted.

Task failure codes

failCode is generated from APIXO’s mapped provider error. Common values include:
Fail codeMeaningWhat to do
SensitiveContentPrompt or input/output content was rejected by safety checksChange the prompt or reference image
PromptInvalidPrompt was invalid or rejected by the providerRewrite the prompt and retry
ImageFormatIncorrectReference image format could not be processedUse a public, direct image URL in a common image format
RateLimitedProvider rate limit was reachedRetry with exponential backoff
TimeoutProvider timeoutRetry later or use callback mode
InternalErrorProvider or APIXO service was temporarily unavailableRetry later
Unknown errorProvider returned an unmapped failureRetry with backoff or contact support with the taskId
See Error Codes for the full error reference.