HappyHorse 1.0 Now Live — Try It Free

Seedance 2.0 API

Welcome to the Seedance 2.0 API.

Overview

Seedance 2.0 is built for cinematic video generation with flexible multimodal inputs and controllable workflows, including Text to Video, Image to Video, First & Last Frame to Video, and Multi-Ref / Omni Reference.

Currently available models:

  • Seedance2-Pro (high quality)
  • Seedance2-Fast (lower cost)

Base URL: https://seegen.ai/api/v1

Model: sd2 (Pro) or sd2-fast (Fast)

Why SeeGen AI?

FeatureSeeGenFAL
AvailabilityLiveLive
Human reference supportYes (review-based)No
API StabilityProduction-ready-
ConcurrencyAuto-scalable (240+)Limited (~10)
LatencyLow & stableVariable
Resolutions720P / 1080P / 2K / 4K480P / 720P
SD2-Fast (720P)$0.128/s (save 47.1%)$0.2419/s
SD2-Pro (720P)$0.160/s (save 47.1%)$0.3024/s
SD2-Fast (720P, video input)from $0.160/s (save up to 44.9%)$0.2903/s
SD2-Pro (720P, video input)from $0.200/s (save up to 44.9%)$0.363/s
SD2-Pro (1080P)$0.400/sN/A
SD2-Pro (1080P, video input)from $0.500/sN/A

Note: Real human image and video assets require official review, usually completed within seconds. Once approved, they can be used directly as references. Without review, generation may fail.

More Reasons to Choose SeeGen AI:

  • No subscription is required — pay as you go
  • Fast access to the latest models
  • 24/7 customer support
  • Support for official model-related inquiries
  • Console access for developers
  • Open to both businesses and individual users

Free credits on signup, no subscription required. Try it in the playground →

Pricing

40% OFF

API Pack

$500$833

125,000 credits ($0.004/credit)

~781 5s videos

40% OFF

API-XL Pack

$2,000$3,332

500,000 credits ($0.004/credit)

~3,125 5s videos

Cost Calculation:

Let out = output_seconds and in = sum of ⌈duration⌉ of each input video (each rounded up, min out × 2/3).

No video inputInclude video input
sd2-pro: 720P40 × out30 × (out + in)
sd2-pro: 1080P100 × out75 × (out + in)
sd2-pro: 2K(40 + 30) × out30 × (out + in) + 30 × out
sd2-pro: 4K(40 + 40) × out30 × (out + in) + 40 × out
sd2-fast: 720P32 × out24 × (out + in)
sd2-fast: 1080P(32 + 20) × out24 × (out + in) + 20 × out
sd2-fast: 2K(32 + 30) × out24 × (out + in) + 30 × out
sd2-fast: 4K(32 + 40) × out24 × (out + in) + 40 × out

Note: sd2-pro 1080P is native official output at a higher cost; sd2-fast 1080P and 2K/4K in both modes are upscaled by SeeGen AI.

gpt-image-2 — credits per image

ResolutionMedium qualityHigh quality
1k1570
2k (default)35125
4k60230

Each task produces 1 image. Submit N tasks for N variants. Failed tasks refund credits automatically.

Check your balance: GET /api/v1/account/credits

Authentication

All API requests require a Bearer token in the Authorization header. You can create and manage API keys from your Account Settings.

curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://seegen.ai/api/v1/account/credits

Important: Your API key is shown only once at creation. Store it securely. You can create up to 10 API keys per account.

Quick Start

Generate a video in two steps: create a task, then poll for the result.

# 1. Create a text-to-video task
TASK_ID=$(curl -s -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sd2",
    "inputs": {
      "prompt": "A golden retriever running on the beach at sunset",
      "duration": "5s",
      "resolution": "1280x720"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask | jq -r '.taskId')

echo "Task created: $TASK_ID"

# 2. Poll for result
while true; do
  RESULT=$(curl -s -H "Authorization: Bearer $API_KEY" \
    "https://seegen.ai/api/v1/jobs/queryTask?taskId=$TASK_ID")
  STATUS=$(echo $RESULT | jq -r '.status')
  echo "Status: $STATUS"
  if [ "$STATUS" = "COMPLETED" ] || [ "$STATUS" = "FAILED" ]; then
    echo $RESULT | jq .
    break
  fi
  sleep 5
done

Endpoints

POST/api/v1/jobs/createTask

Create a new video generation task

GET/api/v1/jobs/queryTask

Query task status and result

GET/api/v1/account/credits

Check your credits balance

POST/api/v1/assets/upload

Upload an asset (image/video/audio) for review

GET/api/v1/assets/status

Query asset review status

GET/api/v1/assets/list

List your uploaded assets

POST/api/v1/upscale/create

Submit a standalone video upscale task (1080p / 2K / 4K)

GET/api/v1/upscale/query

Poll a standalone upscale task's status and result

Text to Video

Generate a video from a text prompt. No images required.

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sd2",
    "inputs": {
      "prompt": "A futuristic city with flying cars at night, neon lights reflecting on wet streets",
      "duration": "5s",
      "resolution": "1280x720"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask
ParameterTypeRequiredDescription
promptstringYesText description of the video to generate
durationstringNoVideo length: "4s" to "15s" (default: "5s")
resolutionstringNoAspect ratio via resolution. Options: 720x720, 720x960, 960x720, 1280x720, 720x1280, 1280x540
upscaleResolutionstringNoUpscale output via WaveSpeed: "1080p" / "2k" / "4k". Use "1080p" for sd2-fast to get 1080P (fast has no native 1080P).

Image to Video

Animate a static image into a video. Provide one image URL as the starting frame.

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sd2",
    "inputs": {
      "urls": ["https://example.com/photo.jpg"],  // or "asset://asset-20260326-abc123"
      "prompt": "The woman slowly turns her head and smiles",
      "duration": "5s"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask
ParameterTypeRequiredDescription
urlsstring[]YesArray with one image URL (the source frame). Supports both HTTP URLs and asset references (e.g. "asset://asset-20260326-abc123")
promptstringNoText description of the desired motion
durationstringNoVideo length: "4s" to "15s" (default: "5s")
upscaleResolutionstringNoUpscale output via WaveSpeed: "1080p" / "2k" / "4k". Use "1080p" for sd2-fast to get 1080P (fast has no native 1080P).

First & Last Frame

Define the starting and ending frames, and the model generates the transition between them. Uses videoInputMode: "keyframe".

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sd2",
    "inputs": {
      "urls": [
        "https://example.com/first-frame.jpg",
        "https://example.com/last-frame.jpg"
      ],
      "prompt": "Smooth camera transition from day to night",
      "duration": "5s",
      "videoInputMode": "keyframe"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask
ParameterTypeRequiredDescription
urlsstring[]YesArray with exactly 2 image URLs: [first_frame, last_frame]. Supports both HTTP URLs and asset references (e.g. "asset://asset-20260326-abc123")
videoInputModestringYesMust be "keyframe"
promptstringNoText description guiding the transition
durationstringNoVideo length: "4s" to "15s" (default: "5s")
upscaleResolutionstringNoUpscale output via WaveSpeed: "1080p" / "2k" / "4k". Use "1080p" for sd2-fast to get 1080P (fast has no native 1080P).

Multi-Reference

Use multiple reference images, videos, and audio files to guide generation. Uses videoInputMode: "reference".

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sd2",
    "inputs": {
      "urls": [
        "https://example.com/ref1.jpg",
        "https://example.com/ref2.jpg"
      ],
      "videoUrls": ["https://example.com/motion-ref.mp4"],
      "audioUrls": ["https://example.com/audio.mp3"],
      "prompt": "Character walks through a garden",
      "duration": "5s",
      "videoInputMode": "reference",
      "resolution": "1280x720"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask
ParameterTypeRequiredDescription
urlsstring[]NoReference image URLs (max 9). Supports both HTTP URLs and asset references (e.g. "asset://asset-20260326-abc123")
videoUrlsstring[]NoReference video asset:// URIs (max 3, each ≤15s). Must be uploaded via /api/v1/assets/upload first — external URLs are rejected.
audioUrlsstring[]NoReference audio URLs (max 3, each ≤15s). Cannot be the only reference — requires at least one image or video.
videoInputModestringYesMust be "reference"
promptstringNoText description
durationstringNoVideo length: "4s" to "15s" (default: "5s")
resolutionstringYesRequired for reference mode. Options: 720x720, 720x960, 960x720, 1280x720, 720x1280, 1280x540
upscaleResolutionstringNoUpscale output via WaveSpeed: "1080p" / "2k" / "4k". Use "1080p" for sd2-fast to get 1080P (fast has no native 1080P).

Reference Constraints

  • Max 9 images, 3 videos, 3 audio files
  • Max 12 total files across all types
  • Each video/audio must be ≤ 15 seconds
  • Images must be at least 400px on the shortest side

HappyHorse 1.0 (Alibaba)

An alternative video generation model from Alibaba DashScope. Supports three modes: text-to-video, first-frame image-to-video, and reference-to-video (1–9 reference images fused per prompt; refer to subjects with character1, character2, … in the prompt). HappyHorse 1.0 does not support last-frame, reference video, or reference audio. Model name: happyhorse.

No asset review required — you can use public HTTPS image URLs directly, or pass asset:// references from the asset library (resolved back to the original R2 URL automatically).

Text-to-Video

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happyhorse",
    "inputs": {
      "prompt": "A panda DJ at a beach party, smoky sunset",
      "duration": "5s",
      "outputResolution": "720p",
      "ratio": "16:9"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask

Image-to-Video (First Frame)

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happyhorse",
    "inputs": {
      "urls": ["https://example.com/panda.jpg"],
      "prompt": "The panda blinks and smiles",
      "duration": "5s",
      "outputResolution": "1080p"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask

Reference-to-Video (1–9 Reference Images)

Pass videoWorkflowTab: "multi-reference" with 1–9 reference image URLs to fuse multiple subjects into a single output. Reference each image in the prompt with character1, character2, … (matching the order of urls). Aspect ratio is controlled by the ratio field (no first frame to drive it from).

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happyhorse",
    "inputs": {
      "videoWorkflowTab": "multi-reference",
      "urls": [
        "https://example.com/character.jpg",
        "https://example.com/folding-fan.jpg",
        "https://example.com/earrings.jpg"
      ],
      "prompt": "A woman in red character1 opening folding fan character2, with tassel earrings character3 swinging",
      "duration": "5s",
      "outputResolution": "720p",
      "ratio": "16:9"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask
ParameterTypeRequiredDescription
promptstringNoText description. Required for text-to-video and reference-to-video; optional for image-to-video. Max 5000 non-CJK chars or 2500 CJK chars (upstream auto-truncates beyond). In r2v use character1/character2/… to refer to the N-th reference image.
urlsstring[]Not2v: omit. i2v: exactly 1 URL (used as the first frame). r2v: 1–9 URLs. Supports public HTTPS URLs and asset references (e.g. "asset://asset-20260326-abc123").
videoWorkflowTabstringNoSet to "multi-reference" to enable reference-to-video mode (must be combined with 1+ urls). Omit for text-to-video / image-to-video.
durationstringNoInteger seconds, "3" to "15" (default "5").
outputResolutionstringNo"720p" (default) or "1080p".
ratiostringNo"16:9" / "9:16" / "1:1" / "4:3" / "3:4". Used for text-to-video and reference-to-video — image-to-video aspect is inferred from the first frame.
seedintNo0 to 2147483647. Leave blank for a random seed.

Image Requirements (i2v / r2v)

  • Shortest side ≥ 300px
  • Aspect ratio between 1:2.5 and 2.5:1
  • Formats: JPEG, JPG, PNG, BMP, WEBP
  • Max file size 10MB per image (r2v: each of the 1–9 inputs)

Pricing

  • 720P: 32 credits/sec (5s = 160, 15s = 480)
  • 1080P: 60 credits/sec (5s = 300, 15s = 900)
  • r2v / i2v / t2v share the same per-second rate (reference images are not billed)

Parameters Reference

Complete reference of all inputs parameters for the sd2 model.

ParameterTypeRequiredDescription
promptstringNoText description (required for text-to-video, optional for other modes)
urlsstring[]NoImage URLs. Supports both HTTP URLs and asset references (e.g. "asset://asset-20260326-abc123"). Maps to uploadedUrls internally.
videoUrlsstring[]NoVideo reference asset:// URIs (reference mode only). Must be uploaded via /api/v1/assets/upload first — external URLs are rejected.
audioUrlsstring[]NoAudio reference URLs (reference mode only). Cannot be the only reference — requires at least one image or video.
durationstringNo"4s" to "15s". Default: "5s"
resolutionstringNoAspect ratio (pixel string): 720x720 | 720x960 | 960x720 | 1280x720 | 720x1280 | 1280x540
outputResolutionstringNoARK-native output tier: "720p" (default) or "1080p". Only sd2 supports 1080p natively — for sd2-fast use upscaleResolution instead.
videoInputModestringNo"keyframe" (default) or "reference"
upscaleResolutionstringNoWaveSpeed post-generation upscale: "1080p" / "2k" / "4k". Use "1080p" for sd2-fast to reach 1080P output.

Top-level request fields: model (required), inputs (required), callBackUrl (optional webhook URL).

Image Generation

Image generation models are independent from video — they take a prompt (and optionally reference images) and return a single image per task. Each request is billed per image based on resolution and quality, with credits refunded automatically on failure.

GPT Image 2

OpenAI's GPT Image 2 model for high-quality text-to-image and image-to-image editing. One workflow handles both modes — pass urls to switch into edit mode automatically. Output is delivered via R2 in the format you request (PNG / JPEG / WEBP). Model name: gpt-image-2.

Text-to-Image

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "inputs": {
      "prompt": "A neon-lit cyberpunk alley at midnight, photoreal",
      "quality": "medium",
      "resolution": "2k",
      "aspectRatio": "16:9"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask

Image-to-Image (Editing)

Pass 1–10 reference images via urls. The model will use them as visual context for the edit described in prompt.

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "inputs": {
      "urls": ["https://example.com/portrait.jpg"],
      "prompt": "Restyle as oil painting",
      "quality": "medium",
      "resolution": "1k",
      "aspectRatio": "1:1"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask
ParameterTypeRequiredDescription
promptstringYesText description of the image to generate, or the edit to apply when urls is provided.
urlsstring[]NoReference image URLs for image-to-image (edit) mode (1–10 images). Omit for text-to-image. Public HTTPS URLs accepted.
qualitystringNo"medium" / "high". Default: "medium". Credits scale by tier (see Pricing).
resolutionstringNo"1k" / "2k" / "4k". Default: "2k". Credits scale by tier (see Pricing).
aspectRatiostringNo"1:1" / "16:9" / "9:16" / "4:3" / "3:4". Default: "1:1".
outputFormatstringNo"png" / "jpeg" / "webp". Default: "png".

Input Image Requirements (image-to-image mode)

  • Up to 10 reference images per task
  • Max file size 50 MB per image
  • Shortest side ≥ 256px
  • Aspect ratio between 1:3 and 3:1
  • Formats: JPEG, JPG, PNG, WEBP

Credits per image scale by resolution and quality — see the Pricing section for the full table.

Assets

Assets are images, videos, and audio files that go through a review process before they can be used in video generation tasks. Upload an asset, wait for it to become ACTIVE, then use its asset:// URL in your tasks.

Upload Asset

Submit a publicly accessible URL for review. The asset will be processed and reviewed automatically.

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/photo.jpg",
    "type": "IMAGE",
    "name": "my-photo"
  }' \
  https://seegen.ai/api/v1/assets/upload
ParameterTypeRequiredDescription
urlstringYesPublicly accessible URL of the file to upload
typestringYes"IMAGE", "AUDIO", or "VIDEO"
namestringNoAsset name (max 64 characters)

Upload Response

{
  "assetId": 123,
  "volcAssetId": "asset-20260326-abc123",
  "type": "IMAGE",
  "status": "PROCESSING",
  "failReason": null,
  "url": "https://example.com/photo.jpg",
  "name": "my-photo",
  "createdAt": 1711234567890
}

Query Asset Status

Poll an asset's review status. When status is PROCESSING, the endpoint automatically checks for updates from the review system.

# Query by asset ID (numeric)
curl -H "Authorization: Bearer $API_KEY" \
  "https://seegen.ai/api/v1/assets/status?assetId=123"

# Query by volcAssetId (string)
curl -H "Authorization: Bearer $API_KEY" \
  "https://seegen.ai/api/v1/assets/status?assetId=asset-20260326-abc123"

Asset Status Values

  • PROCESSING — under review, not yet usable
  • ACTIVE — review passed, ready for use in tasks
  • FAILED — review failed, check failReason

List Assets

List your uploaded assets with optional filtering by type and status. Supports cursor-based pagination.

# List all assets
curl -H "Authorization: Bearer $API_KEY" \
  "https://seegen.ai/api/v1/assets/list"

# Filter by type and status
curl -H "Authorization: Bearer $API_KEY" \
  "https://seegen.ai/api/v1/assets/list?type=IMAGE&status=ACTIVE&limit=10"

# Paginate with cursor
curl -H "Authorization: Bearer $API_KEY" \
  "https://seegen.ai/api/v1/assets/list?cursor=100&limit=20"
ParameterTypeRequiredDescription
typestringNoFilter by type: "IMAGE", "AUDIO", or "VIDEO"
statusstringNoFilter by status: "NONE", "PROCESSING", "ACTIVE", or "FAILED"
cursornumberNoCursor for pagination (use nextCursor from previous response)
limitnumberNoItems per page, 1-50 (default: 20)

List Response

{
  "items": [
    {
      "assetId": 123,
      "volcAssetId": "asset-20260326-abc123",
      "type": "IMAGE",
      "status": "ACTIVE",
      "failReason": null,
      "url": "https://example.com/photo.jpg",
      "name": "my-photo",
      "width": 1920,
      "height": 1080,
      "size": 245000,
      "duration": null,
      "createdAt": 1711234567890
    }
  ],
  "nextCursor": 122
}

Using Assets in Tasks

Once an asset is ACTIVE, use its volcAssetId with the asset:// protocol in your task's URLs:

{
  "model": "sd2",
  "inputs": {
    "urls": ["asset://asset-20260326-abc123"],
    "prompt": "The person slowly looks up and smiles",
    "duration": "5s"
  }
}

Video Upscaler

Create Task

POST /api/v1/upscale/create

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source": { "type": "url", "url": "https://your-cdn.com/video.mp4" },
    "targetResolution": "2k",
    "callBackUrl": "https://your-server.com/webhook"
  }' \
  https://seegen.ai/api/v1/upscale/create
ParameterTypeRequiredDescription
source.typestringYes"url" (public https) or "uploadId" (R2-hosted asset)
source.urlstringNoRequired when type="url". Must be https. http and private/internal IPs are rejected.
source.r2UrlstringNoRequired when type="uploadId". The R2 URL returned by /api/v1/assets/upload.
targetResolutionstringYes"1080p", "2k", or "4k". Must be higher than the source resolution.
callBackUrlstringNoWebhook URL invoked once on terminal state (completed or failed).

Create Response

{
  "taskId": "n770mo4sh6rpi690ff3gwymx",
  "orderId": "ord_2026...",
  "status": "validating"
}

Query Status

GET /api/v1/upscale/query?taskId=...

Status progresses validating processing completed / failed.

curl -H "Authorization: Bearer $API_KEY" \
  "https://seegen.ai/api/v1/upscale/query?taskId=n770mo4sh6rpi690ff3gwymx"

Completed Response

{
  "taskId": "n770mo4sh6rpi690ff3gwymx",
  "status": "completed",
  "targetResolution": "2k",
  "creditsConsumed": 900,
  "result": {
    "url": "https://static.seedance2-pro.com/standalone-upscale/results/...mp4",
    "probedDurationSeconds": 30,
    "probedSourceResolution": "1280x720"
  },
  "error": null,
  "createdAt": "2026-04-29T01:23:45.000Z",
  "finishedAt": "2026-04-29T01:35:01.000Z"
}

Failed Response

{
  "taskId": "n770mo4sh6rpi690ff3gwymx",
  "status": "failed",
  "creditsConsumed": null,
  "result": null,
  "error": {
    "code": "SOURCE_RESOLUTION_TOO_HIGH",
    "message": "Source 3840x2160 is not below target 4k"
  }
}

Limits

  • Source: https URL or your previously uploaded R2 URL
  • Duration up to 600 s (clips under 5 s are billed as 5 s)
  • File size ≤ 200 MB
  • Format: MP4 / MOV / WebM
  • Source resolution must be lower than target

Pricing

  • 1080P: 25 credits/sec (5s = 125, 30s = 750)
  • 2K: 38 credits/sec (5s = 190, 30s = 1140)
  • 4K: 50 credits/sec (5s = 250, 30s = 1500)
  • 5-second minimum; failures refund credits automatically

Error Codes

Common errors you can act on. Other failures return a self-explanatory message field — read that before assuming the code is one of these.

CodeMeaning
INVALID_URLURL is malformed or not https
URL_NOT_REACHABLECouldn't fetch the URL — check it's public and reachable
UNSUPPORTED_MEDIA_TYPEFile is not a video, or not in MP4 / MOV / WebM
FILE_TOO_LARGESource exceeds 200 MB
DURATION_EXCEEDS_LIMITSource longer than 600 s
SOURCE_RESOLUTION_TOO_HIGHSource already at or above target — pick a higher target
INSUFFICIENT_CREDITSNot enough credits — top up and retry

Webhook Callback

Instead of polling, you can provide a callBackUrl to receive results automatically when a task completes or fails.

curl -X POST \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sd2",
    "callBackUrl": "https://your-server.com/webhook/callback",
    "inputs": {
      "prompt": "A cat playing piano",
      "duration": "5s"
    }
  }' \
  https://seegen.ai/api/v1/jobs/createTask

Callback Payload

When the task finishes, we send a POST request to your URL with the same format as the queryTask response:

// POST to your callBackUrl
{
  "taskId": "task_abc123",
  "model": "sd2",
  "status": "COMPLETED",
  "creditsUsed": 200,
  "output": [
    {
      "url": "https://static.seegen.ai/videos/result.mp4",
      "width": 1280,
      "height": 720
    }
  ],
  "error": null,
  "createTime": 1711234567890,
  "completeTime": 1711234612345
}

Retry Policy: If your endpoint returns a non-2xx status, we retry up to 3 times with increasing delays (1s, 5s, 30s).

Response Format

createTask Response

// 200 OK
{ "taskId": "task_abc123" }

queryTask Response

{
  "taskId": "task_abc123",
  "model": "sd2",
  "status": "COMPLETED",     // "PENDING" | "PROCESSING" | "COMPLETED" | "FAILED"
  "creditsUsed": 200,
  "output": [                // null when status is not "COMPLETED"
    {
      "url": "https://static.seegen.ai/videos/result.mp4",
      "width": 1280,
      "height": 720
    }
  ],
  "error": null,             // error message when status is "FAILED"
  "createTime": 1711234567890,
  "completeTime": 1711234612345
}

credits Response

{
  "credits": 5000,
  "availableCredits": 4800
}

Error Handling

Status CodeMeaningAction
400Invalid parametersCheck the error message and fix your request
401Invalid or missing API keyCheck your Authorization header format
402Insufficient creditsPurchase more credits at seegen.ai
403Access deniedYou can only query your own tasks
404Task not foundVerify the taskId is correct
429Concurrency limit (3 tasks)Wait for existing tasks to complete
500Internal server errorRetry after a few seconds

Full Examples

Complete workflow: upload an asset, wait for review, create a task with the approved asset, and poll for the result.

const API_KEY = process.env.API_KEY;
const BASE = "https://seegen.ai/api/v1";
const headers = {
  "Authorization": `Bearer ${API_KEY}`,
  "Content-Type": "application/json",
};

// 1. Upload asset and wait for review
async function uploadAndWaitForAsset(url, type = "IMAGE") {
  const res = await fetch(`${BASE}/assets/upload`, {
    method: "POST",
    headers,
    body: JSON.stringify({ url, type }),
  });
  if (!res.ok) throw new Error(`Upload failed: ${(await res.json()).message}`);
  const asset = await res.json();
  console.log(`Asset uploaded: ${asset.assetId}, status: ${asset.status}`);

  // Poll until review completes
  while (true) {
    const statusRes = await fetch(
      `${BASE}/assets/status?assetId=${asset.assetId}`,
      { headers }
    );
    const status = await statusRes.json();
    if (status.status === "ACTIVE") {
      console.log(`Asset approved: asset://${status.volcAssetId}`);
      return status.volcAssetId;
    }
    if (status.status === "FAILED") {
      throw new Error(`Asset review failed: ${status.failReason}`);
    }
    await new Promise((r) => setTimeout(r, 3000));
  }
}

// 2. Create a task
async function createTask(inputs, callBackUrl) {
  const res = await fetch(`${BASE}/jobs/createTask`, {
    method: "POST",
    headers,
    body: JSON.stringify({
      model: "sd2",
      inputs,
      ...(callBackUrl && { callBackUrl }),
    }),
  });
  if (!res.ok) throw new Error(`[${res.status}] ${(await res.json()).message}`);
  return res.json();
}

// 3. Poll until done
async function waitForResult(taskId, timeoutMs = 300000) {
  const start = Date.now();
  while (Date.now() - start < timeoutMs) {
    const res = await fetch(
      `${BASE}/jobs/queryTask?taskId=${taskId}`,
      { headers }
    );
    const result = await res.json();
    if (result.status === "COMPLETED") return result;
    if (result.status === "FAILED") throw new Error(result.error);
    await new Promise((r) => setTimeout(r, 5000));
  }
  throw new Error("Timeout waiting for task");
}

// Full workflow: upload → review → generate → result
async function main() {
  // Upload image and wait for review
  const volcAssetId = await uploadAndWaitForAsset(
    "https://example.com/photo.jpg", "IMAGE"
  );

  // Create task with approved asset
  const { taskId } = await createTask({
    urls: [`asset://${volcAssetId}`],
    prompt: "The person slowly looks up and smiles",
    duration: "5s",
  });
  console.log(`Task: ${taskId}`);

  // Wait for video
  const result = await waitForResult(taskId);
  console.log(`Video: ${result.output[0].url}`);
}

main().catch(console.error);

Need help? Join our Discord or contact us