可图 (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 URL | https://open.dieyuyun.com |
| 兼容协议 | OpenAI Images API |
认证
Bearer Token: Authorization: Bearer YOUR_API_KEY
标准请求字段
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| model | string | 是 | — | 模型标识: Kwai-Kolors/Kolors |
| prompt | string | 是 | — | 图像描述文本,支持中英文 |
| size | string | 否 | 1024x1024 | 图像尺寸(宽x高) |
| n | integer | 否 | 1 | 一次生成的图片数量,范围 1-4 |
支持的尺寸
| 尺寸 | 比例 |
|---|---|
1024x1024 | 1:1 |
768x1024 | 3:4 |
1024x768 | 4:3 |
720x1280 | 9:16 |
1280x720 | 16:9 |
扩展参数
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| negative_prompt | string | 否 | — | 不希望出现的元素描述,排除特定内容 |
| seed | integer | 否 | — | 随机种子,用于复现生成结果(0-9999999999) |
| num_inference_steps | integer | 否 | 20 | 推理步数,步数越多质量越高但耗时越长(1-100) |
| guidance_scale | number | 否 | 7.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
}
}| 字段 | 类型 | 说明 |
|---|---|---|
| created | integer | Unix 时间戳 |
| data | array | 生成结果数组 |
| data[].url | string | 图像 URL |
| usage | object | 用量统计 |
| usage.generated_images | integer | 生成的图像数量 |
| usage.total_tokens | integer | 总消耗 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_scale 和 num_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 步。
速率限制
详见 速率限制。
相关文档
- Doubao Seedream 5.0 Lite - 高质量图像生成,支持联网搜索
- BFL FLUX - BFL FLUX 官方模型
- 模型列表与定价 - 浏览可用模型和定价信息