Back to home

Documentation

Integrate text / image → video generation into your own system via the API.

Last updated: 2026-06-19

Quick start

Yunzhen exposes a REST API so you can integrate video generation into your own system. Three steps to your first video:

  1. Get an API key — create one under Admin → API Key management, and send it as Authorization: Bearer <key>.
  2. Submit a jobPOST /api/v1/video/generate, which returns task info (including a task ID).
  3. Poll for statusGET /api/v1/video/status?taskId=<id>; read the video URL once the status is completed.

All endpoints return a uniform shape: { "code": 0, "message": "ok", "data": { ... } }. A non-zero code means an error, with message describing it.

Three generation modes

The request body fields decide the path:

  • Text to video (T2V) — send only prompt.
  • Image to video (I2V) — send firstFrameImage (and optional lastFrameImage for storyboard continuity).
  • Multi-image reference — send an images array of reference images.

Generate a video

POST /api/v1/video/generate

Headers: Authorization: Bearer <API_KEY>, Content-Type: application/json

Body fields:

  • prompt required — text prompt, up to 10000 characters.
  • model — model name, defaults to doubao-seedance-2-0.
  • resolution480p / 720p / 1080p / 2k / 4k, defaults to 720p.
  • duration — clip length in seconds, 1–30, defaults to 5.
  • firstFrameImage / lastFrameImage — first/last frame image URLs for image-to-video.
  • images — array of reference image URLs.

Request:

POST /api/v1/video/generate
Authorization: Bearer sk-xxxxxxxx
Content-Type: application/json

{
  "prompt": "Cyberpunk city at night, neon lights, cinematic camera",
  "model": "doubao-seedance-2-0",
  "resolution": "1080p",
  "duration": 5
}

Response:

{
  "code": 0,
  "message": "ok",
  "data": {
    "taskId": "task_abc123",
    "status": "pending"
  }
}

Query a task

GET /api/v1/video/status?taskId=<taskId>

Headers: Authorization: Bearer <API_KEY>

Poll until status is completed, then read the video URL from data. Requesting a task that doesn't belong to the key owner returns an error.

{
  "code": 0,
  "message": "ok",
  "data": {
    "taskId": "task_abc123",
    "status": "completed",
    "videoUrl": "https://cdn.../video.mp4"
  }
}

Video CDN URLs are time-limited — re-host or download promptly.

Billing

Recharge rate: ¥1 = 100 credits. Each generation pre-charges credits as duration × per-resolution price; insufficient credits returns an error. Unit prices are configured by admins under Admin → Pricing, per channel × model × resolution.

Creative ad workflow

Recommended usage for advertisers — turn one product hook into a whole batch of ready-to-run assets:

  1. Expand the script — use text models to turn the hook into multiple storyboards and copy.
  2. Batch submit — call /api/v1/video/generate once per script × aspect ratio.
  3. Poll the batch — track each task with /api/v1/video/status.
  4. Export to ads — read the video URLs and distribute by ratio to your ad channels for testing.

Prefer a visual workflow? Try the workspace directly — no code required.