Developer Docs/Grok Video API

Grok Video API

Build Grok Video integrations with A2E. Review authentication, request parameters, task creation, status, and result endpoints.

Overview

Video generation using xAI's Grok model. Suitable for creative and coherent video synthesis from descriptive text prompts.

Primary Endpoint

POST/api/v1/grokVideo/start

Start Grok Imagine video generation

Request Parameters

NameTypeRequiredDescription
namestringNoName of the video generation task (optional, for identifying the task)
model_typeenum: text-to-video | image-to-videoNoGeneration mode. `text-to-video` generates video from text prompt, `image-to-video` generates video from a reference image.
model_versionenum: legacy | 1.5NoModel version. `1.5` uses Grok Imagine Video 1.5 and only supports image-to-video.
promptstringNoText prompt describing the video content. Required for text-to-video mode, optional for image-to-video mode.
modeenum: fun | normal | spicyNoGeneration style mode. For image-to-video, upstream may fallback spicy to normal.
image_urlsarray<string>NoArray of reference image URLs for image-to-video mode. At least one image is required when `model_type` is `image-to-video`.
image_urlstringNoSingle reference image URL (alternative to `image_urls`). Will be prepended to `image_urls` array.
aspect_ratioenum: auto | 1:1 | 16:9 | 9:16 | 4:3 | 3:4 | 3:2 | 2:3NoVideo aspect ratio. Legacy text-to-video supports 1:1/16:9/9:16; legacy image-to-video can additionally accept 4:3/3:4/3:2/2:3 depending on the selected generation path. Grok 1.5 accepts the full list including auto.
durationenum: 6 | 10 | 15NoVideo duration in seconds.
nsfw_checkerbooleanNoWhether to enable additional NSFW checking for Grok 1.5.
webhook_urlstringNoHTTPS URL to receive task.completed / task.failed notifications. Best-effort delivery, single attempt, no retries; clients should treat the detail API as the source of truth.
webhook_tokenstringNoOptional plaintext token returned in the X-A2e-Webhook-Token header so receivers can verify the request originated from a2e.

Request Example

curl -X POST "https://www.a2e.com.cn/api/v1/grokVideo/start" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "My Grok Video",
  "model_type": "text-to-video",
  "model_version": "1.5",
  "prompt": "A cat playing with a ball of yarn in a cozy living room, warm lighting, cinematic style",
  "mode": "normal",
  "image_urls": [
    "https://example.com/reference.jpg"
  ],
  "image_url": "https://example.com/image.jpg",
  "aspect_ratio": "16:9",
  "duration": "6",
  "nsfw_checker": false,
  "webhook_url": "https://your-server.example.com/a2e/webhook",
  "webhook_token": "a-shared-secret"
}'

Related Endpoints

POST/api/v1/grokVideo/start

Start Grok Imagine video generation

GET/api/v1/grokVideo/allRecords

Get Grok Video task list

POST/api/v1/grokVideo/batchDetail

Batch query task details

GET/api/v1/grokVideo/{_id}

Get Grok Video task detail

DELETE/api/v1/grokVideo/{_id}

Delete Grok Video task

Responses

200

Video generation task started successfully

400

Bad Request - Invalid parameters

401

Unauthorized - Invalid or missing bearer token