Nano Banana Edit 图片编辑
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/nano-banana-edit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"image_urls": [
"https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png"
],
"prompt": "turn this photo into a character figure. Behind it, place a box with the character's image printed on it",
"image_size": "1:1",
"output_format": "png"
}
EOFimport requests
url = "https://api.sinancode.com/v1/generate/k/nano-banana-edit"
payload = {
"image_urls": ["https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png"],
"prompt": "turn this photo into a character figure. Behind it, place a box with the character's image printed on it",
"image_size": "1:1",
"output_format": "png"
}
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({
image_urls: [
'https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png'
],
prompt: 'turn this photo into a character figure. Behind it, place a box with the character\'s image printed on it',
image_size: '1:1',
output_format: 'png'
})
};
fetch('https://api.sinancode.com/v1/generate/k/nano-banana-edit', 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.sinancode.com/v1/generate/k/nano-banana-edit",
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([
'image_urls' => [
'https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png'
],
'prompt' => 'turn this photo into a character figure. Behind it, place a box with the character\'s image printed on it',
'image_size' => '1:1',
'output_format' => 'png'
]),
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.sinancode.com/v1/generate/k/nano-banana-edit"
payload := strings.NewReader("{\n \"image_urls\": [\n \"https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png\"\n ],\n \"prompt\": \"turn this photo into a character figure. Behind it, place a box with the character's image printed on it\",\n \"image_size\": \"1:1\",\n \"output_format\": \"png\"\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.sinancode.com/v1/generate/k/nano-banana-edit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image_urls\": [\n \"https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png\"\n ],\n \"prompt\": \"turn this photo into a character figure. Behind it, place a box with the character's image printed on it\",\n \"image_size\": \"1:1\",\n \"output_format\": \"png\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/k/nano-banana-edit")
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 \"image_urls\": [\n \"https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png\"\n ],\n \"prompt\": \"turn this photo into a character figure. Behind it, place a box with the character's image printed on it\",\n \"image_size\": \"1:1\",\n \"output_format\": \"png\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}图片生成 - Nano Banana
Nano Banana 图片编辑
使用 Nano Banana Edit 模型编辑图片(异步)
POST
/
generate
/
k
/
nano-banana-edit
Nano Banana Edit 图片编辑
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/nano-banana-edit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"image_urls": [
"https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png"
],
"prompt": "turn this photo into a character figure. Behind it, place a box with the character's image printed on it",
"image_size": "1:1",
"output_format": "png"
}
EOFimport requests
url = "https://api.sinancode.com/v1/generate/k/nano-banana-edit"
payload = {
"image_urls": ["https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png"],
"prompt": "turn this photo into a character figure. Behind it, place a box with the character's image printed on it",
"image_size": "1:1",
"output_format": "png"
}
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({
image_urls: [
'https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png'
],
prompt: 'turn this photo into a character figure. Behind it, place a box with the character\'s image printed on it',
image_size: '1:1',
output_format: 'png'
})
};
fetch('https://api.sinancode.com/v1/generate/k/nano-banana-edit', 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.sinancode.com/v1/generate/k/nano-banana-edit",
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([
'image_urls' => [
'https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png'
],
'prompt' => 'turn this photo into a character figure. Behind it, place a box with the character\'s image printed on it',
'image_size' => '1:1',
'output_format' => 'png'
]),
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.sinancode.com/v1/generate/k/nano-banana-edit"
payload := strings.NewReader("{\n \"image_urls\": [\n \"https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png\"\n ],\n \"prompt\": \"turn this photo into a character figure. Behind it, place a box with the character's image printed on it\",\n \"image_size\": \"1:1\",\n \"output_format\": \"png\"\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.sinancode.com/v1/generate/k/nano-banana-edit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image_urls\": [\n \"https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png\"\n ],\n \"prompt\": \"turn this photo into a character figure. Behind it, place a box with the character's image printed on it\",\n \"image_size\": \"1:1\",\n \"output_format\": \"png\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/k/nano-banana-edit")
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 \"image_urls\": [\n \"https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png\"\n ],\n \"prompt\": \"turn this photo into a character figure. Behind it, place a box with the character's image printed on it\",\n \"image_size\": \"1:1\",\n \"output_format\": \"png\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}使用 Google DeepMind 的 Nano Banana 模型进行图片编辑。
模型特点:
- 自然语言编辑 - 通过文本指令描述修改需求
- 局部修改 - 精准编辑图片特定区域
- 风格调整 - 支持调整图片风格和效果
- 快速处理 - 基于 Gemini 架构,编辑速度快
授权
请使用您的 API Token 进行认证
请求体
application/json
Task parameters
图片 URL 列表(必填)- 用于编辑的输入图片列表,最多10张
Required array length:
1 - 10 elements示例:
[
"https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png"
]
提示词(必填,最大5000字符)- 图片编辑的文本描述
Required string length:
1 - 5000示例:
"turn this photo into a character figure. Behind it, place a box with the character's image printed on it"
图片尺寸(可选,默认 1:1)- 图片宽高比
可用选项:
1:1, 9:16, 16:9, 3:4, 4:3, 3:2, 2:3, 5:4, 4:5, 21:9, auto 示例:
"1:1"
输出格式(可选)- 图片输出格式
可用选项:
png, jpeg 示例:
"png"
响应
OK
Task ID
示例:
"01234567-89ab-cdef-0123-456789abcdef"
⌘I