Model Docs

模型调用文档

按模型逐个写清楚。每一块只解释一个模型,不把不同模型的参数混在一起。

所有接口统一使用 X-API-Key 传完整密钥,不要额外加Bearer 前缀。

sora_studiosora_fastveoveo_fastveo_referencegpt-image-2nanobananananobanana_pro
sora_studiosora_studio

Sora Studio

Sora Studio 调用说明

平台托管的 Sora 异步视频任务接口。POST 只负责创建任务,不会同步返回视频;文生不传 image_url,图生传 image_url。

推荐场景

广告片产品演示图生视频品牌短片

查询接口

GET /api/v1/aa/sora/tasks/{task_id}

Parameters

认证方式

HTTP Header

Sora OpenAPI 的密钥不是写在 body 里,而是写在请求头里。

X-API-Keystring必填

把你在控制台创建出来的 API Key 明文放在这个请求头里,例如 aa_live_xxx。

Content-Typestring必填默认 application/json

创建任务时使用 JSON 请求体。

Parameters

创建任务参数

POST /api/v1/aa/openapi/sora/tasks

这条接口直接返回任务对象,后续再轮询任务状态。

promptstring必填

视频提示词。长度 3-4000。

model_codestring可选默认 sora_studio

Sora 模型代码。当前这两个代码共用同一套请求参数。

sora_studio
image_urlstring可选

参考图 URL。不传就是文生视频,传了就是图生视频。

reference_image_namestring可选

参考图文件名,仅用于展示和记录。

Parameters

查询结果字段说明

GET /api/v1/aa/sora/tasks/{task_id}

查询接口没有请求体,带上 X-API-Key 和 task_id 即可。下面这些字段都是响应里会出现的内容。

task_idstring必填

任务 ID。创建成功后返回,查询任务时就用这个值。

statusstring必填

任务状态。queued 是刚创建,processing 是处理中,completed 是已完成,failed / refunded 是失败或已退款。

queuedprocessingcompletedfailedrefunded
progressinteger必填

任务进度百分比。只是进度值,不等于结果文件一定已经可取。

image_urlstring | null必填

你创建任务时传入的参考图地址。纯文生视频时这里就是 null。

reference_image_urlstring | null必填

当前实现里它和 image_url 是同一个值,只是为了让响应语义更明确。没传参考图时也是 null。

reference_image_namestring | null必填

你创建任务时传入的参考图文件名。没传就返回 null。

video_urlstring | null必填

最终视频地址。任务没完成前通常是 null,完成后才会有值。

error_messagestring | null必填

失败原因。成功或处理中通常是 null,失败时才会有值。

completed_atdatetime | null必填

完成时间。任务还没结束时是 null,完成或失败后才会写入。

查询说明

这是异步任务接口。POST 只创建任务并返回 task_id,不会同步返回视频文件。

创建成功后用 task_id 轮询。

查询接口没有 body,路径参数只有 task_id。

查询接口支持 X-API-Key,也支持 Bearer 登录态;如果你是外部程序接入,直接继续用 X-API-Key 即可。

状态流转:queued -> processing -> completed / failed / refunded。

processing 阶段即使 progress=100,也可能暂时还没有 video_url,应继续轮询。

补充说明

最推荐的调用方式:所有 Sora 请求都统一在 Header 里带 X-API-Key。

密钥位置就是 HTTP Header,不是在 URL 里,也不是在 JSON body 里。

文生视频: 只传 prompt;图生视频: 传 prompt + image_url。reference_image_name 只是记录文件名,不影响生成。

当前只开放 prompt、image_url、reference_image_name 这几个实际参数。

响应里大量 null 不是多传了参数,而是“当前这个字段暂时还没有值”。

当前 image_url 和 reference_image_url 在后端里是同一个值,不是两张不同图片。

不支持 temperature、top_p、frequency_penalty、presence_penalty 等高级采样参数。

时间字段使用服务器本地时间。

POST/api/v1/aa/openapi/sora/tasks

文生视频

Sora Studio 最小请求示例。API Key 写在请求头 X-API-Key 里。

Auth: X-API-Key: aa_xxx

Request Body
{
  "prompt": "A cinematic street food scene at night, warm lights, handheld camera movement",
  "model_code": "sora_studio"
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "prompt": "A cinematic street food scene at night, warm lights, handheld camera movement",
  "model_code": "sora_studio"
}

response = requests.post(
    f"{BASE_URL}/api/v1/aa/openapi/sora/tasks",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "task_202604150001_abc12345",
  "model_code": "sora_studio",
  "status": "queued",
  "progress": 0,
  "prompt": "A cinematic street food scene at night, warm lights, handheld camera movement",
  "image_url": null,
  "reference_image_url": null,
  "reference_image_name": null,
  "video_url": null,
  "has_reference_image": false,
  "has_video": false,
  "error_message": null,
  "price_usd": 0.65,
  "refunded_usd": 0.0,
  "created_at": "2026-04-15T00:01:00",
  "completed_at": null
}
POST/api/v1/aa/openapi/sora/tasks

图生视频

带参考图的视频任务。API Key 同样写在请求头 X-API-Key 里。

Auth: X-API-Key: aa_xxx

Request Body
{
  "prompt": "Turn this reference image into a luxury perfume ad video with slow dolly-in and floating particles",
  "model_code": "sora_studio",
  "image_url": "https://example.com/reference.jpg",
  "reference_image_name": "product-reference.jpg"
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "prompt": "Turn this reference image into a luxury perfume ad video with slow dolly-in and floating particles",
  "model_code": "sora_studio",
  "image_url": "https://example.com/reference.jpg",
  "reference_image_name": "product-reference.jpg"
}

response = requests.post(
    f"{BASE_URL}/api/v1/aa/openapi/sora/tasks",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "task_202604150001_abc12345",
  "model_code": "sora_studio",
  "status": "queued",
  "progress": 0,
  "prompt": "A cinematic street food scene at night, warm lights, handheld camera movement",
  "image_url": null,
  "reference_image_url": null,
  "reference_image_name": null,
  "video_url": null,
  "has_reference_image": false,
  "has_video": false,
  "error_message": null,
  "price_usd": 0.65,
  "refunded_usd": 0.0,
  "created_at": "2026-04-15T00:01:00",
  "completed_at": null
}
GET/api/v1/aa/sora/tasks/task_202604150001_abc12345

查询任务

任务状态轮询示例。最简单还是继续带 X-API-Key,不需要 body。

Auth: X-API-Key: aa_xxx

Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
}

response = requests.get(
    f"{BASE_URL}/api/v1/aa/sora/tasks/task_202604150001_abc12345",
    headers=headers,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "task_202604150001_abc12345",
  "model_code": "sora_studio",
  "status": "processing",
  "progress": 36,
  "prompt": "A cinematic street food scene at night, warm lights, handheld camera movement",
  "image_url": null,
  "reference_image_url": null,
  "reference_image_name": null,
  "video_url": null,
  "has_reference_image": false,
  "has_video": false,
  "error_message": null,
  "price_usd": 0.65,
  "refunded_usd": 0.0,
  "created_at": "2026-04-15T00:01:00",
  "completed_at": null
}
sora_fastsora_fast

Sora Fast

Sora Fast 调用说明

Sora 的轻量型号展示入口。当前与 sora_studio 一样,都是异步任务接口:POST 只创建任务,不会同步返回视频;文生不传 image_url,图生传 image_url。

推荐场景

广告片产品演示图生视频品牌短片

查询接口

GET /api/v1/aa/sora/tasks/{task_id}

Parameters

认证方式

HTTP Header

Sora OpenAPI 的密钥不是写在 body 里,而是写在请求头里。

X-API-Keystring必填

把你在控制台创建出来的 API Key 明文放在这个请求头里,例如 aa_live_xxx。

Content-Typestring必填默认 application/json

创建任务时使用 JSON 请求体。

Parameters

创建任务参数

POST /api/v1/aa/openapi/sora/tasks

这条接口直接返回任务对象,后续再轮询任务状态。

promptstring必填

视频提示词。长度 3-4000。

model_codestring可选默认 sora_fast

Sora 模型代码。当前这两个代码共用同一套请求参数。

sora_fast
image_urlstring可选

参考图 URL。不传就是文生视频,传了就是图生视频。

reference_image_namestring可选

参考图文件名,仅用于展示和记录。

Parameters

查询结果字段说明

GET /api/v1/aa/sora/tasks/{task_id}

查询接口没有请求体,带上 X-API-Key 和 task_id 即可。下面这些字段都是响应里会出现的内容。

task_idstring必填

任务 ID。创建成功后返回,查询任务时就用这个值。

statusstring必填

任务状态。queued 是刚创建,processing 是处理中,completed 是已完成,failed / refunded 是失败或已退款。

queuedprocessingcompletedfailedrefunded
progressinteger必填

任务进度百分比。只是进度值,不等于结果文件一定已经可取。

image_urlstring | null必填

你创建任务时传入的参考图地址。纯文生视频时这里就是 null。

reference_image_urlstring | null必填

当前实现里它和 image_url 是同一个值,只是为了让响应语义更明确。没传参考图时也是 null。

reference_image_namestring | null必填

你创建任务时传入的参考图文件名。没传就返回 null。

video_urlstring | null必填

最终视频地址。任务没完成前通常是 null,完成后才会有值。

error_messagestring | null必填

失败原因。成功或处理中通常是 null,失败时才会有值。

completed_atdatetime | null必填

完成时间。任务还没结束时是 null,完成或失败后才会写入。

查询说明

这是异步任务接口。POST 只创建任务并返回 task_id,不会同步返回视频文件。

创建成功后用 task_id 轮询。

查询接口没有 body,路径参数只有 task_id。

查询接口支持 X-API-Key,也支持 Bearer 登录态;如果你是外部程序接入,直接继续用 X-API-Key 即可。

状态流转:queued -> processing -> completed / failed / refunded。

processing 阶段即使 progress=100,也可能暂时还没有 video_url,应继续轮询。

补充说明

最推荐的调用方式:所有 Sora 请求都统一在 Header 里带 X-API-Key。

密钥位置就是 HTTP Header,不是在 URL 里,也不是在 JSON body 里。

文生视频: 只传 prompt;图生视频: 传 prompt + image_url。reference_image_name 只是记录文件名,不影响生成。

当前只开放 prompt、image_url、reference_image_name 这几个实际参数。

响应里大量 null 不是多传了参数,而是“当前这个字段暂时还没有值”。

当前 image_url 和 reference_image_url 在后端里是同一个值,不是两张不同图片。

当前参数和 sora_studio 相同,当前也映射同一上游模型。

时间字段使用服务器本地时间。

POST/api/v1/aa/openapi/sora/tasks

文生视频

Sora Fast 最小请求示例。API Key 写在请求头 X-API-Key 里。

Auth: X-API-Key: aa_xxx

Request Body
{
  "prompt": "A cinematic street food scene at night, warm lights, handheld camera movement",
  "model_code": "sora_fast"
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "prompt": "A cinematic street food scene at night, warm lights, handheld camera movement",
  "model_code": "sora_fast"
}

response = requests.post(
    f"{BASE_URL}/api/v1/aa/openapi/sora/tasks",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "task_202604150001_abc12345",
  "model_code": "sora_fast",
  "status": "queued",
  "progress": 0,
  "prompt": "A cinematic street food scene at night, warm lights, handheld camera movement",
  "image_url": null,
  "reference_image_url": null,
  "reference_image_name": null,
  "video_url": null,
  "has_reference_image": false,
  "has_video": false,
  "error_message": null,
  "price_usd": 0.65,
  "refunded_usd": 0.0,
  "created_at": "2026-04-15T00:01:00",
  "completed_at": null
}
POST/api/v1/aa/openapi/sora/tasks

图生视频

带参考图的视频任务。API Key 同样写在请求头 X-API-Key 里。

Auth: X-API-Key: aa_xxx

Request Body
{
  "prompt": "Turn this reference image into a luxury perfume ad video with slow dolly-in and floating particles",
  "model_code": "sora_fast",
  "image_url": "https://example.com/reference.jpg",
  "reference_image_name": "product-reference.jpg"
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "prompt": "Turn this reference image into a luxury perfume ad video with slow dolly-in and floating particles",
  "model_code": "sora_fast",
  "image_url": "https://example.com/reference.jpg",
  "reference_image_name": "product-reference.jpg"
}

response = requests.post(
    f"{BASE_URL}/api/v1/aa/openapi/sora/tasks",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "task_202604150001_abc12345",
  "model_code": "sora_fast",
  "status": "queued",
  "progress": 0,
  "prompt": "A cinematic street food scene at night, warm lights, handheld camera movement",
  "image_url": null,
  "reference_image_url": null,
  "reference_image_name": null,
  "video_url": null,
  "has_reference_image": false,
  "has_video": false,
  "error_message": null,
  "price_usd": 0.65,
  "refunded_usd": 0.0,
  "created_at": "2026-04-15T00:01:00",
  "completed_at": null
}
GET/api/v1/aa/sora/tasks/task_202604150001_abc12345

查询任务

任务状态轮询示例。最简单还是继续带 X-API-Key,不需要 body。

Auth: X-API-Key: aa_xxx

Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
}

response = requests.get(
    f"{BASE_URL}/api/v1/aa/sora/tasks/task_202604150001_abc12345",
    headers=headers,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "task_202604150001_abc12345",
  "model_code": "sora_fast",
  "status": "processing",
  "progress": 36,
  "prompt": "A cinematic street food scene at night, warm lights, handheld camera movement",
  "image_url": null,
  "reference_image_url": null,
  "reference_image_name": null,
  "video_url": null,
  "has_reference_image": false,
  "has_video": false,
  "error_message": null,
  "price_usd": 0.65,
  "refunded_usd": 0.0,
  "created_at": "2026-04-15T00:01:00",
  "completed_at": null
}
veoveo

Veo 3.1

Veo 3.1 调用说明

标准质量版视频模型,适合正式成片和要求较高的镜头表现。

推荐场景

正式成片品牌氛围短片高质量文生视频

查询接口

GET /v1/tasks/{task_id}

Parameters

创建视频任务参数

POST /v1/chat/completions

视频模型统一走 chat/completions。非流式返回任务对象,流式返回 SSE。

modelstring必填

固定使用 veo。

veo
streamboolean可选默认 false

false 返回任务对象;true 返回 SSE 事件流。

truefalse
messagesarray必填

至少 1 条 user 消息,最多 20 条。

messages[].rolestring必填

当前只会读取 user 消息中的文本和图片。

user
messages[].contentstring | array必填

文生视频可直接传字符串;参考图视频传 text + image_url 数组。

messages[].content[].typestring可选

多模态模式下的内容类型。

textimage_url
messages[].content[].textstring可选

至少需要一段用户文本提示词。

messages[].content[].image_url.urlstring可选

参考图 URL。最多支持 2 张。

aspect_ratiostring可选默认 16:9

仅短别名 veo / veo_fast 支持通过这个参数切换横版或竖版。

16:99:16

查询说明

创建成功后用 task_id 轮询。

状态流转:queued -> running -> succeeded / failed / refunded。

完成时返回 video_url,失败时返回 error_code 和 error_message。

veo 和 veo_fast 短别名可通过 aspect_ratio 在 16:9 和 9:16 之间切换。

补充说明

鉴权使用 X-API-Key。

messages 中至少要有一段用户文本。

最多支持 2 张参考图;标准版和 Fast 版通常用于纯文本视频。

时间字段使用服务器本地时间。

POST/v1/chat/completions

创建任务

Veo 3.1 最小请求示例。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "veo",
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": "Aerial shot flying through a futuristic city at sunrise, cinematic light, smooth camera motion"
    }
  ],
  "aspect_ratio": "16:9"
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "veo",
  "stream": False,
  "messages": [
    {
      "role": "user",
      "content": "Aerial shot flying through a futuristic city at sunrise, cinematic light, smooth camera motion"
    }
  ],
  "aspect_ratio": "16:9"
}

response = requests.post(
    f"{BASE_URL}/v1/chat/completions",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "evt_20260415_abcd1234",
  "object": "video.task",
  "created": 1776182400,
  "model": "veo",
  "task": {
    "task_id": "evt_20260415_abcd1234",
    "status": "queued",
    "model": "veo",
    "prompt": "Aerial shot flying through a futuristic city at sunrise, cinematic light, smooth camera motion",
    "progress": 0,
    "created_at": "2026-04-15T00:00:00",
    "updated_at": "2026-04-15T00:00:00",
    "finished_at": null,
    "image_url": null,
    "video_url": null,
    "result_image_url": null,
    "expires_in": null,
    "error_code": null,
    "error_message": null
  }
}
GET/v1/tasks/evt_20260415_abcd1234

查询任务

任务状态轮询示例。

Auth: X-API-Key: aa_xxx

Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
}

response = requests.get(
    f"{BASE_URL}/v1/tasks/evt_20260415_abcd1234",
    headers=headers,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "evt_20260415_abcd1234",
  "status": "running",
  "model": "veo",
  "prompt": "Aerial shot flying through a futuristic city at sunrise, cinematic light, smooth camera motion",
  "progress": 58,
  "created_at": "2026-04-15T00:00:00",
  "updated_at": "2026-04-15T00:01:12",
  "finished_at": null,
  "image_url": null,
  "video_url": null,
  "result_image_url": null,
  "expires_in": null,
  "error_code": null,
  "error_message": null
}
veo_fastveo_fastveo_3_fast

Veo 3.1 Fast

Veo 3.1 Fast 调用说明

速度优先的视频模型,适合快速试错、预览和提案。

推荐场景

快速试错预览片提案演示

查询接口

GET /v1/tasks/{task_id}

Parameters

创建视频任务参数

POST /v1/chat/completions

视频模型统一走 chat/completions。非流式返回任务对象,流式返回 SSE。

modelstring必填

固定使用 veo_fast。

veo_fast
streamboolean可选默认 false

false 返回任务对象;true 返回 SSE 事件流。

truefalse
messagesarray必填

至少 1 条 user 消息,最多 20 条。

messages[].rolestring必填

当前只会读取 user 消息中的文本和图片。

user
messages[].contentstring | array必填

文生视频可直接传字符串;参考图视频传 text + image_url 数组。

messages[].content[].typestring可选

多模态模式下的内容类型。

textimage_url
messages[].content[].textstring可选

至少需要一段用户文本提示词。

messages[].content[].image_url.urlstring可选

参考图 URL。最多支持 2 张。

aspect_ratiostring可选默认 16:9

仅短别名 veo / veo_fast 支持通过这个参数切换横版或竖版。

16:99:16

查询说明

创建成功后用 task_id 轮询。

状态流转:queued -> running -> succeeded / failed / refunded。

完成时返回 video_url,失败时返回 error_code 和 error_message。

veo 和 veo_fast 短别名可通过 aspect_ratio 在 16:9 和 9:16 之间切换。

补充说明

鉴权使用 X-API-Key。

messages 中至少要有一段用户文本。

最多支持 2 张参考图;标准版和 Fast 版通常用于纯文本视频。

时间字段使用服务器本地时间。

历史别名

veo_3_fast
POST/v1/chat/completions

创建任务

Veo 3.1 Fast 最小请求示例。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "veo_fast",
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": "Aerial shot flying through a futuristic city at sunrise, cinematic light, smooth camera motion"
    }
  ],
  "aspect_ratio": "16:9"
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "veo_fast",
  "stream": False,
  "messages": [
    {
      "role": "user",
      "content": "Aerial shot flying through a futuristic city at sunrise, cinematic light, smooth camera motion"
    }
  ],
  "aspect_ratio": "16:9"
}

response = requests.post(
    f"{BASE_URL}/v1/chat/completions",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "evt_20260415_abcd1234",
  "object": "video.task",
  "created": 1776182400,
  "model": "veo_fast",
  "task": {
    "task_id": "evt_20260415_abcd1234",
    "status": "queued",
    "model": "veo_fast",
    "prompt": "Aerial shot flying through a futuristic city at sunrise, cinematic light, smooth camera motion",
    "progress": 0,
    "created_at": "2026-04-15T00:00:00",
    "updated_at": "2026-04-15T00:00:00",
    "finished_at": null,
    "image_url": null,
    "video_url": null,
    "result_image_url": null,
    "expires_in": null,
    "error_code": null,
    "error_message": null
  }
}
GET/v1/tasks/evt_20260415_abcd1234

查询任务

任务状态轮询示例。

Auth: X-API-Key: aa_xxx

Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
}

response = requests.get(
    f"{BASE_URL}/v1/tasks/evt_20260415_abcd1234",
    headers=headers,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "evt_20260415_abcd1234",
  "status": "running",
  "model": "veo_fast",
  "prompt": "Aerial shot flying through a futuristic city at sunrise, cinematic light, smooth camera motion",
  "progress": 58,
  "created_at": "2026-04-15T00:00:00",
  "updated_at": "2026-04-15T00:01:12",
  "finished_at": null,
  "image_url": null,
  "video_url": null,
  "result_image_url": null,
  "expires_in": null,
  "error_code": null,
  "error_message": null
}
veo_referenceveo_referenceveo_ref

Veo 3.1 Reference

Veo 3.1 Reference 调用说明

参考图驱动的视频模型,适合主体延续、产品一致性和风格继承。

推荐场景

角色一致性产品演示参考图视频

查询接口

GET /v1/tasks/{task_id}

Parameters

创建视频任务参数

POST /v1/chat/completions

视频模型统一走 chat/completions。非流式返回任务对象,流式返回 SSE。

modelstring必填

固定使用 veo_reference。

veo_reference
streamboolean可选默认 false

false 返回任务对象;true 返回 SSE 事件流。

truefalse
messagesarray必填

至少 1 条 user 消息,最多 20 条。

messages[].rolestring必填

当前只会读取 user 消息中的文本和图片。

user
messages[].contentstring | array必填

文生视频可直接传字符串;参考图视频传 text + image_url 数组。

messages[].content[].typestring可选

多模态模式下的内容类型。

textimage_url
messages[].content[].textstring可选

至少需要一段用户文本提示词。

messages[].content[].image_url.urlstring可选

参考图 URL。最多支持 2 张。

查询说明

创建成功后用 task_id 轮询。

状态流转:queued -> running -> succeeded / failed / refunded。

完成时返回 video_url,失败时返回 error_code 和 error_message。

veo_reference 短别名默认映射到参考图版 16:9 型号;如果你要指定 9:16,请直接传完整 firefly-veo31-ref-* 型号。

补充说明

鉴权使用 X-API-Key。

messages 中至少要有一段用户文本。

参考图版建议至少传 1 张 image_url;不传图片也能创建请求,但就失去参考图版的意义。

时间字段使用服务器本地时间。

历史别名

veo_ref
POST/v1/chat/completions

创建任务

Veo 3.1 Reference 最小请求示例。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "veo_reference",
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Create a premium product launch video based on these references, keep the bottle shape and gold cap consistent"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/ref-1.jpg"
          }
        }
      ]
    }
  ]
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "veo_reference",
  "stream": False,
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Create a premium product launch video based on these references, keep the bottle shape and gold cap consistent"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/ref-1.jpg"
          }
        }
      ]
    }
  ]
}

response = requests.post(
    f"{BASE_URL}/v1/chat/completions",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "evt_20260415_abcd1234",
  "object": "video.task",
  "created": 1776182400,
  "model": "veo_reference",
  "task": {
    "task_id": "evt_20260415_abcd1234",
    "status": "queued",
    "model": "veo_reference",
    "prompt": "Aerial shot flying through a futuristic city at sunrise, cinematic light, smooth camera motion",
    "progress": 0,
    "created_at": "2026-04-15T00:00:00",
    "updated_at": "2026-04-15T00:00:00",
    "finished_at": null,
    "image_url": null,
    "video_url": null,
    "result_image_url": null,
    "expires_in": null,
    "error_code": null,
    "error_message": null
  }
}
GET/v1/tasks/evt_20260415_abcd1234

查询任务

任务状态轮询示例。

Auth: X-API-Key: aa_xxx

Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
}

response = requests.get(
    f"{BASE_URL}/v1/tasks/evt_20260415_abcd1234",
    headers=headers,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "evt_20260415_abcd1234",
  "status": "running",
  "model": "veo_reference",
  "prompt": "Aerial shot flying through a futuristic city at sunrise, cinematic light, smooth camera motion",
  "progress": 58,
  "created_at": "2026-04-15T00:00:00",
  "updated_at": "2026-04-15T00:01:12",
  "finished_at": null,
  "image_url": null,
  "video_url": null,
  "result_image_url": null,
  "expires_in": null,
  "error_code": null,
  "error_message": null
}
gpt-image-2gpt-image-2

GPT Image 2

GPT Image 2 调用说明

GPT 图片模型统一通过 chat/completions 调用。AA 服务会拉取上游图片、转存到 OSS,再把可访问图片地址返回给调用方。

推荐场景

品牌视觉概念图海报 KV自然语言直出

查询接口

无异步任务接口

Parameters

文生图 / 参考图编辑参数

POST /v1/chat/completions

建议直接把画幅要求写进提示词,例如 16:9、1:1。返回 chat completion 结构,图片链接已是 AA OSS 地址。

modelstring必填

固定使用 gpt-image-2。

gpt-image-2
messagesarray必填

至少 1 条 user 消息,最多 20 条。

messages[].content[].typestring必填

多模态内容类型。

textimage_url
messages[].content[].textstring必填

改图指令。至少需要一段用户文本。

messages[].content[].image_url.urlstring可选

参考图 URL。当前最多支持 6 张。

aspect_ratio / size / qualitystring可选

GPT Image 2 当前不建议依赖这些额外规格参数;优先把画幅和风格要求直接写进提示词。

查询说明

当前返回 chat completion 结构,不返回 task_id。

图片已由 AA 服务转存到 OSS,拿到 content 中的链接即可直接展示或下载。

补充说明

鉴权使用 X-API-Key。

至少需要一条 user 文本消息。

如需多图参考,可在 messages[].content 中继续追加 image_url 项。

建议将 16:9、1:1、海报、写实、插画等约束直接写入提示词。

POST/v1/chat/completions

基础文生图

最简单的 GPT 图片生成调用。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "gpt-image-2",
  "messages": [
    {
      "role": "user",
      "content": "Create a clean 16:9 product hero image of a ceramic cup on a wooden table with soft daylight."
    }
  ]
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "gpt-image-2",
  "messages": [
    {
      "role": "user",
      "content": "Create a clean 16:9 product hero image of a ceramic cup on a wooden table with soft daylight."
    }
  ]
}

response = requests.post(
    f"{BASE_URL}/v1/chat/completions",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "chatcmpl_123",
  "object": "chat.completion",
  "created": 1776182400,
  "model": "gpt-image-2",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "![Generated Image](https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo-edit.png)"
      },
      "finish_reason": "stop"
    }
  ]
}
POST/v1/chat/completions

带参考图编辑

支持 1-6 张参考图,结果图片链接由 AA OSS 托管。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "gpt-image-2",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Keep the bottle shape unchanged and generate a premium 1:1 poster style product shot."
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/reference.png"
          }
        }
      ]
    }
  ]
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "gpt-image-2",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Keep the bottle shape unchanged and generate a premium 1:1 poster style product shot."
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/reference.png"
          }
        }
      ]
    }
  ]
}

response = requests.post(
    f"{BASE_URL}/v1/chat/completions",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "chatcmpl_123",
  "object": "chat.completion",
  "created": 1776182400,
  "model": "gpt-image-2",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "![Generated Image](https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo-edit.png)"
      },
      "finish_reason": "stop"
    }
  ]
}
nanobananananobanana

Nano Banana

Nano Banana 调用说明

标准图片模型,兼顾速度与质量,适合草图、商品图和日常创意出图。

推荐场景

草图出图商品图创意图

查询接口

GET /v1/tasks/{task_id}

Parameters

文生图参数

POST /v1/images/generations

同步模式直接返回图片 URL;异步模式返回 task_id。

modelstring必填

固定使用 nanobanana。

nanobanana
promptstring必填

生成提示词。长度 1-4000。

aspect_ratiostring可选默认 16:9

输出画幅。若未传且也未传 size,则默认按 16:9 处理。也兼容传 4x3 / 16x9 这种写法。

1:116:99:164:33:4
sizestring可选

可替代 aspect_ratio 使用,服务端会按 size 推断画幅。若误传成 4:3 / 16:9 这类画幅字符串,服务端也会自动兼容。

1024x10241536x15362048x20481024x17921536x27521792x10242752x15362048x15361536x2048
qualitystring可选默认 2k

输出分辨率档位。Nano Banana 和 Nano Banana Pro 这里的规则完全一样:1k -> 1k,2k -> 2k,4k -> 4k,hd -> 2k,ultra -> 4k;不传时默认 2k。

1k2k4khdultra
resolution_presetstring可选

ComfyUI 风格兼容字段,等价于 quality。优先用它来表达分辨率档位时,服务端会自动映射到 quality。

1K2K4Khdultra
image1 / image2 / image3 / images[]string | array可选

统一图片入口支持直接传 1-6 张参考图。带参考图时仍然调用 POST /v1/images/generations,服务端内部会自动切换到编辑链路。

num_imagesinteger可选默认 1

当前只支持输出 1 张图片。传其他值会直接报错。

1
asyncboolean可选默认 false

true 时返回任务对象,需要再轮询 /v1/tasks/{task_id}。

truefalse

Parameters

带参考图编辑参数

POST /v1/chat/completions

适合改图、延展和多模态编辑。这里不会返回 task_id,而是直接返回 chat completion 结构。

modelstring必填

固定使用 nanobanana。

nanobanana
messagesarray必填

至少 1 条 user 消息,最多 20 条。

messages[].content[].typestring必填

多模态内容类型。

textimage_url
messages[].content[].textstring必填

改图指令。至少需要一段用户文本。

messages[].content[].image_url.urlstring可选

参考图 URL。当前最多支持 6 张。

aspect_ratio / size / qualitystring可选

和 images/generations 一致,会决定最终规格。quality 的分辨率映射同样是:1k -> 1k,2k -> 2k,4k -> 4k,hd -> 2k,ultra -> 4k。

查询说明

只有 images/generations 在 async=true 时才需要轮询这个接口。

状态流转:queued -> running -> succeeded / failed / refunded。

完成时返回 result_image_url。

补充说明

鉴权使用 X-API-Key。

aspect_ratio 支持 1:1 / 16:9 / 9:16 / 4:3 / 3:4。

quality 在 Nano Banana 和 Nano Banana Pro 中完全一致,都是 1k / 2k / 4k / hd / ultra,默认 2k。

quality 的实际分辨率映射是:1k -> 1k,2k -> 2k,4k -> 4k,hd -> 2k,ultra -> 4k。

chat/completions 图片编辑最多支持 6 张参考图,适合风格融合、多角度参考等场景。

POST/v1/images/generations

同步文生图

直接等待图片生成完成。quality 会映射到最终分辨率:1k -> 1k,2k -> 2k,4k -> 4k,hd -> 2k,ultra -> 4k。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "nanobanana",
  "prompt": "Minimal luxury skincare product shot on travertine, warm daylight, premium packaging",
  "aspect_ratio": "1:1",
  "quality": "2k"
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "nanobanana",
  "prompt": "Minimal luxury skincare product shot on travertine, warm daylight, premium packaging",
  "aspect_ratio": "1:1",
  "quality": "2k"
}

response = requests.post(
    f"{BASE_URL}/v1/images/generations",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "created": 1776182400,
  "model": "nanobanana",
  "data": [
    {
      "url": "https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo.png"
    }
  ]
}
POST/v1/images/generations

节点风格参考图生成

兼容 ComfyUI 节点风格的统一入口。外部仍调 images/generations,服务端会自动处理参考图和参数映射。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "gemini-2.5-flash-image",
  "prompt": "Keep the product shape unchanged, switch the background to a clean beige studio and add soft shadows",
  "image1": "https://example.com/reference-1.png",
  "image2": "https://example.com/reference-2.png",
  "resolution_preset": "4K",
  "aspect_ratio": "4:3",
  "num_images": 1
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "gemini-2.5-flash-image",
  "prompt": "Keep the product shape unchanged, switch the background to a clean beige studio and add soft shadows",
  "image1": "https://example.com/reference-1.png",
  "image2": "https://example.com/reference-2.png",
  "resolution_preset": "4K",
  "aspect_ratio": "4:3",
  "num_images": 1
}

response = requests.post(
    f"{BASE_URL}/v1/images/generations",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "created": 1776182400,
  "model": "nanobanana",
  "data": [
    {
      "url": "https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo.png"
    }
  ]
}
POST/v1/images/generations

异步文生图

批量并发建议使用 async=true。quality 的分辨率映射和同步模式完全一致。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "nanobanana",
  "prompt": "Minimal luxury skincare product shot on travertine, warm daylight, premium packaging",
  "aspect_ratio": "1:1",
  "quality": "2k",
  "async": true
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "nanobanana",
  "prompt": "Minimal luxury skincare product shot on travertine, warm daylight, premium packaging",
  "aspect_ratio": "1:1",
  "quality": "2k",
  "async": True
}

response = requests.post(
    f"{BASE_URL}/v1/images/generations",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "evt_20260415_img1234",
  "object": "video.task",
  "created": 1776182400,
  "model": "nanobanana",
  "task": {
    "task_id": "evt_20260415_img1234",
    "status": "queued",
    "progress": 0,
    "result_image_url": null
  }
}
POST/v1/chat/completions

参考图编辑

改图与延展示例。这里的 quality 分辨率映射和文生图完全一致:1k -> 1k,2k -> 2k,4k -> 4k,hd -> 2k,ultra -> 4k。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "nanobanana",
  "quality": "2k",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Keep the product shape unchanged, switch the background to a clean beige studio and add soft shadows"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/reference.png"
          }
        }
      ]
    }
  ]
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "nanobanana",
  "quality": "2k",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Keep the product shape unchanged, switch the background to a clean beige studio and add soft shadows"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/reference.png"
          }
        }
      ]
    }
  ]
}

response = requests.post(
    f"{BASE_URL}/v1/chat/completions",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "chatcmpl_123",
  "object": "chat.completion",
  "created": 1776182400,
  "model": "nanobanana",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "![Generated Image](https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo-edit.png)"
      },
      "finish_reason": "stop"
    }
  ]
}
POST/v1/chat/completions

多张参考图融合

最多支持 6 张参考图,适合风格融合、多角度产品展示等场景。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "nanobanana",
  "quality": "4k",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Combine the product from image 1, the background style from image 2, and the lighting from image 3 to create a premium product shot"
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/product.png" }
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/background-style.png" }
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/lighting-ref.png" }
        }
      ]
    }
  ]
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "nanobanana",
  "quality": "4k",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Combine the product from image 1, the background style from image 2, and the lighting from image 3 to create a premium product shot"
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/product.png" }
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/background-style.png" }
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/lighting-ref.png" }
        }
      ]
    }
  ]
}

response = requests.post(
    f"{BASE_URL}/v1/chat/completions",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "chatcmpl_123",
  "object": "chat.completion",
  "created": 1776182400,
  "model": "nanobanana",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "![Generated Image](https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo-edit.png)"
      },
      "finish_reason": "stop"
    }
  ]
}
GET/v1/tasks/evt_20260415_img1234

查询异步任务

async=true 时的轮询示例。

Auth: X-API-Key: aa_xxx

Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
}

response = requests.get(
    f"{BASE_URL}/v1/tasks/evt_20260415_img1234",
    headers=headers,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "evt_20260415_img1234",
  "status": "succeeded",
  "model": "nanobanana",
  "prompt": "Minimal luxury skincare product shot on travertine",
  "progress": 100,
  "created_at": "2026-04-15T00:00:00",
  "updated_at": "2026-04-15T00:00:08",
  "finished_at": "2026-04-15T00:00:08",
  "image_url": null,
  "video_url": null,
  "result_image_url": "https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo.png",
  "expires_in": 86400,
  "error_code": null,
  "error_message": null
}
nanobanana_pronanobanana_pro

Nano Banana Pro

Nano Banana Pro 调用说明

高清版图片模型,适合商业 KV、电商主图、封面和更细致的画面控制。

推荐场景

商业 KV电商主图海报封面高质感出图

查询接口

GET /v1/tasks/{task_id}

Parameters

文生图参数

POST /v1/images/generations

同步模式直接返回图片 URL;异步模式返回 task_id。

modelstring必填

固定使用 nanobanana_pro。

nanobanana_pro
promptstring必填

生成提示词。长度 1-4000。

aspect_ratiostring可选默认 16:9

输出画幅。若未传且也未传 size,则默认按 16:9 处理。也兼容传 4x3 / 16x9 这种写法。

1:116:99:164:33:4
sizestring可选

可替代 aspect_ratio 使用,服务端会按 size 推断画幅。若误传成 4:3 / 16:9 这类画幅字符串,服务端也会自动兼容。

1024x10241536x15362048x20481024x17921536x27521792x10242752x15362048x15361536x2048
qualitystring可选默认 2k

输出分辨率档位。Nano Banana 和 Nano Banana Pro 这里的规则完全一样:1k -> 1k,2k -> 2k,4k -> 4k,hd -> 2k,ultra -> 4k;不传时默认 2k。

1k2k4khdultra
resolution_presetstring可选

ComfyUI 风格兼容字段,等价于 quality。优先用它来表达分辨率档位时,服务端会自动映射到 quality。

1K2K4Khdultra
image1 / image2 / image3 / images[]string | array可选

统一图片入口支持直接传 1-6 张参考图。带参考图时仍然调用 POST /v1/images/generations,服务端内部会自动切换到编辑链路。

num_imagesinteger可选默认 1

当前只支持输出 1 张图片。传其他值会直接报错。

1
asyncboolean可选默认 false

true 时返回任务对象,需要再轮询 /v1/tasks/{task_id}。

truefalse

Parameters

带参考图编辑参数

POST /v1/chat/completions

适合改图、延展和多模态编辑。这里不会返回 task_id,而是直接返回 chat completion 结构。

modelstring必填

固定使用 nanobanana_pro。

nanobanana_pro
messagesarray必填

至少 1 条 user 消息,最多 20 条。

messages[].content[].typestring必填

多模态内容类型。

textimage_url
messages[].content[].textstring必填

改图指令。至少需要一段用户文本。

messages[].content[].image_url.urlstring可选

参考图 URL。当前最多支持 6 张。

aspect_ratio / size / qualitystring可选

和 images/generations 一致,会决定最终规格。quality 的分辨率映射同样是:1k -> 1k,2k -> 2k,4k -> 4k,hd -> 2k,ultra -> 4k。

查询说明

只有 images/generations 在 async=true 时才需要轮询这个接口。

状态流转:queued -> running -> succeeded / failed / refunded。

完成时返回 result_image_url。

补充说明

鉴权使用 X-API-Key。

aspect_ratio 支持 1:1 / 16:9 / 9:16 / 4:3 / 3:4。

quality 在 Nano Banana 和 Nano Banana Pro 中完全一致,都是 1k / 2k / 4k / hd / ultra,默认 2k。

quality 的实际分辨率映射是:1k -> 1k,2k -> 2k,4k -> 4k,hd -> 2k,ultra -> 4k。

chat/completions 图片编辑最多支持 6 张参考图,适合风格融合、多角度参考等场景。

POST/v1/images/generations

同步文生图

直接等待图片生成完成。quality 会映射到最终分辨率:1k -> 1k,2k -> 2k,4k -> 4k,hd -> 2k,ultra -> 4k。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "nanobanana_pro",
  "prompt": "Minimal luxury skincare product shot on travertine, warm daylight, premium packaging",
  "aspect_ratio": "1:1",
  "quality": "2k"
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "nanobanana_pro",
  "prompt": "Minimal luxury skincare product shot on travertine, warm daylight, premium packaging",
  "aspect_ratio": "1:1",
  "quality": "2k"
}

response = requests.post(
    f"{BASE_URL}/v1/images/generations",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "created": 1776182400,
  "model": "nanobanana_pro",
  "data": [
    {
      "url": "https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo.png"
    }
  ]
}
POST/v1/images/generations

节点风格参考图生成

兼容 ComfyUI 节点风格的统一入口。外部仍调 images/generations,服务端会自动处理参考图和参数映射。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "gemini-3-pro-image-preview",
  "prompt": "Keep the product shape unchanged, switch the background to a clean beige studio and add soft shadows",
  "image1": "https://example.com/reference-1.png",
  "image2": "https://example.com/reference-2.png",
  "resolution_preset": "4K",
  "aspect_ratio": "4:3",
  "num_images": 1
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "gemini-3-pro-image-preview",
  "prompt": "Keep the product shape unchanged, switch the background to a clean beige studio and add soft shadows",
  "image1": "https://example.com/reference-1.png",
  "image2": "https://example.com/reference-2.png",
  "resolution_preset": "4K",
  "aspect_ratio": "4:3",
  "num_images": 1
}

response = requests.post(
    f"{BASE_URL}/v1/images/generations",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "created": 1776182400,
  "model": "nanobanana_pro",
  "data": [
    {
      "url": "https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo.png"
    }
  ]
}
POST/v1/images/generations

异步文生图

批量并发建议使用 async=true。quality 的分辨率映射和同步模式完全一致。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "nanobanana_pro",
  "prompt": "Minimal luxury skincare product shot on travertine, warm daylight, premium packaging",
  "aspect_ratio": "1:1",
  "quality": "2k",
  "async": true
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "nanobanana_pro",
  "prompt": "Minimal luxury skincare product shot on travertine, warm daylight, premium packaging",
  "aspect_ratio": "1:1",
  "quality": "2k",
  "async": True
}

response = requests.post(
    f"{BASE_URL}/v1/images/generations",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "evt_20260415_img1234",
  "object": "video.task",
  "created": 1776182400,
  "model": "nanobanana_pro",
  "task": {
    "task_id": "evt_20260415_img1234",
    "status": "queued",
    "progress": 0,
    "result_image_url": null
  }
}
POST/v1/chat/completions

参考图编辑

改图与延展示例。这里的 quality 分辨率映射和文生图完全一致:1k -> 1k,2k -> 2k,4k -> 4k,hd -> 2k,ultra -> 4k。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "nanobanana_pro",
  "quality": "2k",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Keep the product shape unchanged, switch the background to a clean beige studio and add soft shadows"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/reference.png"
          }
        }
      ]
    }
  ]
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "nanobanana_pro",
  "quality": "2k",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Keep the product shape unchanged, switch the background to a clean beige studio and add soft shadows"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/reference.png"
          }
        }
      ]
    }
  ]
}

response = requests.post(
    f"{BASE_URL}/v1/chat/completions",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "chatcmpl_123",
  "object": "chat.completion",
  "created": 1776182400,
  "model": "nanobanana_pro",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "![Generated Image](https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo-edit.png)"
      },
      "finish_reason": "stop"
    }
  ]
}
POST/v1/chat/completions

多张参考图融合

最多支持 6 张参考图,适合风格融合、多角度产品展示等场景。

Auth: X-API-Key: aa_xxx

Request Body
{
  "model": "nanobanana_pro",
  "quality": "4k",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Combine the product from image 1, the background style from image 2, and the lighting from image 3 to create a premium product shot"
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/product.png" }
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/background-style.png" }
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/lighting-ref.png" }
        }
      ]
    }
  ]
}
Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
  "model": "nanobanana_pro",
  "quality": "4k",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Combine the product from image 1, the background style from image 2, and the lighting from image 3 to create a premium product shot"
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/product.png" }
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/background-style.png" }
        },
        {
          "type": "image_url",
          "image_url": { "url": "https://example.com/lighting-ref.png" }
        }
      ]
    }
  ]
}

response = requests.post(
    f"{BASE_URL}/v1/chat/completions",
    headers=headers,
    json=payload,
)

response.raise_for_status()
print(response.json())
Response
{
  "id": "chatcmpl_123",
  "object": "chat.completion",
  "created": 1776182400,
  "model": "nanobanana_pro",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "![Generated Image](https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo-edit.png)"
      },
      "finish_reason": "stop"
    }
  ]
}
GET/v1/tasks/evt_20260415_img1234

查询异步任务

async=true 时的轮询示例。

Auth: X-API-Key: aa_xxx

Python Requests
import requests

BASE_URL = "http://localhost:8095"
API_KEY = "aa_live_xxxxx"

headers = {
    "X-API-Key": API_KEY,
}

response = requests.get(
    f"{BASE_URL}/v1/tasks/evt_20260415_img1234",
    headers=headers,
)

response.raise_for_status()
print(response.json())
Response
{
  "task_id": "evt_20260415_img1234",
  "status": "succeeded",
  "model": "nanobanana_pro",
  "prompt": "Minimal luxury skincare product shot on travertine",
  "progress": 100,
  "created_at": "2026-04-15T00:00:00",
  "updated_at": "2026-04-15T00:00:08",
  "finished_at": "2026-04-15T00:00:08",
  "image_url": null,
  "video_url": null,
  "result_image_url": "https://vv-agent.oss-cn-hangzhou.aliyuncs.com/generated/demo.png",
  "expires_in": 86400,
  "error_code": null,
  "error_message": null
}