跳转到内容

图像生成 (Images Generations)

图像生成接口用于根据一段文本提示词(Prompt)生成全新的图像(文生图)。它兼容 OpenAI 的 DALL-E 系列模型。

POST /v1/images/generations
参数类型必填默认值说明
modelstringdall-e-2调用的绘图模型 ID(例如 dall-e-3, flux-schnell)。
promptstring-生成图像的文本描述。长度通常有一定限制(例如 DALL-E 3 为 4000 字符)。
ninteger1生成的图像数量。对于 DALL-E 3,通常固定为 1。
sizestring1024x1024图像分辨率。例如 1024x1024, 1024x1792
response_formatstringurl返回的格式。支持返回图片直链 url,或图片 Base64 编码的 b64_json
Terminal window
curl https://api.easytakeai.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "dall-e-3",
"prompt": "一只穿着宇航服在太空行走的金色寻回犬,写实风格,电影感光效",
"size": "1024x1024",
"n": 1
}'
{
"created": 1716298520,
"data": [
{
"url": "https://api.easytakeai.com/assets/images/generated-img-12345.png",
"revised_prompt": "A golden retriever wearing a detailed astronaut suit, floating gracefully in deep space..."
}
]
}