Nano Banana 图片生成
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/nano-banana \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art",
"image_size": "1:1",
"output_format": "png"
}
'import requests
url = "https://api.sinancode.com/v1/generate/k/nano-banana"
payload = {
"prompt": "A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art",
"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({
prompt: 'A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art',
image_size: '1:1',
output_format: 'png'
})
};
fetch('https://api.sinancode.com/v1/generate/k/nano-banana', 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",
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([
'prompt' => 'A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art',
'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"
payload := strings.NewReader("{\n \"prompt\": \"A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art\",\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art\",\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")
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 \"prompt\": \"A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art\",\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 模型生成图片(异步)
POST
/
generate
/
k
/
nano-banana
Nano Banana 图片生成
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/nano-banana \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art",
"image_size": "1:1",
"output_format": "png"
}
'import requests
url = "https://api.sinancode.com/v1/generate/k/nano-banana"
payload = {
"prompt": "A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art",
"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({
prompt: 'A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art',
image_size: '1:1',
output_format: 'png'
})
};
fetch('https://api.sinancode.com/v1/generate/k/nano-banana', 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",
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([
'prompt' => 'A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art',
'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"
payload := strings.NewReader("{\n \"prompt\": \"A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art\",\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art\",\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")
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 \"prompt\": \"A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art\",\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 2.5 Flash) 模型从文本生成图片。
模型特点:
- 快速生成 - 基于 Gemini 2.5 Flash,生成速度快
- 高性价比 - 成本较低,适合批量生成场景
- 1K 分辨率 - 支持最高 1024x1024 像素输出
- 优秀理解力 - 继承 Gemini 的语义理解和推理能力
授权
请使用您的 API Token 进行认证
请求体
application/json
Task parameters
提示词(必填,最大5000字符)- 图片生成的文本描述
Required string length:
1 - 5000示例:
"A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art"
图片尺寸(可选,默认 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