图像生成
根据文字描述生成图片,兼容 OpenAI Images API。一次可生成一张或多张。
基本信息
方法POST
端点https://koprouter.kopglobal.com/v1/images/generations
鉴权Authorization: Bearer sk-...
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model |
string | 是 | 图像生成模型 ID |
prompt |
string | 是 | 图片描述文字 |
size |
string | 否 | 图片尺寸,如 1024x1024 |
n |
number | 否 | 生成图片数量 |
quality |
string | 否 | 质量档位,如 standard、hd |
response_format |
string | 否 | 返回格式,url 或 b64_json |
请求示例
curl https://koprouter.kopglobal.com/v1/images/generations \
-H "Authorization: Bearer sk-..." \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"prompt": "A cat sitting on a windowsill at sunset",
"size": "1024x1024",
"n": 1
}'
响应示例
{
"created": 1720000000,
"data": [
{
"url": "https://example.com/image.png"
}
]
}