nano-banana接口
POST
https://{base_url}/v1/api/generate
请求参数
Path 参数
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| base_url | string | 必需 |
Header 参数
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| Authorization | string | 可选 |
示例: Bearer sk-xxxxxxxxxxx
|
Body 参数 application/json 必填
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| model | string | 必需 | 模型名称 |
|
支持以下模型:
|
|||
| prompt | string | 必需 | 提示词 |
| images | array[string] | 可选 | 参考图,支持base64与url链接 |
| aspectRatio | string | 可选 | 比例 |
|
图像比例支持的参数:
|
|||
| imageSize | string | 可选 | 分辨率,1K、2K、4K |
| replyType | string | 可选 | 回复类型 |
|
支持参数:
|
|||
示例
JSON
"model": "nano-banana-2",
"prompt": "生成一张边牧与古牧正在抖音直播间直播带货截图",
"images": [],
"aspectRatio": "1:1",
"imageSize": "1K",
"replyType": "json" }
请求示例代码
cURL
cURL-Windows
Httpie
wget
PowerShell
curl --location 'https://v1/api/generate' \
--header 'Authorization: Bearer sk-xxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"model": "nano-banana-2",
"prompt": "生成一张边牧与古牧正在抖音直播间直播带货截图",
"images": [],
"aspectRatio": "1:1",
"imageSize":"1K",
"replyType": "json"
}'
返回响应
200 成功
200 异步生成返回结果
400 报错
application/json
Body application/json
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | string | 必需 | 任务id |
| status | string | 必需 | 状态 |
|
任务状态:
|
|||
| progress | integer | 可选 | 进度,0~100 |
| results | array [object] | 可选 | |
| url | string | 可选 | 图片/视频链接 |
| error | string | 可选 | 报错信息 |
示例
{
"id": "14-5f3cf761-a4bb-486a-8016-77f490998f80",
"status": "succeeded",
"results": [
{
"url": "https://file1.aitohumanize.com/file/fcdd2d07449d438d9d69d450f5626976.png"
}
]
}
gpt-image-2接口
POST
https://{base_url}/v1/api/generate
请求参数
Path 参数
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| base_url | string | 必需 |
Header 参数
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| Authorization | string | 可选 |
示例: Bearer sk-xxxxxxxxxxx
|
Body 参数 application/json 必填
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| model | string | 必需 | 模型名称 |
|
支持以下模型:
|
|||
| prompt | string | 必需 | 提示词 |
| images | array[string] | 可选 | 参考图,支持base64与url链接 |
| aspectRatio | string | 可选 | 比例 |
|
分辨率参数说明 gpt-image-2:支持比例(如 "16:9")或1K像素值(如 "1024x1024") gpt-image-2-vip:支持1-4K像素值(如 "1024x1024"、"2048x2048"),不支持比例 自定义像素值约束(仅限 vip 模型) 最大边长必须小于或等于3840px 两条边都必须是16的倍数 长边与短边之比不得超过 3:1 总像素数必须至少为 655,360且不得超过 8,294,400
|
|||
| replyType | string | 可选 | 回复类型 |
|
支持参数:
|
|||
示例
JSON
"model": "gpt-image-2",
"prompt": "生成一张边牧与古牧正在抖音直播间直播带货截图",
"images": [],
"aspectRatio": "1024x1024",
"replyType": "json" }
请求示例代码
cURL
cURL-Windows
Httpie
wget
PowerShell
curl --location 'https://v1/api/generate' \
--header 'Authorization: Bearer sk-xxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2",
"prompt": "生成一张边牧与古牧正在抖音直播间直播带货截图",
"images": [],
"aspectRatio": "1024x1024",
"replyType": "json"
}'
返回响应
200 成功
200 异步生成返回结果
400 报错
application/json
Body application/json
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | string | 必需 | 任务id |
| status | string | 必需 | 状态 |
|
任务状态:
|
|||
| progress | integer | 可选 | 进度,0~100 |
| results | array [object] | 可选 | |
| url | string | 可选 | 图片/视频链接 |
| error | string | 可选 | 报错信息 |
示例
{
"id": "14-5f3cf761-a4bb-486a-8016-77f490998f80",
"status": "succeeded",
"results": [
{
"url": "https://file1.aitohumanize.com/file/fcdd2d07449d438d9d69d450f5626976.png"
}
]
}
异步生成结果查询接口
GET
https://{base_url}/v1/api/result
请求参数
Path 参数
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| base_url | string | 必需 |
Query 参数
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | string | 可选 |
示例: 1-6634fd9a-3086-4d92-9436-69e86fd23bf8
|
Header 参数
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| Authorization | string | 可选 |
示例: Bearer sk-xxxxxxxxxxx
|
请求示例代码
cURL
cURL-Windows
Httpie
wget
PowerShell
curl --location 'https://v1/api/result?id=1-6634fd9a-3086-4d92-9436-69e86fd23bf8' \
--header 'Authorization: Bearer sk-xxxxxxxxxxx'
返回响应
200 成功
400 报错
application/json
Body application/json
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | string | 必需 | 任务id |
| status | string | 必需 | 状态 |
|
任务状态:
|
|||
| progress | integer | 可选 | 进度,0~100 |
| results | array [object] | 可选 | |
| url | string | 可选 | 图片/视频链接 |
| error | string | 可选 | 报错信息 |
示例
{
"id": "14-5f3cf761-a4bb-486a-8016-77f490998f80",
"status": "succeeded",
"results": [
{
"url": "https://file1.aitohumanize.com/file/fcdd2d07449d438d9d69d450f5626976.png"
}
]
}