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/images/generations
根据文本提示词生成图像。

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

图像生成#

其他参数 请看 官方文档 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, 4:3, 3:4, 3:2, 2:3",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "The aspect ratio of the generated image, optional, available values: 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3"
        }
      }
    },
    "callback_url": {
      "description": "回调通知地址,可选,当任务状态发生变化时,系统会向这个地址发送通知",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Callback notification address, optional. When the task status changes, the system will send a notification to this address."
        }
      }
    },
    "image": {
      "description": "参考图片,可选,支持 Base64 编码或图片 URL,支持 .jpg/.jpeg/.png 格式,大小不能超过 10MB",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Reference image, optional, supports Base64 encoding or image URL, supports .jpg/.jpeg/.png format, size cannot exceed 10MB"
        }
      }
    },
    "image_fidelity": {
      "description": "参考图片的影响强度,可选,取值范围:0-1,值越大,生成的图像越接近参考图片",
      "type": "number",
      "x-i18n": {
        "en-US": {
          "description": "The influence strength of the reference image, optional, value range: 0-1, the larger the value, the closer the generated image is to the reference image"
        }
      }
    },
    "model_name": {
      "description": "kling-v1、kling-v1-5、kling-v1-6\n",
      "type": "string"
    },
    "n": {
      "description": "生成图片的数量,可选,取值范围:1-9",
      "type": "integer",
      "x-i18n": {
        "en-US": {
          "description": "The number of generated images, optional, value range: 1-9"
        }
      }
    },
    "negative_prompt": {
      "description": "负向提示词,可选,描述你不想在图像中出现的元素,不能超过200个字符",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Negative prompt word, optional, describes the elements you do not want to appear in the image, cannot exceed 200 characters"
        }
      }
    },
    "prompt": {
      "description": "正向提示词,必需,描述你想要生成的图像内容,不能超过500个字符",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Positive prompt word, required, describes the image content you want to generate, cannot exceed 500 characters"
        }
      }
    }
  },
  "required": [
    "model_name",
    "prompt",
    "negative_prompt",
    "image",
    "image_fidelity",
    "n",
    "aspect_ratio",
    "callback_url"
  ]
}

请求示例 · 示例 1#

{
  "aspect_ratio": "1:1",
  "human_fidelity": 1,
  "image": "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
  "image_reference": "subject",
  "model_name": "kling-v1-5",
  "negative_prompt": "",
  "prompt": "flow"
}

响应示例 · 成功示例#

{
  "code": 0,
  "data": {
    "created_at": 1733851336696,
    "task_id": "CjMT7WdSwWcAAAAAALvB3g",
    "task_status": "submitted",
    "updated_at": 1733851336696
  },
  "message": "SUCCEED",
  "request_id": "CjMT7WdSwWcAAAAAALvB3g"
}

图像生成#

请求参数#

{
  "contentType": "application/json",
  "properties": {
    "aspect_ratio": {
      "description": "生成图片的画面纵横比(宽:高)\n枚举值:16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9",
      "type": "string",
      "x-i18n": {
        "en-US": {
          "description": "Aspect ratio (W:H)\nenum: 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9"
        }
      }
    },
    "callback_url": {
      "type": "string"
    },
    "human_fidelity": {
      "description": "面部参考强度,即参考图中人物五官相似度\n仅 image_reference 参数为 subject 时生效\n取值范围:[0,1],数值越大参考强度越大",
      "type": "number"
    },
    "image": {
      "description": "参考图像支持传入图片Base64编码或图片URL(确保可访问)",
      "type": "string"
    },
    "image_fidelity": {
      "description": "生成过程中对用户上传图片的参考强度\n取值范围:[0,1],数值越大参考强度越大",
      "type": "number"
    },
    "image_reference": {
      "description": "图片参考类型\n枚举值:subject(角色特征参考), face(人物长相参考)\n使用face(人物长相参考)时,上传图片需仅含1张人脸。\n使用 kling-v1-5 且 image 参数不为空时,当前参数必填",
      "type": "string"
    },
    "model_name": {
      "description": "模型名称 枚举值:kling-v1, kling-v1-5, kling-v2, kling-v2-new, kling-v2-1,kling-v3",
      "type": "string"
    },
    "n": {
      "description": "生成图片数量\n取值范围:[1,9]",
      "type": "integer",
      "x-i18n": {
        "en-US": {
          "description": "Number of images to generate\nrange: [1,9]"
        }
      }
    },
    "negative_prompt": {
      "description": "负向文本提示词 不能超过2500个字符",
      "type": "string"
    },
    "prompt": {
      "description": "正向文本提示词 不能超过2500个字符",
      "type": "string"
    },
    "resolution": {
      "description": "生成图片的清晰度\n枚举值:1k, 2k\n1k:1K标清\n2k:2K高清",
      "type": "string"
    }
  },
  "required": [
    "model_name",
    "prompt",
    "n"
  ]
}

请求示例 · 示例 1#

"{\r\n    \"model_name\": \"kling-v1\",\r\n    \"prompt\": \"生成一张海边的图\",\r\n    \"negative_prompt\": \"\",\r\n    \"image\": \"\",\r\n    \"image_reference\": \"\",\r\n    // \"image_fidelity\": \"0.5\",\r\n    \"human_fidelity\": 0.45,\r\n    \"resolution\": \"1k\",\r\n    \"n\": 2,\r\n    \"aspect_ratio\": \"16:9\",\r\n    \"callback_url\": \"\"\r\n}"

请求参数

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

示例
{
    "model_name": "kling-v1-5",
    "prompt": "一只可爱的橘猫坐在窗台上,水彩风格",
    "n": 1,
    "aspect_ratio": "1:1",
    "resolution": "1k"
}

请求示例代码

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/images/generations' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "model_name": "kling-v1-5",
    "prompt": "一只可爱的橘猫坐在窗台上,水彩风格",
    "n": 1,
    "aspect_ratio": "1:1",
    "resolution": "1k"
}'

返回响应

🟢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