1. 可灵 Kling
梧柏API使用文档
WHBAI · Kling
  • WHBAI · Google Gemini 原生 (v1alpha)
  • WHBAI · Google Gemini 原生
  • WHBAI · Ideogram
  • WHBAI · Ideogram V3
  • WHBAI · Midjourney
  • WHBAI · Jimeng
  • WHBAI · Kling
  • WHBAI · Luma
  • WHBAI · Luma V1
  • WHBAI · Omni 视频
  • WHBAI · Pixverse
  • WHBAI · Runway
  • WHBAI · Sora2
  • WHBAI · 统一视频 VEO
  • WHBAI · Vidu
  • WHBAI · 豆包 Volc
  • WHBAI · Suno
  • WHBAI · Playground
  • WHBAI · 账号与令牌
  • WHBAI · 阿里 Pix
  • WHBAI · 阿里百炼
  • WHBAI · 私域人像
  • WHBAI · Fal.ai
  • WHBAI · Replicate
  • WHBAI · 腾讯云 VOD
  • WHBAI · MiniMax
  • WHBAI · 支持模型列表
  • WHBAI · Grok Imagine
  • WHBAI · Seedance 2.0
  • WHBAI · TypeSafe
  • WHBAI · OpenAI 兼容
  • 可灵 Kling
    • 文生音效
      POST
    • 文生视频
      POST
    • 图生视频
      POST
    • 文生图
      POST
    • 查询文生视频任务
      GET
    • Omni-Video
      POST
  • kling
    • 对口型
      POST
    • 虚拟试穿
      POST
    • 视频延长
      POST
    • 视频特效
      POST
    • 多图参考生视频
      POST
    • 查询任务(免费)
      GET
    • 查询任务(单个)
      GET
    • Omni-Image
      POST
    • 查询任务(单个)
      GET
    • 查询任务(单个)
      GET
    • 初始化待编辑视频
      POST
    • 增加视频选区
      POST
    • 删减视频选区
      POST
    • 预览已选区视频
      POST
    • 多模态视频
      POST
    • 查询任务(单个)
      GET
    • 查询任务(单个)
      GET
    • 查询任务(单个)
      GET
    • 查询任务(单个)
      GET
    • 多图参考生图
      POST
    • 查询任务(单个)
      GET
    • 文生视频
      POST
    • 图生视频
      POST
    • 查询视频
      GET
    • 查询任务(单个)
      GET
    • 扩图
      POST
    • 查询任务(单个)
      GET
    • 图像识别
      POST
    • 数字人
      POST
    • 查询任务(单个)
      GET
    • 查询任务(单个)
      GET
    • 视频生音效
      POST
    • 查询任务(单个)
      GET
    • 语音合成
      POST
    • 查询任务(单个)
      GET
    • 人脸识别
      POST
    • 对口型
      POST
    • 查询任务(单个)
      GET
    • 自定义音色
      POST
    • 查询自定义音色(单个)
      GET
    • 查询官方音色
      GET
    • 删除自定义音色
      POST
    • 动作控制
      POST
    • 查询任务(单个)
      GET
    • 主体(旧)
      POST
    • 主体(新版本)
      POST
    • 查询自定义主体(单个新版本)
      GET
    • 查询官方主体(列表新版本)
      GET
    • 删除自定义主体(新版本)
      POST
  • 数据模型
    • KlingTaskSubmitResponse
    • KlingTaskQueryResponse
    • KlingText2VideoRequest
    • KlingImage2VideoRequest
    • PostKlingV1ImagesGenerationsRequest
    • KlingOmniVideoRequest
    • NewApiError
  1. 可灵 Kling

文生视频

POST
/kling/v1/videos/text2video
根据文本提示词生成视频。可灵原生 camelCase 请求体;提交后返回 task_id,需轮询查询任务状态。

网站中的模型与调用示例#

文生视频#

其他参数 请看 官方文档 https://app.klingai.com/cn/dev/document-api/apiReference/updateNotice
参数是一致的,对接时,仅需将请求域名、API key 改成我们

请求参数#

{
  "contentType": "application/json",
  "properties": {
    "aspect_ratio": {
      "description": "生成视频的画面纵横比,可选值:16:9, 9:16, 1:1",
      "type": "string"
    },
    "callback_url": {
      "description": "回调通知地址,可选,用于接收任务状态更新",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Optional callback URL for task status updates."
        }
      }
    },
    "camera_control": {
      "description": "控制摄像机运动的协议,可选,未指定则智能匹配",
      "properties": {
        "config": {
          "description": "摄像机运动配置,包含六个控制参数",
          "properties": {
            "horizontal": {
              "description": "水平移动",
              "type": "integer"
            },
            "pan": {
              "description": "平移",
              "type": "integer"
            },
            "roll": {
              "description": "旋转",
              "type": "integer",
              "x-i18n": {
                "en-US": {
                  "description": "rotate"
                }
              }
            },
            "tilt": {
              "description": "倾斜",
              "type": "integer"
            },
            "vertical": {
              "description": "垂直移动",
              "type": "integer"
            },
            "zoom": {
              "description": "缩放",
              "type": "integer"
            }
          },
          "required": [
            "horizontal",
            "vertical",
            "pan",
            "tilt",
            "roll",
            "zoom"
          ],
          "type": "object"
        },
        "type": {
          "description": "摄像机控制类型",
          "type": "string"
        }
      },
      "required": [
        "type",
        "config"
      ],
      "type": "object"
    },
    "cfg_scale": {
      "description": "生成视频的自由度,可选,取值范围0-1,值越大相关性越强",
      "type": "number",
      "x-i18n": {
        "en-US": {
          "description": "Creativity/guidance for video generation (optional), range 0-1; higher values follow the prompt more closely."
        }
      }
    },
    "duration": {
      "description": "生成视频时长,单位秒,可选值:5或10",
      "type": "number"
    },
    "mode": {
      "description": "生成视频的模式,可选,std(高性能)或 pro(高表现)",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Video generation mode (optional): std (high performance) or pro (high quality)."
        }
      }
    },
    "model_name": {
      "description": "kling-v1、kling-v1-5、kling-v1-6、kling-v2-5-turbo\n",
      "type": "string"
    },
    "negative_prompt": {
      "description": "负向文本提示,可选,描述不想在视频中出现的元素,不超过200字符",
      "type": "string"
    },
    "prompt": {
      "description": "正向文本提示,必需,描述想要生成的视频内容,不超过500字符",
      "type": "string"
    }
  },
  "required": [
    "model_name",
    "prompt",
    "negative_prompt",
    "cfg_scale",
    "mode",
    "camera_control",
    "aspect_ratio",
    "duration",
    "callback_url"
  ]
}

请求示例 · 示例 1#

"{\n  \"model_name\":\"kling-v2-5-turbo\",\n  \"prompt\": \"在海滩上度假的快乐场景。\",\n  \"duration\":5,\n  //\"mode\":\"pro\"\n}"

响应示例 · 成功示例#

{
  "code": 0,
  "data": {
    "created_at": 1762157958060,
    "task_id": "814237883686625347",
    "task_info": {},
    "task_status": "submitted",
    "updated_at": 1762157958060
  },
  "message": "SUCCEED",
  "request_id": "795f5ea4-7746-4e3a-a184-75d44240f87f"
}

文生视频#

请求参数#

{
  "contentType": "application/json",
  "properties": {
    "aspect_ratio": {
      "description": "画幅比例(宽:高)。上游约束:常用 16:9 / 9:16 / 1:1,网关不预检枚举。",
      "enum": [
        "16:9",
        "9:16",
        "1:1"
      ],
      "type": "string",
      "x-apifox-enum": [
        {
          "description": "宽屏横构图",
          "name": "横屏",
          "value": "16:9"
        },
        {
          "description": "短视频竖构图",
          "name": "竖屏",
          "value": "9:16"
        },
        {
          "description": "正方形构图",
          "name": "方屏",
          "value": "1:1"
        }
      ],
      "x-i18n": {
        "en-US": {
          "description": "Aspect ratio (width:height). Upstream constraints: commonly used 16:9 / 9:16 / 1:1, the gateway does not preflight enumeration."
        }
      }
    },
    "callback_url": {
      "description": "任务完成回调地址。上游任务结束后 POST 通知,须公网可达,网关原样透传。",
      "format": "uri",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Task completion callback address. POST notification after the upstream task is completed, the public network must be reachable, and the gateway transparently transmits the information as it is."
        }
      }
    },
    "camera_control": {
      "additionalProperties": false,
      "description": "镜头运动控制。不传则由模型智能匹配;网关透传,不预检具体数值范围。",
      "properties": {
        "config": {
          "additionalProperties": false,
          "description": "镜头运动参数配置",
          "properties": {
            "horizontal": {
              "description": "水平位移量",
              "type": "number",
              "x-i18n": {
                "en-US": {
                  "description": "Horizontal displacement"
                }
              }
            },
            "pan": {
              "description": "水平摇镜(左右)",
              "type": "number",
              "x-i18n": {
                "en-US": {
                  "description": "Horizontal panning (left and right)"
                }
              }
            },
            "roll": {
              "description": "旋转",
              "type": "number",
              "x-i18n": {
                "en-US": {
                  "description": "rotate"
                }
              }
            },
            "tilt": {
              "description": "垂直摇镜(上下)",
              "type": "number",
              "x-i18n": {
                "en-US": {
                  "description": "Vertical panning (up and down)"
                }
              }
            },
            "vertical": {
              "description": "垂直位移量",
              "type": "number",
              "x-i18n": {
                "en-US": {
                  "description": "vertical displacement"
                }
              }
            },
            "zoom": {
              "description": "变焦",
              "type": "number",
              "x-i18n": {
                "en-US": {
                  "description": "zoom"
                }
              }
            }
          },
          "type": "object",
          "x-i18n": {
            "en-US": {
              "description": "Lens motion parameter configuration"
            }
          }
        },
        "type": {
          "description": "控制类型,如 simple",
          "type": "string",
          "x-i18n": {
            "en-US": {
              "description": "Control type, such as simple"
            }
          }
        }
      },
      "type": "object",
      "x-i18n": {
        "en-US": {
          "description": "Lens motion control. If it is not transmitted, the model will intelligently match it; the gateway transparently transmits it and does not pre-check the specific value range."
        }
      }
    },
    "cfg_scale": {
      "description": "生成自由度(CFG)。值越大,生成结果与 prompt 相关性越强;网关不预检范围,上游约束通常 0~1。",
      "maximum": 1,
      "minimum": 0,
      "type": "number",
      "x-i18n": {
        "en-US": {
          "description": "Generate degrees of freedom (CFG). The larger the value, the stronger the correlation between the generated results and prompt; the gateway does not pre-check the range, and the upstream constraints are usually 0~1."
        }
      }
    },
    "duration": {
      "description": "视频时长(秒),必填。非 kling-v3:仅 5 或 10;kling-v3:3~15。支持 string 或 integer,网关归一化为字符串。",
      "oneOf": [
        {
          "pattern": "^[0-9]+$",
          "type": "string"
        },
        {
          "minimum": 1,
          "type": "integer"
        }
      ],
      "x-i18n": {
        "en-US": {
          "description": "Video duration (seconds), required. Non-kling-v3: only 5 or 10; kling-v3: 3~15. Supports string or integer, gateway normalizes to string."
        }
      }
    },
    "external_task_id": {
      "description": "调用方外部任务 ID,用于幂等关联与业务对账;非响应体 data.task_id。",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "The caller's external task ID, used for idempotent association and business reconciliation; non-response body data.task_id."
        }
      }
    },
    "mode": {
      "description": "生成模式。不传时计费侧默认 std。4k 仅 kling-v3;kling-v2-6 开 sound 须 pro。",
      "enum": [
        "std",
        "pro",
        "4k"
      ],
      "type": "string",
      "x-apifox-enum": [
        {
          "description": "性价比模式",
          "name": "标准",
          "value": "std"
        },
        {
          "description": "高表现模式",
          "name": "高品质",
          "value": "pro"
        },
        {
          "description": "仅 kling-v3 支持",
          "name": "4K",
          "value": "4k"
        }
      ],
      "x-i18n": {
        "en-US": {
          "description": "Generate schema. The billing side defaults to std when not transmitted. 4k only kling-v3; kling-v2-6 requires pro to open sound."
        }
      }
    },
    "model_name": {
      "description": "模型名称。不传时网关计费默认 kling-v1,建议显式填写。multi_shot=true 时必须为 kling-v3;mode=4k 时必须为 kling-v3。",
      "enum": [
        "kling-v1",
        "kling-v1-6",
        "kling-v2-master",
        "kling-v2-1-master",
        "kling-v2-5-turbo",
        "kling-v2-6",
        "kling-v3"
      ],
      "type": "string",
      "x-apifox-enum": [
        {
          "description": "经典模型,duration 仅 5/10 秒",
          "name": "V1",
          "value": "kling-v1"
        },
        {
          "description": "V1.6 增强,duration 仅 5/10 秒",
          "name": "V1.6",
          "value": "kling-v1-6"
        },
        {
          "description": "大师版,duration 仅 5/10 秒",
          "name": "V2 Master",
          "value": "kling-v2-master"
        },
        {
          "description": "V2.1 大师版,duration 仅 5/10 秒",
          "name": "V2.1 Master",
          "value": "kling-v2-1-master"
        },
        {
          "description": "Turbo 档,duration 仅 5/10 秒",
          "name": "V2.5 Turbo",
          "value": "kling-v2-5-turbo"
        },
        {
          "description": "支持有声(须 mode=pro + sound=on),duration 仅 5/10 秒",
          "name": "V2.6",
          "value": "kling-v2-6"
        },
        {
          "description": "支持 sound/4k/multi_shot,duration 3~15 秒",
          "name": "V3",
          "value": "kling-v3"
        }
      ],
      "x-i18n": {
        "en-US": {
          "description": "Model name. When not transmitted, gateway accounting defaults to kling-v1, and it is recommended to fill it in explicitly. It must be kling-v3 when multi_shot=true; it must be kling-v3 when mode=4k."
        }
      }
    },
    "multi_prompt": {
      "description": "自定义分镜列表。shot_type=customize 时必填,最多 6 镜。每镜 prompt≤512、duration≥1;各镜 duration 之和须等于顶层 duration(误差 ≤0.1)。",
      "items": {
        "additionalProperties": false,
        "properties": {
          "duration": {
            "description": "该分镜时长(秒),≥1",
            "oneOf": [
              {
                "pattern": "^[0-9]+(\\.[0-9]+)?$",
                "type": "string"
              },
              {
                "minimum": 1,
                "type": "number"
              },
              {
                "minimum": 1,
                "type": "integer"
              }
            ],
            "x-i18n": {
              "en-US": {
                "description": "The duration of the storyboard (seconds), ≥1"
              }
            }
          },
          "index": {
            "description": "分镜序号,从 1 起",
            "minimum": 1,
            "type": "integer",
            "x-i18n": {
              "en-US": {
                "description": "Storyboard number, starting from 1"
              }
            }
          },
          "prompt": {
            "description": "该分镜正向提示词,≤512 字符",
            "maxLength": 512,
            "minLength": 1,
            "type": "string",
            "x-i18n": {
              "en-US": {
                "description": "The storyboard’s positive prompt word, ≤512 characters"
              }
            }
          }
        },
        "required": [
          "index",
          "prompt",
          "duration"
        ],
        "type": "object"
      },
      "maxItems": 6,
      "type": "array",
      "x-i18n": {
        "en-US": {
          "description": "Customized storyboard list. Required when shot_type=customize, up to 6 shots. Each mirror prompt≤512, duration≥1; the sum of the durations of each mirror must be equal to the top-level duration (error ≤0.1)."
        }
      }
    },
    "multi_shot": {
      "default": false,
      "description": "是否多镜头。true 时仅 kling-v3 支持,且 prompt 无效;false 时 shot_type / multi_prompt 不可传。",
      "type": "boolean",
      "x-i18n": {
        "en-US": {
          "description": "Whether there are multiple lenses. When true, only kling-v3 supports it, and prompt is invalid; when false, shot_type / multi_prompt cannot be passed."
        }
      }
    },
    "negative_prompt": {
      "description": "负向提示词。描述不希望出现的内容,网关透传。",
      "maxLength": 2500,
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Negative cue words. Describe the unwanted content and transparently transmit it through the gateway."
        }
      }
    },
    "prompt": {
      "description": "正向提示词。multi_shot=false(默认)时必填;multi_shot=true 时无效,传了会 400。上游约束 ≤2500 字符。",
      "maxLength": 2500,
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Positive cue words. Required when multi_shot=false (default); invalid when multi_shot=true, 400 will be sent. Upstream constraint ≤2500 characters."
        }
      }
    },
    "shot_type": {
      "description": "分镜方式。multi_shot=true 时必填;multi_shot=false 时不可传。customize 须配合 multi_prompt;intelligence 由上游自动拆镜。",
      "enum": [
        "customize",
        "intelligence"
      ],
      "type": "string",
      "x-apifox-enum": [
        {
          "description": "须传 multi_prompt,各镜 duration 之和须等于顶层 duration",
          "name": "自定义分镜",
          "value": "customize"
        },
        {
          "description": "不需 multi_prompt",
          "name": "智能分镜",
          "value": "intelligence"
        }
      ],
      "x-i18n": {
        "en-US": {
          "description": "Storyboarding method. Required when multi_shot=true; cannot be passed when multi_shot=false. customize must be used with multi_prompt; intelligence is automatically removed from the upstream."
        }
      }
    },
    "sound": {
      "description": "有声开关。网关仅对非空值做模型/模式校验;传 on 时触发有声计费。仅 kling-v2-6 / kling-v3 支持;v2-6 须 mode=pro。",
      "enum": [
        "on",
        "off"
      ],
      "type": "string",
      "x-apifox-enum": [
        {
          "description": "仅 v2-6 / v3;v2-6 需 mode=pro",
          "name": "开启有声",
          "value": "on"
        },
        {
          "description": "默认无声",
          "name": "关闭有声",
          "value": "off"
        }
      ],
      "x-i18n": {
        "en-US": {
          "description": "Audible switch. The gateway only performs model/schema verification on non-null values; triggers audible billing when on is passed. Only supported by kling-v2-6 / kling-v3; v2-6 requires mode=pro."
        }
      }
    },
    "voice_list": {
      "description": "自定义音色列表。字段可透传;当前 text2video 计费路径未单独识别 voice_list(与 image2video 不同,不影响 hasVoiceId 倍率)。",
      "items": {
        "additionalProperties": false,
        "properties": {
          "voice_id": {
            "description": "自定义音色 ID,来自创建音色接口",
            "minLength": 1,
            "type": "string",
            "x-i18n": {
              "en-US": {
                "description": "Custom patch ID, from the create patch interface"
              }
            }
          }
        },
        "required": [
          "voice_id"
        ],
        "type": "object"
      },
      "type": "array",
      "x-i18n": {
        "en-US": {
          "description": "Custom sound list. The field can be transparently transmitted; the current text2video billing path does not identify voice_list separately (unlike image2video, it does not affect the hasVoiceId multiplier)."
        }
      }
    }
  },
  "required": [
    "model_name",
    "duration"
  ]
}

请求示例 · 新手推荐:文生视频 · 最小可用提交通路#

{
  "aspect_ratio": "16:9",
  "duration": "5",
  "mode": "std",
  "model_name": "kling-v1",
  "prompt": "A drone shot of a beautiful coastline at golden hour sunset"
}

请求示例 · 新手推荐:文生视频 · V2 Master 高品质 10 秒#

{
  "aspect_ratio": "16:9",
  "duration": "10",
  "mode": "pro",
  "model_name": "kling-v2-master",
  "prompt": "Cinematic dolly-in over a misty mountain lake at dawn, soft rim light"
}

请求示例 · 新手推荐:文生视频 · V2.6 有声 pro#

{
  "aspect_ratio": "16:9",
  "duration": "5",
  "mode": "pro",
  "model_name": "kling-v2-6",
  "prompt": "A street musician plays violin on a rainy city corner, crowd ambience",
  "sound": "on"
}

请求示例 · 新手推荐:文生视频 · V3 按秒 8 秒#

{
  "aspect_ratio": "16:9",
  "duration": 8,
  "mode": "pro",
  "model_name": "kling-v3",
  "prompt": "Slow push-in shot of a detective reading case files under a desk lamp"
}

请求示例 · 进阶推荐:文生视频 · 负向词与 cfg_scale#

{
  "aspect_ratio": "16:9",
  "cfg_scale": 0.7,
  "duration": "5",
  "mode": "std",
  "model_name": "kling-v1-6",
  "negative_prompt": "blurry, low quality, watermark, text overlay",
  "prompt": "A white horse galloping along the beach at sunrise, cinematic motion blur"
}

请求示例 · 进阶推荐:文生视频 · V3 4K 竖屏回调#

{
  "aspect_ratio": "9:16",
  "callback_url": "{{callback_url}}",
  "duration": 6,
  "external_task_id": "{{external_task_id}}",
  "mode": "4k",
  "model_name": "kling-v3",
  "prompt": "Cyberpunk portrait in neon rain, camera slowly orbits the subject"
}

请求示例 · 进阶推荐:文生视频 · V3 多镜头 customize#

{
  "aspect_ratio": "16:9",
  "duration": "6",
  "mode": "pro",
  "model_name": "kling-v3",
  "multi_prompt": [
    {
      "duration": 2,
      "index": 1,
      "prompt": "Wide establishing shot of a futuristic city skyline at dusk"
    },
    {
      "duration": 2,
      "index": 2,
      "prompt": "Medium shot, a courier runs through crowded streets with neon signs"
    },
    {
      "duration": 2,
      "index": 3,
      "prompt": "Close-up on the courier's determined face, rain droplets on skin"
    }
  ],
  "multi_shot": true,
  "shot_type": "customize"
}

请求示例 · 进阶推荐:文生视频 · V3 多镜头 intelligence#

{
  "aspect_ratio": "16:9",
  "duration": "10",
  "mode": "pro",
  "model_name": "kling-v3",
  "multi_shot": true,
  "prompt": "A time-lapse journey through four seasons in the same forest clearing",
  "shot_type": "intelligence"
}

请求示例 · 进阶推荐:文生视频 · 镜头控制 camera_control#

{
  "aspect_ratio": "16:9",
  "camera_control": {
    "config": {
      "horizontal": 0,
      "pan": 0,
      "roll": 0,
      "tilt": -2.5,
      "vertical": 0,
      "zoom": 1.5
    },
    "type": "simple"
  },
  "duration": "5",
  "mode": "pro",
  "model_name": "kling-v2-5-turbo",
  "prompt": "Drone-like forward movement over a deep mountain valley with morning fog"
}

响应示例 · 成功示例#

{
  "code": 0,
  "data": {
    "created_at": 1766374262370,
    "task_id": "831922345719271433",
    "task_info": {},
    "task_status": "submitted",
    "updated_at": 1766374262370
  },
  "message": "SUCCEED",
  "request_id": "603e2a28-fb89-4146-ae33-412d74012a6d"
}

请求参数

Authorization
Bearer Token
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
or
Body 参数application/json必填

示例
{
    "model_name": "kling-v1",
    "prompt": "A drone shot of a beautiful coastline at golden hour sunset",
    "mode": "std",
    "duration": "5",
    "aspect_ratio": "16:9"
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
cURL
curl --location '/kling/v1/videos/text2video' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "model_name": "kling-v1",
    "prompt": "A drone shot of a beautiful coastline at golden hour sunset",
    "mode": "std",
    "duration": "5",
    "aspect_ratio": "16:9"
}'

返回响应

🟢200成功
application/json
任务提交成功
Bodyapplication/json

示例
{
    "code": 0,
    "message": "success",
    "request_id": "string",
    "data": {
        "task_id": "string",
        "task_status": "submitted",
        "created_at": 0,
        "updated_at": 0
    }
}
🟠400请求有误
🟠401没有权限
修改于 2026-10-24 18:33:09
上一页
文生音效
下一页
图生视频
Built with