Skip to content

可图 (Kolors) 图像生成

快手可图 Kolors 模型,极致低价图像生成方案,支持中英文提示词、多种图像比例和批量生成,适合大批量生图和测试场景。

快速开始

python
from openai import OpenAI

client = OpenAI(
    base_url="https://open.dieyuyun.com/v1",
    api_key="YOUR_API_KEY"
)

response = client.images.generate(
    model="Kwai-Kolors/Kolors",
    prompt="一只橘猫坐在窗台上看雨,水彩风格,温暖色调",
    size="1024x1024",
    n=1
)

print(response.data[0].url)

请求端点

项目
方法POST
路径/v1/images/generations
Base URLhttps://open.dieyuyun.com
兼容协议OpenAI Images API

认证

Bearer Token: Authorization: Bearer YOUR_API_KEY

标准请求字段

字段类型必填默认值说明
modelstring模型标识: Kwai-Kolors/Kolors
promptstring图像描述文本,支持中英文
sizestring1024x1024图像尺寸(宽x高)
ninteger1一次生成的图片数量,范围 1-4

支持的尺寸

尺寸比例
1024x10241:1
768x10243:4
1024x7684:3
720x12809:16
1280x72016:9

扩展参数

字段类型必填默认值说明
negative_promptstring不希望出现的元素描述,排除特定内容
seedinteger随机种子,用于复现生成结果(0-9999999999)
num_inference_stepsinteger20推理步数,步数越多质量越高但耗时越长(1-100)
guidance_scalenumber7.5提示词引导强度,越高越贴近描述(0-20)

请求示例

bash
curl https://open.dieyuyun.com/v1/images/generations \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Kwai-Kolors/Kolors",
    "prompt": "一只橘猫坐在窗台上看雨,水彩风格,温暖色调",
    "size": "1024x1024",
    "n": 1
  }'
python
from openai import OpenAI

client = OpenAI(
    base_url="https://open.dieyuyun.com/v1",
    api_key="YOUR_API_KEY"
)

response = client.images.generate(
    model="Kwai-Kolors/Kolors",
    prompt="一只橘猫坐在窗台上看雨,水彩风格,温暖色调",
    size="1024x1024",
    n=1
)

print(response.data[0].url)
javascript
import OpenAI from 'openai'

const client = new OpenAI({
  baseURL: 'https://open.dieyuyun.com/v1',
  apiKey: 'YOUR_API_KEY',
})

const response = await client.images.generate({
  model: 'Kwai-Kolors/Kolors',
  prompt: '一只橘猫坐在窗台上看雨,水彩风格,温暖色调',
  size: '1024x1024',
  n: 1,
})

console.log(response.data[0].url)

响应格式

成功响应

json
{
  "created": 1717000000,
  "data": [
    {
      "url": "https://..."
    }
  ],
  "usage": {
    "generated_images": 1,
    "total_tokens": 0
  }
}
字段类型说明
createdintegerUnix 时间戳
dataarray生成结果数组
data[].urlstring图像 URL
usageobject用量统计
usage.generated_imagesinteger生成的图像数量
usage.total_tokensinteger总消耗 Token 数

错误响应

详见 错误码

可图特有能力

极致低价

每张图像仅 ¥0.01,是目前平台最低价格的图像生成模型,非常适合大批量生成和测试场景。

批量生成

支持一次请求生成最多 4 张图片(n 参数),适合需要多方案对比的场景。

python
response = client.images.generate(
    model="Kwai-Kolors/Kolors",
    prompt="现代简约风格的客厅设计",
    size="1024x1024",
    n=4
)

for img in response.data:
    print(img.url)

精细控制

通过 guidance_scalenum_inference_steps 参数精细调节生成效果:

python
response = client.images.generate(
    model="Kwai-Kolors/Kolors",
    prompt="赛博朋克城市夜景",
    size="1280x720",
    guidance_scale=12.0,
    num_inference_steps=50
)

最佳实践

  • 批量生成: 使用 n 参数一次生成多张候选图,快速筛选最佳方案。
  • 负面提示词: 使用 negative_prompt 排除不想要的元素,如 "低质量、模糊、变形"。
  • 提示词技巧: 支持中英文混合提示词,描述越具体,生成效果越好。
  • 复现结果: 记录 seed 值可复现相似的生成结果,便于迭代优化。
  • 步数调节: 日常使用默认 20 步即可,对画质有极致要求时可提高到 50-100 步。

速率限制

详见 速率限制

相关文档