AI 服务/图像生成
生成图像
Changed on接口说明:同步生成图像,根据所选模型与提示词返回生成结果。
调用本接口前,请先请求「图像生成模型」接口(GET /api/ai/models/image/generation),获取当前可用的模型列表及各模型支持的尺寸、质量、风格与价格,再据此填写本接口参数。
图像生成为文生图:仅通过文字提示词生成全新图像,不传入图片。如需基于已有图片进行修改、重绘(图生图),请使用「编辑图像」接口。
如已在使用 OpenAI SDK 或生态工具,可改用 OpenAI 兼容端点「OpenAI 图像生成」。
post/api/ai/image/generate
Request
- Base URLhttps://aitoearn.cn
- AuthAPI key in header X-Api-Key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"prompt": "A cute orange cat sitting by a window, soft natural light",
"model": "gpt-image-2",
"quality": "low",
"response_format": "url",
"size": "1024x1024"
}Response
请求已被服务处理。业务是否成功以响应体 code === 0 为准。
Changes
- warning
removed the request property
- warning