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

# Kling 图像生成

> 使用 Kling API 生成图像

> 更新日期：2026-06-06

# Kling 图像生成

```
POST /kling/v1/images/generations
```

当前公开文档只承诺 Kling 图像生成主路径。不要把尚未公开建模的 image-side 扩展字段误写成已稳定对客 contract。

## 当前已验证范围

* `kling-v2-5-turbo` 图片生成已完成 bounded 验证
* 成功结果会优先返回 Crazyrouter 归档地址，如 `https://media.crazyrouter.com/...png`

## 请求参数

| 参数                 | 类型      | 必填 | 说明                         |
| ------------------ | ------- | -- | -------------------------- |
| `model`            | string  | 否  | 当前常用示例为 `kling-v2-5-turbo` |
| `prompt`           | string  | 是  | 图像描述提示词                    |
| `negative_prompt`  | string  | 否  | 负面提示词                      |
| `aspect_ratio`     | string  | 否  | 如 `1:1`、`16:9`、`9:16`      |
| `n`                | integer | 否  | 生成数量，默认 `1`                |
| `callback_url`     | string  | 否  | 回调地址                       |
| `external_task_id` | string  | 否  | 业务侧自定义任务 ID                |

## 请求示例

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.crazyrouter.com/kling/v1/images/generations \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -d '{
      "model": "kling-v2-5-turbo",
      "prompt": "一只戴着墨镜的柴犬，写实摄影风格",
      "negative_prompt": "blurry, low quality",
      "aspect_ratio": "1:1",
      "n": 1
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.crazyrouter.com/kling/v1/images/generations",
      headers={
          "Content-Type": "application/json",
          "Authorization": "Bearer YOUR_API_KEY"
      },
      json={
          "model": "kling-v2-5-turbo",
          "prompt": "一只戴着墨镜的柴犬，写实摄影风格",
          "negative_prompt": "blurry, low quality",
          "aspect_ratio": "1:1",
          "n": 1
      }
  )

  print(response.json())
  ```
</CodeGroup>

## 提交成功响应示例

```json theme={null}
{
  "created_at": 1774536039,
  "id": "2037177945839673344",
  "model": "kling-v2-5-turbo",
  "object": "video",
  "progress": 0,
  "status": "",
  "task_id": "2037177945839673344"
}
```

***

## 查询图像任务

```
GET /kling/v1/images/generations/{task_id}
```

```bash cURL theme={null}
curl https://api.crazyrouter.com/kling/v1/images/generations/2037177945839673344 \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### 响应示例（已完成）

```json theme={null}
{
  "code": "success",
  "message": "",
  "data": {
    "error": null,
    "format": "png",
    "metadata": null,
    "status": "succeeded",
    "task_id": "2037177945839673344",
    "url": "https://media.crazyrouter.com/task-artifacts/2026/03/26/50/imageGenerate/2037177945839673344.png"
  }
}
```

<Note>
  Kling 图像生成是异步任务。提交后请通过查询接口获取终态结果。当前页面不把图生图、`image_fidelity` 等 image-side 扩展参数写成公开硬 contract。
</Note>
