Skip to content

Kling 图生视频

POST /kling/v1/videos/image2video

使用 Kling 模型从图片生成视频。

支持通过 image 参数传入图片 URL 或 Base64 编码的图片数据。

基本信息

项目内容
Base URLhttps://www.yunzhuhub.cn
标签视频生成/Kling格式
Operation IDcreateKlingImage2Video

认证

  • BearerAuth:使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx

密钥安全

请只使用你自己的 API Key。示例中的 <YOUR_API_KEY> 必须在本地替换,不要把真实密钥提交到代码仓库或发送给他人。

参数

无额外路径或查询参数。

请求体

Content-Type: application/json

json
{
  "title": "VideoRequest",
  "type": "object",
  "description": "视频生成请求",
  "properties": {
    "model": {
      "type": "string",
      "description": "模型/风格 ID",
      "example": "<MODEL_ID>"
    },
    "prompt": {
      "type": "string",
      "description": "文本描述提示词",
      "example": "宇航员站起身走了"
    },
    "image": {
      "type": "string",
      "description": "图片输入 (URL 或 Base64)",
      "example": "https://example.com/image.jpg"
    },
    "duration": {
      "type": "number",
      "description": "视频时长(秒)",
      "example": 5
    },
    "width": {
      "type": "integer",
      "description": "视频宽度",
      "example": 1280
    },
    "height": {
      "type": "integer",
      "description": "视频高度",
      "example": 720
    },
    "fps": {
      "type": "integer",
      "description": "视频帧率",
      "example": 30
    },
    "seed": {
      "type": "integer",
      "description": "随机种子",
      "example": 20231234
    },
    "n": {
      "type": "integer",
      "description": "生成视频数量",
      "example": 1
    },
    "response_format": {
      "type": "string",
      "description": "响应格式",
      "example": "url"
    },
    "user": {
      "type": "string",
      "description": "用户标识",
      "example": "user-1234"
    },
    "metadata": {
      "type": "object",
      "description": "扩展参数 (如 negative_prompt, style, quality_level 等)",
      "additionalProperties": true,
      "properties": {}
    }
  }
}

请求示例

以下示例只用于复制到本地终端,不会从文档站发送请求。

bash
curl --request POST 'https://www.yunzhuhub.cn/kling/v1/videos/image2video' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '<REQUEST_JSON>'

响应

200 成功创建视频生成任务

json
{
  "title": "VideoResponse",
  "type": "object",
  "description": "视频生成任务提交响应",
  "properties": {
    "task_id": {
      "type": "string",
      "description": "任务 ID",
      "example": "abcd1234efgh"
    },
    "status": {
      "type": "string",
      "description": "任务状态",
      "example": "queued"
    }
  }
}

400 请求参数错误

json
{
  "title": "ErrorResponse",
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string",
          "description": "错误信息"
        },
        "type": {
          "type": "string",
          "description": "错误类型"
        },
        "param": {
          "type": "string",
          "description": "相关参数",
          "nullable": true
        },
        "code": {
          "type": "string",
          "description": "错误代码",
          "nullable": true
        }
      }
    }
  }
}

云筑Hub 文档。底层项目基于 New API