seedance_api_test_examples.md 4.0 KB

Seedance 1.5 Pro API 测试示例

1. 文生视频 (Text-to-Video)

POST /api/AIGeneration/video/seedance/createTask
Content-Type: application/json

{
    "model": "doubao-seedance-1-5-pro-251215",
    "content": [
        {
            "type": "text",
            "text": "一只可爱的小猫在阳光下打哈欠,画面温馨自然"
        }
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 5,
    "seed": 12345,
    "generate_audio": true,
    "watermark": false
}

2. 图生视频 - 首帧 (Image-to-Video - First Frame)

POST /api/AIGeneration/video/seedance/createTask
Content-Type: application/json

{
    "model": "doubao-seedance-1-5-pro-251215",
    "content": [
        {
            "type": "text",
            "text": "小猫慢慢睁开眼睛,伸了个懒腰"
        },
        {
            "type": "image_url",
            "image_url": {
                "url": "https://example.com/cat_sleeping.jpg"
            },
            "role": "first_frame"
        }
    ],
    "resolution": "1080p",
    "ratio": "adaptive",
    "duration": 8,
    "generate_audio": true,
    "return_last_frame": true
}

3. 图生视频 - 首尾帧 (Image-to-Video - First & Last Frame)

POST /api/AIGeneration/video/seedance/createTask
Content-Type: application/json

{
    "model": "doubao-seedance-1-5-pro-251215",
    "content": [
        {
            "type": "text",
            "text": "小猫从睡觉状态慢慢醒来并站起身"
        },
        {
            "type": "image_url",
            "image_url": {
                "url": "https://example.com/cat_sleeping.jpg"
            },
            "role": "first_frame"
        },
        {
            "type": "image_url",
            "image_url": {
                "url": "https://example.com/cat_standing.jpg"
            },
            "role": "last_frame"
        }
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 6,
    "camera_fixed": false,
    "watermark": false
}

4. 样片模式 (Draft Mode)

POST /api/AIGeneration/video/seedance/createTask
Content-Type: application/json

{
    "model": "doubao-seedance-1-5-pro-251215",
    "content": [
        {
            "type": "text",
            "text": "一个人在海边看日落,画面唯美浪漫"
        }
    ],
    "resolution": "480p",
    "draft": true,
    "duration": 4,
    "service_tier": "flex"
}

5. 基于样片生成正式视频

POST /api/AIGeneration/video/seedance/createTask
Content-Type: application/json

{
    "model": "doubao-seedance-1-5-pro-251215",
    "content": [
        {
            "type": "draft_task",
            "draft_task": {
                "id": "draft_task_id_from_step_4"
            }
        }
    ],
    "resolution": "1080p",
    "watermark": false
}

6. 查询任务状态

GET /api/AIGeneration/video/seedance/taskStatus/{task_id}

响应示例:

{
    "success": true,
    "data": {
        "id": "seedance_1710071234_abc123",
        "status": "succeeded",
        "result_url": "https://tos.example.com/videos/seedance_video.mp4",
        "last_frame_url": "https://tos.example.com/images/last_frame.png",
        "error_message": null,
        "created_at": "2026-03-10T13:41:23.000000Z",
        "started_at": "2026-03-10T13:41:25.000000Z",
        "completed_at": "2026-03-10T13:43:15.000000Z"
    }
}

状态说明

  • queued: 排队中
  • running: 任务运行中
  • succeeded: 任务成功
  • failed: 任务失败
  • expired: 任务超时

注意事项

  1. 图片要求:

    • 格式:jpeg、png、webp、bmp、tiff、gif、heic、heif
    • 宽高比:0.4 ~ 2.5
    • 尺寸:300px ~ 6000px
    • 大小:< 30MB
  2. 文本提示词:

    • 中文不超过500字
    • 英文不超过1000词
    • 建议对话部分用双引号包围
  3. 视频参数:

    • 时长:2-12秒
    • 分辨率:480p、720p、1080p
    • 宽高比:16:9、4:3、1:1、3:4、9:16、21:9、adaptive
  4. 样片模式限制:

    • 只能使用480p分辨率
    • 不支持return_last_frame
    • 不支持离线推理(flex)