Skip to content

Video Generation

📝 Introduction

Video generation is asynchronous: submit a task, receive a task ID, then poll for the result.

Family Models Create Endpoint
Google Veo veo-3.1-generate-preview, veo-3.1-fast-generate-preview, veo-3.0-generate-001, veo-3.0-fast-generate-001 POST /v1/video/generations
Vidu viduq3-pro, viduq3-turbo, viduq3-fast POST /v1/video/generations
HappyHorse happyhorse-1.0-t2v POST /v1/video/generations
Kling kling-v3, kling-v2-6, kling-v2-5-turbo POST /kling/v1/videos/text2video, POST /kling/v1/videos/image2video

Authentication

Authorization: Bearer $WS_API_KEY

Unified Format (/v1/video/generations)

Create a Video Generation Task ✅

Supports text-to-video and image-to-video.

curl -X POST "http://baseurl/v1/video/generations" \
  -H "Authorization: Bearer $WS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo-3.1-generate-preview",
    "prompt": "A drone shot flying over a coastal city at golden hour, cinematic",
    "metadata": {
      "resolution": "720p",
      "ratio": "16:9",
      "duration": 8,
      "generate_audio": true
    }
  }'

For image-to-video, add the images field:

{
  "model": "viduq3-pro",
  "prompt": "The camera slowly zooms in while leaves fall",
  "images": ["https://example.com/first-frame.jpg"]
}

Response — a task ID:

{"task_id": "task_id"}

Request Parameters

Parameter Type Required Description
model string Yes Video model ID, see table above
prompt string Yes Text description of the desired video
images array No Reference image(s) (URL or base64) for image-to-video
metadata.resolution string No e.g. 480p, 720p, 1080p (model-dependent)
metadata.ratio string No Aspect ratio, e.g. 16:9, 9:16
metadata.duration integer No Video duration in seconds (model-dependent)
metadata.generate_audio boolean No Whether to generate audio (models that support it)

Query Task Status ✅

curl http://baseurl/v1/video/generations/task_id \
  -H "Authorization: Bearer $WS_API_KEY"

Response Example:

{
  "code": "success",
  "message": "",
  "data": {
    "task_id": "task_id",
    "action": "generate",
    "status": "SUCCESS",
    "fail_reason": "",
    "submit_time": 1775188030,
    "start_time": 1775188043,
    "finish_time": 1775188329,
    "progress": "100%",
    "data": {
      "id": "task_id",
      "status": "succeed",
      "duration": 8,
      "resolution": "720p",
      "result": {
        "content": {
          "video_url": "video download URL"
        }
      }
    }
  }
}

Task status values:

  • queued: queued
  • in_progress: in progress
  • completed: completed
  • failed: failed

Download promptly

Generated video URLs are temporary. Download and store the video on your side as soon as the task completes.

Kling Format

Text-to-Video — Create Task ✅

curl -X POST "http://baseurl/kling/v1/videos/text2video" \
  -H "Authorization: Bearer $WS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-v3",
    "prompt": "A cat playing piano in the garden",
    "negative_prompt": "blurry, low quality",
    "cfg_scale": 0.7,
    "mode": "pro",
    "aspect_ratio": "16:9",
    "duration": "4",
    "metadata": {
      "sound": "on"
    }
  }'

Request parameters:

Parameter Type Required Description
model string Yes kling-v3, kling-v2-6, kling-v2-5-turbo
prompt string Yes Positive prompt describing the desired video content
negative_prompt string No Negative prompt describing content to avoid
cfg_scale float No Prompt adherence, range 01; higher follows the prompt more closely
mode string No std (standard) or pro (high quality)
aspect_ratio string No 16:9, 9:16, 1:1
duration string No Video duration in seconds, e.g. 4, 5, 10
metadata.sound string No on to generate audio, off to disable

Response Example:

{
  "code": 0,
  "message": "SUCCEED",
  "request_id": "request_id",
  "data": {
    "task_id": "task_id",
    "task_status": "submitted",
    "created_at": 1775188030000,
    "updated_at": 1775188030000
  }
}

Text-to-Video — Query Task ✅

curl "http://baseurl/kling/v1/videos/text2video/task_id" \
  -H "Authorization: Bearer $WS_API_KEY"

Response Example:

{
  "code": 0,
  "message": "SUCCEED",
  "request_id": "request_id",
  "data": {
    "task_id": "task_id",
    "task_status": "succeed",
    "task_status_msg": "",
    "created_at": 1775188030000,
    "updated_at": 1775188329000,
    "task_result": {
      "videos": [
        {
          "id": "video_id",
          "url": "video download URL",
          "duration": "4"
        }
      ]
    }
  }
}

Image-to-Video — Create Task ✅

Uses an image as the first frame (optional last frame).

curl -X POST "http://baseurl/kling/v1/videos/image2video" \
  -H "Authorization: Bearer $WS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-v3",
    "image": "https://example.com/first-frame.jpg",
    "image_tail": "https://example.com/last-frame.jpg",
    "prompt": "A cat playing piano in the garden",
    "cfg_scale": 0.7,
    "mode": "pro",
    "duration": "4"
  }'

Additional parameters vs. text-to-video:

Parameter Type Required Description
image string Yes First frame image, URL or Base64
image_tail string No Last frame image, URL or Base64

Image-to-Video — Query Task ✅

curl "http://baseurl/kling/v1/videos/image2video/task_id" \
  -H "Authorization: Bearer $WS_API_KEY"

Kling task status values:

  • submitted: submitted
  • processing: in progress
  • succeed: completed
  • failed: failed