API Documentation

Create video

Endpoint: POST https://tkhub.lol/v1/videos/generations

Grok Imagine text-to-video / image-to-video via the xAI native JSON API. The response contains a request_id; poll GET /v1/videos/{request_id} for the result.

Models and billing

  • grok-1.5-video: billed per request at the same price as POST /v1/videos, regardless of duration or resolution; same capabilities as grok-imagine-video-1.5; editing (/v1/videos/edits) and extension (/v1/videos/extensions) are not supported.
  • grok-imagine-video-1.5, grok-imagine-video-1.5-preview, grok-imagine-video-1.5-lite: billed per second, the rate depends on resolution; input images (first frame, reference images, last frame, keyframes) are billed per image.
  • grok-imagine-video: billed per second, up to 720p.

See the model marketplace for current prices; available models depend on the group of your token.

Parameters

  • Content-Type (header, string): Request body Content-Type, usually application/json
  • Authorization (header, string): Bearer API Key

Request body (application/json)

  • model (string, required): Model name: grok-1.5-video, grok-imagine-video-1.5, grok-imagine-video-1.5-preview, grok-imagine-video-1.5-lite, grok-imagine-video
  • aspect_ratio (string): Aspect ratio: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9, 5:2. If omitted, text-to-video defaults to 16:9 and image-to-video follows the input image
  • duration (integer): Video length in seconds, 1–15, default 8
  • image (object): First-frame image (image-to-video). Cannot be used together with reference_images
  • keyframes (array<object>): Mid-video keyframes, at most 4. Supported by the 1.5 models only (including grok-1.5-video)
  • last_frame (object): Last-frame image; the video ends on this image. Supported by the 1.5 models only (including grok-1.5-video)
  • prompt (string): Prompt. Required for text-to-video; optional when image, reference_images, last_frame or keyframes is provided
  • reference_images (array<object>): Reference images (reference-to-video), used as style / content references. Cannot be used together with image
  • resolution (string): Resolution: 480p (default), 720p, 1080p; grok-imagine-video does not support 1080p

Request example

{
  "duration": 6,
  "image": {
    "url": "https://example.com/first-frame.png"
  },
  "model": "grok-1.5-video",
  "prompt": "The clouds drift slowly and the water ripples",
  "resolution": "720p"
}