图像生成
POST/v1/images/generations
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型,如 dall-e-3, dall-e-2 |
| prompt | string | 是 | 图像描述 |
| n | integer | 否 | 生成数量 1-10,默认 1 |
| size | string | 否 | 图像尺寸 1024x1024, 1792x1024, 1024x1792 |
| quality | string | 否 | 标准 standard 或 高清 hd |
| response_format | string | 否 | url 或 b64_json |
请求示例
cURL
curl https://api.mintcloud.ai/v1/images/generations \
-H "Authorization: Bearer $MINTCLOUD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "一只可爱的猫咪",
"size": "1024x1024"
}'Python
import requests
response = requests.post(
"https://api.mintcloud.ai/v1/images/generations",
headers={
"Authorization": "Bearer $MINTCLOUD_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "dall-e-3",
"prompt": "一只可爱的猫咪",
"size": "1024x1024",
},
)
print(response.json())TypeScript
const response = await fetch(
"https://api.mintcloud.ai/v1/images/generations",
{
method: "POST",
headers: {
"Authorization": "Bearer $MINTCLOUD_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "dall-e-3",
prompt: "一只可爱的猫咪",
size: "1024x1024",
}),
}
);
const data = await response.json();
console.log(data);响应格式
{
"created": 1699888000,
"data": [
{
"url": "https://...",
"revised_prompt": "..."
}
]
}支持的模型
dall-e-3 (推荐)dall-e-2