seedance-2.0-api

apiframe-ai活跃维护

字节 Seedance 2.0 视频生成 API 的调用示例,覆盖文生视频和图生视频两种模式,方便开发者快速接入。

Seedance 2.0 API — text-to-video and image-to-video examples

暂无版本259star1fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
export APIFRAME_API_KEY=afk_your_api_key_here
pip install requests
硬件要求按 README 说明

README 未说明;模型为闭源,推理在 Apiframe 云端完成,本地只需能发 HTTP 请求的环境

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

通过 Apiframe 调用字节 Seedance 2.0 的文生视频与图生视频示例仓库

字节 Seedance 2.0 视频生成 API 的调用示例,覆盖文生视频和图生视频两种模式,方便开发者快速接入。

核心能力

  • 用 POST /v2/videos/generate 提交生成任务
  • 轮询 /jobs/{jobId} 或传 webhookUrl 获取结果
  • 支持首尾帧图片、参考图/视频/音频多模态输入
  • 可调时长 4–15 秒、480p 至 4K 分辨率与画幅
  • 原生同步音频生成,支持固定镜头与种子复现

容易踩的坑

需先到 Apiframe 申请 API Key,仓库不含模型权重;JavaScript 示例依赖 @apiframe-ai/sdk@next 预发布版本;Seedance 2.5 上首尾帧与参考媒体互斥,2.0 才可组合

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    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

    ParameterTypeDefaultDescription
    promptstringrequiredText description of the video
    seedanceParams.durationinteger8Seconds, 4–15
    seedanceParams.resolutionstring"720p"480p, 720p, 1080p, 4k
    seedanceParams.aspect_ratiostring"16:9"21:9, 16:9, 4:3, 1:1, 3:4, 9:16, adaptive
    seedanceParams.start_imagestring—First-frame URL (image-to-video)
    seedanceParams.end_imagestring—Last-frame URL
    seedanceParams.reference_image_urlsstring[]—Up to 9 reference images
    seedanceParams.reference_video_urlsstring[]—Up to 3 reference videos
    seedanceParams.reference_audio_urlsstring[]—Up to 3 reference audio files
    seedanceParams.generate_audiobooleantrueNative synchronized audio
    seedanceParams.seedinteger—Reproducible generations
    seedanceParams.camera_fixedbooleanfalseLock the camera
    seedanceParams.web_searchbooleanfalseGround 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

    ExamplePythonJavaScript
    Text to videotext_to_video.pytext_to_video.js
    Image to videoimage_to_video.pyimage_to_video.js
    Reference to videoreference_to_video.pyreference_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.