seedance-2.0-api README

The project's README from github.com/apiframe-ai/seedance-2.0-api. As one markdown file: README.md.

Seedance 2.0 API

Examples for calling the Seedance 2.0 API (ByteDance text-to-video and image-to-video) through Apiframe.

Model page: Seedance 2.0 API

This repo does not host model weights. Seedance is a closed model. Inference runs on POST /v2/videos/generate with model: "seedance-2".

Related model ids on the same endpoint: seedance-2.5, seedance-2-fast, seedance-2-mini.

What is Seedance 2.0?

Seedance 2.0 is ByteDance's video generation model. It supports text-to-video, image-to-video, and multimodal reference-to-video (images, video, audio), with native synchronized audio. Clips are 4–15 seconds at 480p, 720p, 1080p, or 4K.

Quick start

export APIFRAME_API_KEY=afk_your_api_key_here

Python

pip install requests
import os
import time
import requests

API = "https://api.apiframe.ai/v2"
headers = {
    "X-API-Key": os.environ["APIFRAME_API_KEY"],
    "Content-Type": "application/json",
}

job = requests.post(
    f"{API}/videos/generate",
    headers=headers,
    json={
        "model": "seedance-2",
        "prompt": "A cinematic slow-motion shot of a golden eagle soaring through a mountain valley at sunrise.",
        "seedanceParams": {
            "duration": 8,
            "resolution": "720p",
            "aspect_ratio": "16:9",
            "generate_audio": True,
        },
    },
).json()

while True:
    result = requests.get(f"{API}/jobs/{job['jobId']}", headers=headers).json()
    if result["status"] in ("COMPLETED", "FAILED"):
        break
    time.sleep(2)

print(result.get("result"))

JavaScript

npm i @apiframe-ai/sdk@next
import { Apiframe } from "@apiframe-ai/sdk";

const client = new Apiframe({ apiKey: process.env.APIFRAME_API_KEY });

const { jobId } = await client.videos.generate({
  model: "seedance-2",
  prompt:
    "A cinematic slow-motion shot of a golden eagle soaring through a mountain valley at sunrise.",
  seedanceParams: {
    duration: 8,
    resolution: "720p",
    aspect_ratio: "16:9",
    generate_audio: true,
  },
});

const job = await client.jobs.waitFor(jobId);
console.log(job.result);

Pass webhookUrl on the generate call if you do not want to poll.

Parameters

Parameter Type Default Description
prompt string required Text description of the video
seedanceParams.duration integer 8 Seconds, 4–15
seedanceParams.resolution string "720p" 480p, 720p, 1080p, 4k
seedanceParams.aspect_ratio string "16:9" 21:9, 16:9, 4:3, 1:1, 3:4, 9:16, adaptive
seedanceParams.start_image string — First-frame URL (image-to-video)
seedanceParams.end_image string — Last-frame URL
seedanceParams.reference_image_urls string[] — Up to 9 reference images
seedanceParams.reference_video_urls string[] — Up to 3 reference videos
seedanceParams.reference_audio_urls string[] — Up to 3 reference audio files
seedanceParams.generate_audio boolean true Native synchronized audio
seedanceParams.seed integer — Reproducible generations
seedanceParams.camera_fixed boolean false Lock the camera
seedanceParams.web_search boolean false Ground the prompt with web search

Image to video

requests.post(
    "https://api.apiframe.ai/v2/videos/generate",
    headers=headers,
    json={
        "model": "seedance-2",
        "prompt": "She slowly turns to face the camera, wind catching her hair.",
        "seedanceParams": {
            "start_image": "https://example.com/portrait.jpg",
            "duration": 8,
            "resolution": "720p",
        },
    },
)

Reference to video

requests.post(
    "https://api.apiframe.ai/v2/videos/generate",
    headers=headers,
    json={
        "model": "seedance-2",
        "prompt": "The person from the reference image walks down a neon-lit street at night.",
        "seedanceParams": {
            "reference_image_urls": ["https://example.com/character.jpg"],
            "duration": 10,
            "resolution": "720p",
        },
    },
)

Start/end frames and reference media are mutually exclusive on Seedance 2.5. On Seedance 2.0 they can be combined; keep inputs consistent.

Output

{
  "videoUrl": "https://cdn2.apiframe.ai/videos/….mp4"
}

Examples

Example Python JavaScript
Text to video text_to_video.py text_to_video.js
Image to video image_to_video.py image_to_video.js
Reference to video reference_to_video.py reference_to_video.js
cp .env.example .env
# set APIFRAME_API_KEY
python examples/text_to_video.py

License

Example code in this repository is provided as-is. Seedance outputs are subject to ByteDance's terms. Seedance is a trademark of ByteDance Ltd.

seedance-2.0-api (apiframe-ai/seedance-2.0-api)

Searching Database…

这是什么?这个仓库包含通过 Apiframe API 调用字节跳动 Seedance 2.0 视频生成模型的示例脚本,涵盖文生视频、图生视频和参考生视频。
这是可安装的库,还是只是示例代码?它只是示例脚本,不是打包好的 SDK——除了复制 Python 或 JavaScript 示例并把它们指向 API 端点之外,没有任何安装步骤。
怎么用它生成视频?向 /v2/videos/generate 发送 POST 请求,把 model 设为 'seedance-2',附上提示词和可选的 seedanceParams;仓库里包含与文生视频、图生视频、参考生视频对应的 Python 和 JavaScript 示例。
我必须轮询结果,还是可以改成通知?你可以在生成调用中传入 webhookUrl 来避免轮询,视频就绪时它会通知你。
我能在本地运行这个模型或拿到权重吗?不能——Seedance 是闭源模型,这个仓库既不包含也不托管任何模型权重;只能通过托管的 API 访问。
这里的 Apiframe 是什么?Apiframe 是这个仓库对接的 API 提供商;它通过单一的 /v2/videos/generate 端点把请求代理给字节跳动闭源的 Seedance 2.0 模型。
能生成多长的视频、什么分辨率?片段时长可为 4–15 秒,以 480p、720p、1080p 或 4K 渲染,宽高比范围从 21:9 到 9:16。
能在同一个请求里混用参考图像、视频和音频吗?可以——你最多可以提供 9 张参考图像、3 个参考视频和 3 段参考音频,而且在 Seedance 2.0 上这些可以与起始/结束帧组合使用(不像 Seedance 2.5 那样互斥)。
生成的视频带声音吗?带,generateaudio 默认为 true,因此 Seedance 2.0 默认会在生成视频的同时原生生成同步音频。
Size
<0.1 MB
Stars
329
Updated
CommitAug 14
Age
2mo
Commits · 90 Days