Video API
Text into footage,
get clips viacallback
Submit and get a task id back; poll the status, or configure a webhook to receive signed results. Supports text-to-video, first/last frame, reference image and reference video. Authenticate with the same sk-lumen- key, billed in credits at the model and group unit price.
Quick start
Submit and fetch the result
First submit to get an id; then poll that id until status is succeeded or failed. Video is billed per second and takes a while to generate, so a webhook is recommended.
1 · Submit · POST /v1/videos/generations
curl https://lumen.mengfanlab.top/v1/videos/generations \
-H "Authorization: Bearer sk-lumen-•••" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2",
"prompt": "a cat running on the grass, cinematic",
"resolution": "720p",
"aspect_ratio": "16:9",
"duration": 5
}'
# 返回任务 id:
# { "id": "v1a2b3...", "status": "processing", "created": 1700000000 }2 · Query status · GET /v1/videos/generations/{id}
curl https://lumen.mengfanlab.top/v1/videos/generations/v1a2b3... \
-H "Authorization: Bearer sk-lumen-•••"
# 处理中: { "id": "...", "status": "processing" }
# 成功: { "id": "...", "status": "succeeded", "data": [ { "url": "https://video..." } ] }
# 失败: { "id": "...", "status": "failed", "error": { "message": "..." } }First/last frame / reference image / reference video
Image-to-video and video-to-video
All passed as URLs, with the mode auto-detected: passing reference_video_url is video-to-video; passing any image (first frame / last frame / reference image) is image-to-video; passing none is text-to-video.
# 首尾帧 / 参考图 / 参考视频:都传 URL,生成模式自动判定
curl https://lumen.mengfanlab.top/v1/videos/generations \
-H "Authorization: Bearer sk-lumen-•••" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2",
"prompt": "让画面中的角色挥手",
"image_url": "https://your.img/first.png",
"last_image_url": "https://your.img/last.png",
"reference_image_urls": ["https://your.img/ref1.png"],
"reference_video_url": "https://your.vid/ref.mp4"
}'- · image_url is the first frame (or first_frame_url), last_image_url is the last frame (or last_frame_url).
- · reference_image_urls is the reference image array (or reference_images); reference_video_url is the reference video (or video_url).
- · Models differ in support for first/last frame / reference image / reference video; unsupported inputs are ignored by the respective upstream. See the console model notes.
Request parameters
POST /v1/videos/generations fields
Pass URLs as image / video inputs (this endpoint does not accept file uploads).
Video model code, e.g. seedance-2 / seedance-2-fast / veo-3-1; the full list and unit prices are in the console.
Video scene description.
Resolution, e.g. 480p / 720p / 1080p, default 720p (per model support).
Aspect ratio, e.g. 16:9 / 9:16, default 16:9.
Duration in seconds, minimum 4, default 5. Per-second models are settled by actual duration.
Whether to generate audio, default true (per model support).
First frame image URL (image-to-video); or first_frame_url.
Last frame image URL (first/last frame); or last_frame_url.
Array of reference image URLs; or reference_images.
Reference video URL (video-to-video); or video_url.
Completion callback URL (http/https). Falls back to polling if omitted.
Callback signing secret. Required once webhook_url is set (used for signature verification).
Status values: queued / processing / succeeded / failed / cancelled. On succeeded it returns data:[{url}], on failed it returns error.
Webhook
Signed callback on completion
With webhook_url set (must also include webhook_secret), when the task reaches a terminal state the server POSTs the result to your URL with an HMAC-SHA256 signature header for verification. Both success and failure are called back.
Submit with a webhook
curl https://lumen.mengfanlab.top/v1/videos/generations \
-H "Authorization: Bearer sk-lumen-•••" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2",
"prompt": "a cat running",
"duration": 5,
"webhook_url": "https://your.app/callback",
"webhook_secret": "your-secret"
}'What you will receive
POST https://your.app/callback
Content-Type: application/json
X-Lumen-Signature: sha256=<hmac_hex>
X-Lumen-Timestamp: 1700000000
{ "id": "v1a2b3...", "status": "succeeded", "data": [ { "url": "https://video..." } ] }Verify (use the same secret on the raw body)
# Python: 对收到的原始 body 用同一 secret 验签
import hmac, hashlib
def verify(raw_body: bytes, signature_header: str, secret: str) -> bool:
expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature_header)- · Signature = HMAC-SHA256(webhook_secret, raw response body), as hex, placed in X-Lumen-Signature: sha256=<hex>.
- · Always verify against the raw bytes received; do not deserialize and re-serialize first.
- · Video generation takes a while, so a webhook is easier than polling; without it, use GET polling to fetch the result.
Error codes
Invalid request body, duration under 4, webhook_url passed without webhook_secret, or content blocked by the safety policy.
Key missing, invalid, or revoked.
Insufficient account credits.
Task not found, or no such video model / duration in this group.
Upstream rate limit or error. Failed tasks refund the deducted credits.
Questions or partnerships, email [email protected].