API Reference
AI image API
POST
ai-image-api
ID 13
Generate an image from a prompt and optional reference images.
POST
https://xiaoapis.com/api/image/create
Overview
- 文生图
- 参考图(可选)
- 多比例/分辨率参数
Use cases
- 封面生成
- 营销配图
- 短视频素材
Conventions
- Gateway ·
https://xiaoapis.com - Auth · send
key(query or JSON body, as this API specifies) - Response · JSON. Check the business code and the HTTP status, not only HTTP 200
Authentication
Send the platform API key (query parameter key or JSON field key, as this page specifies). Create one in API key management.
POST https://xiaoapis.com/api/image/create
Content-Type: application/json
{
"key": "YOUR_API_KEY"
}
Request example
https://xiaoapis.com/api/image/create?key=你的密钥
Details
请求HEADER:
| 名称 | 值 |
|---|---|
| Content-Type | application/json |
请求参数说明:
| 名称 | 必填 | 类型 | 示例值 | 说明 |
|---|---|---|---|---|
| model | 是 | string | nano-banana-pro | 支持模型: nano-banana nano-banana-pro nano-banana-2 |
| prompt | 是 | string | 一只可爱的猫咪在草地上玩耍 | 提示词 |
| aspectRatio | 否 | string | auto | 输出图像比例,支持的比例: auto 1:1 16:9 9:16 4:3 3:4 3:2 2:3 5:4 4:5 21:9 默认 auto |
| imageSize | 否 | string | 1K | 支持模型: nano-banana-pro nano-banana-pro-vt nano-banana-pro-cl nano-banana-pro-vip(只支持1k,2k) nano-banana-pro-4k-vip(只支持4k) - 输出图像大小,支持的大小: 1K 2K 4K 默认 1K - 注意:分辨率越高,生成时间越长 |
| urls | 否 | array | ["https://example.com/example.png"] | 参考图URL |
| notify | 是 | string | https://xx.x.ocm | 回调地址 |
返回参数说明:
| 名称 | 类型 | 说明 |
|---|---|---|
| code | int | 状态码 |
| msg | string | 状态信息 |
| data | array | 请求结果数据集 |
| - task_id | string | 任务ID |
| exec_time | float | 执行耗时 |
| user_ip | string | 客户端IP |
Response example
{ "code": 0, "msg": "success", "data": { "task_id": "i44bcf50-f2d0-4c26-a467-26f2014a771b" }}
FAQ
AI 图像 API 怎么用?
提交 prompt、模型与可选 urls 参考图,按文档获取生成结果或任务结果。
支持参考图吗?
支持。传入公网图片 URL 列表即可走图生图类能力(以文档为准)。
如何设置尺寸?
使用 aspectRatio、imageSize 等参数,可选值见文档。
适合短视频吗?
适合生成封面与中间素材,再交给剪辑或发布流程。
鉴权方式?
平台 API Key。
想要「文案自动出 IP 封面」用哪个接口?
口播文案自动提炼标题并生成人物一致竖版封面,请用 IP 视频封面接口 /doc/55。
Related APIs
Full console doc (with the debugger):/doc/13