提交 Nano Banana 2.1 图像编辑任务
curl --request POST \
--url https://api.vidgo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "google/nano-banana-2.1/edit",
"input": {
"prompt": "Preserve the product and replace the background with a warm modern studio.",
"image_urls": [
"https://cdn.vidgo.ai/temp/reference-product.png"
],
"size": "auto",
"resolution": "1K"
}
}
'import requests
url = "https://api.vidgo.ai/api/generate/submit"
payload = {
"model": "google/nano-banana-2.1/edit",
"input": {
"prompt": "Preserve the product and replace the background with a warm modern studio.",
"image_urls": ["https://cdn.vidgo.ai/temp/reference-product.png"],
"size": "auto",
"resolution": "1K"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'google/nano-banana-2.1/edit',
input: {
prompt: 'Preserve the product and replace the background with a warm modern studio.',
image_urls: ['https://cdn.vidgo.ai/temp/reference-product.png'],
size: 'auto',
resolution: '1K'
}
})
};
fetch('https://api.vidgo.ai/api/generate/submit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vidgo.ai/api/generate/submit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'google/nano-banana-2.1/edit',
'input' => [
'prompt' => 'Preserve the product and replace the background with a warm modern studio.',
'image_urls' => [
'https://cdn.vidgo.ai/temp/reference-product.png'
],
'size' => 'auto',
'resolution' => '1K'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.vidgo.ai/api/generate/submit"
payload := strings.NewReader("{\n \"model\": \"google/nano-banana-2.1/edit\",\n \"input\": {\n \"prompt\": \"Preserve the product and replace the background with a warm modern studio.\",\n \"image_urls\": [\n \"https://cdn.vidgo.ai/temp/reference-product.png\"\n ],\n \"size\": \"auto\",\n \"resolution\": \"1K\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.vidgo.ai/api/generate/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"google/nano-banana-2.1/edit\",\n \"input\": {\n \"prompt\": \"Preserve the product and replace the background with a warm modern studio.\",\n \"image_urls\": [\n \"https://cdn.vidgo.ai/temp/reference-product.png\"\n ],\n \"size\": \"auto\",\n \"resolution\": \"1K\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vidgo.ai/api/generate/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"google/nano-banana-2.1/edit\",\n \"input\": {\n \"prompt\": \"Preserve the product and replace the background with a warm modern studio.\",\n \"image_urls\": [\n \"https://cdn.vidgo.ai/temp/reference-product.png\"\n ],\n \"size\": \"auto\",\n \"resolution\": \"1K\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"task_id": "task-example-001",
"status": "running",
"created_time": "2026-10-09T10:30:00"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}Google
Nano Banana 2.1 图像编辑
Nano Banana 2.1 图像编辑 API 通过文字指令和参考图编辑一张图像。
POST
/
api
/
generate
/
submit
提交 Nano Banana 2.1 图像编辑任务
curl --request POST \
--url https://api.vidgo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "google/nano-banana-2.1/edit",
"input": {
"prompt": "Preserve the product and replace the background with a warm modern studio.",
"image_urls": [
"https://cdn.vidgo.ai/temp/reference-product.png"
],
"size": "auto",
"resolution": "1K"
}
}
'import requests
url = "https://api.vidgo.ai/api/generate/submit"
payload = {
"model": "google/nano-banana-2.1/edit",
"input": {
"prompt": "Preserve the product and replace the background with a warm modern studio.",
"image_urls": ["https://cdn.vidgo.ai/temp/reference-product.png"],
"size": "auto",
"resolution": "1K"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'google/nano-banana-2.1/edit',
input: {
prompt: 'Preserve the product and replace the background with a warm modern studio.',
image_urls: ['https://cdn.vidgo.ai/temp/reference-product.png'],
size: 'auto',
resolution: '1K'
}
})
};
fetch('https://api.vidgo.ai/api/generate/submit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vidgo.ai/api/generate/submit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'google/nano-banana-2.1/edit',
'input' => [
'prompt' => 'Preserve the product and replace the background with a warm modern studio.',
'image_urls' => [
'https://cdn.vidgo.ai/temp/reference-product.png'
],
'size' => 'auto',
'resolution' => '1K'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.vidgo.ai/api/generate/submit"
payload := strings.NewReader("{\n \"model\": \"google/nano-banana-2.1/edit\",\n \"input\": {\n \"prompt\": \"Preserve the product and replace the background with a warm modern studio.\",\n \"image_urls\": [\n \"https://cdn.vidgo.ai/temp/reference-product.png\"\n ],\n \"size\": \"auto\",\n \"resolution\": \"1K\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.vidgo.ai/api/generate/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"google/nano-banana-2.1/edit\",\n \"input\": {\n \"prompt\": \"Preserve the product and replace the background with a warm modern studio.\",\n \"image_urls\": [\n \"https://cdn.vidgo.ai/temp/reference-product.png\"\n ],\n \"size\": \"auto\",\n \"resolution\": \"1K\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vidgo.ai/api/generate/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"google/nano-banana-2.1/edit\",\n \"input\": {\n \"prompt\": \"Preserve the product and replace the background with a warm modern studio.\",\n \"image_urls\": [\n \"https://cdn.vidgo.ai/temp/reference-product.png\"\n ],\n \"size\": \"auto\",\n \"resolution\": \"1K\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"task_id": "task-example-001",
"status": "running",
"created_time": "2026-10-09T10:30:00"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"code": 400,
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}- 提交后会返回
task_id。如果提供了callback_url,当任务状态变为finished或failed时,系统会向callback_url发送 POST 请求。 - 无论是否提供
callback_url,都可以通过统一的查询任务状态接口获取结果。
可选参数
size(string):输出宽高比。auto 跟随参考图。可选值:auto、1:1、2:3、3:2、3:4、4:3、4:5、5:4、9:16、16:9、21:9。默认:auto。resolution(string):输出分辨率档位。可选值:1K、2K、4K。默认:1K。
使用指南
使用 Nano Banana 2.1,通过文字指令和参考图编辑一张图像。- 将
model设为google/nano-banana-2.1/edit。 model和可选的callback_url放在请求根级;工作流参数放在input内。- 每次请求生成一张图像。
- 如只需根据提示词生成,请使用文生图,并设置
model=google/nano-banana-2.1/text-to-image。
参数详情
prompt必填。提供非空文本,最多 20,000 个字符。image_urls必填,接受 1 到 10 个参考图 URL。使用公开可访问的 HTTP(S) URL,顺序与提示词中引用参考图的顺序一致。size默认auto。auto跟随参考图的宽高比。
计费
按输出图像计费,取决于resolution。在每个档位上,文生图和图像编辑的计费标准相同。
积分在提交时扣除,任务失败会退还。授权
使用 Authorization: Bearer VIDGO_API_KEY。
请求体
application/json