> ## Documentation Index
> Fetch the complete documentation index at: https://docs.geekai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# 可灵画图 v2

### 模型参数

* 模型ID：`kling-image-v2/kling-image-v2-1/kling-image-v2-new,`
* 模型价格：你可以在[模型广场](https://geekai.co/models?platform=kling\&type=image)查看最新价格信息
* 调用入口：`https://geekai.co/api/v1/images/generations`
* 模型参数：参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations)
* API认证：[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start)

<Note>
  不支持画图公共 API 中的以下参数：

  * `size`
  * `seed`
  * `quality`
  * `style_preset`
  * `response_format`
  * `output_format`
  * `mask`
  * `watermark`
  * `background`

  附：[可灵画图 v2 官方 API 文档](https://app.klingai.com/cn/dev/document-api/apiReference/model/imageGeneration)
</Note>

`kling-image-v2`对应支持的`aspect_ratio`包括： 1:1，16:9，4:3，3:2，2:3，3:4，9:16，21:9
同样，参考图像也支持传入图片Base64编码，直接在image里面传入图片Base64编码即可，但是请不要在Base64编码字符串前添加任何前缀，例如data:image/png;base64,。正确的参数格式应该直接是Base64编码后的字符串。

### 文生图

通过文字描述来生成对应图像：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"kling-image-v2",
    "prompt": "画一只可爱的小猫",
    "negative_prompt": "低质量",
    "aspect_ratio": "4:3",
    "n": 1,
}'
```

响应是一个 JSON 对象，包含生成图片的 URL：

```json theme={null}
{
    "model": "kling-image-v2",
    "created": 1768456368,
    "task_id": "5b36a98e-e202-43f8-8a28-cecdc83020b8",
    "task_status": "succeed",
    "data": [
        {
            "url": "https://static.geekai.co/image/2026/01/15/c07071e78203f406b0a607a2120adc11.png"
        }
    ]
}
```

### 图生图

**单图**

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"kling-image-v2",
    "prompt": "将图中女生的服装颜色变为绿色",
    "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png",
    "aspect_ratio": "16:9"
}'
```

响应同上述是一个 JSON 对象，包含生成图片的 URL:

```json theme={null}
{
    "model": "kling-image-v2",
    "created": 1768987803,
    "task_id": "72580c6b-7733-4fbb-9661-f50c0e25280a",
    "task_status": "succeed",
    "data": [
        {
            "url": "https://static.geekai.co/image/2026/01/21/d5c09e54706a09cbb6271236e9d95fe1.png"
        }
    ]
}
```

**多图参考生图**

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"kling-image-v2",
    "prompt": "将图2女生的服装换为图1女生的服装",
    "image": ["https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png"],
    "aspect_ratio": "16:9"
}'
```

响应同上述是一个 JSON 对象，包含生成图片的 URL：

```json theme={null}
{
    "model": "kling-image-v2",
    "created": 1768892618,
    "task_id": "f48dea70-364a-4d57-8412-85b4c1528c02",
    "task_status": "succeed",
    "data": [
        {
            "url": "https://static.geekai.co/image/2026/01/20/146eb9ad496351cbaf9b7554ac08f06f.png"
        }
    ]
}
```
