curl --request POST \
--url https://api.ttapi.org/gemini/image/generate \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"prompt": "<string>",
"model": "gemini-3-pro-image-preview",
"refer_images": [
"https://cdn.ttapi.io/xxx1.png",
"https://cdn.ttapi.io/xxx2.png"
],
"aspect_ratio": "1:1",
"image_size": "1K",
"google_search": "false",
"image_search": "false"
}
'import requests
url = "https://api.ttapi.org/gemini/image/generate"
payload = {
"prompt": "<string>",
"model": "gemini-3-pro-image-preview",
"refer_images": ["https://cdn.ttapi.io/xxx1.png", "https://cdn.ttapi.io/xxx2.png"],
"aspect_ratio": "1:1",
"image_size": "1K",
"google_search": "false",
"image_search": "false"
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
model: 'gemini-3-pro-image-preview',
refer_images: ['https://cdn.ttapi.io/xxx1.png', 'https://cdn.ttapi.io/xxx2.png'],
aspect_ratio: '1:1',
image_size: '1K',
google_search: 'false',
image_search: 'false'
})
};
fetch('https://api.ttapi.org/gemini/image/generate', 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.ttapi.org/gemini/image/generate",
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' => '<string>',
'model' => 'gemini-3-pro-image-preview',
'refer_images' => [
'https://cdn.ttapi.io/xxx1.png',
'https://cdn.ttapi.io/xxx2.png'
],
'aspect_ratio' => '1:1',
'image_size' => '1K',
'google_search' => 'false',
'image_search' => 'false'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-API-KEY: <api-key>"
],
]);
$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.ttapi.org/gemini/image/generate"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model\": \"gemini-3-pro-image-preview\",\n \"refer_images\": [\n \"https://cdn.ttapi.io/xxx1.png\",\n \"https://cdn.ttapi.io/xxx2.png\"\n ],\n \"aspect_ratio\": \"1:1\",\n \"image_size\": \"1K\",\n \"google_search\": \"false\",\n \"image_search\": \"false\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-API-KEY", "<api-key>")
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.ttapi.org/gemini/image/generate")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model\": \"gemini-3-pro-image-preview\",\n \"refer_images\": [\n \"https://cdn.ttapi.io/xxx1.png\",\n \"https://cdn.ttapi.io/xxx2.png\"\n ],\n \"aspect_ratio\": \"1:1\",\n \"image_size\": \"1K\",\n \"google_search\": \"false\",\n \"image_search\": \"false\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.org/gemini/image/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"model\": \"gemini-3-pro-image-preview\",\n \"refer_images\": [\n \"https://cdn.ttapi.io/xxx1.png\",\n \"https://cdn.ttapi.io/xxx2.png\"\n ],\n \"aspect_ratio\": \"1:1\",\n \"image_size\": \"1K\",\n \"google_search\": \"false\",\n \"image_search\": \"false\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"prompt": "a cute cat",
"refer_images": null,
"image_url": "https://cdn.ttapi.io/other/2025-09-10/8b46aa28-4433-455f-bf5c-f5ccea48baf2.png",
"quota": 2
}
}{
"status": "FAILED",
"message": "\"prompt\" cannot be empty.",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}Nano Banana Image Generation API | Nano Banana, Nano Banana 2, Nano Banana Pro
Generate images with the Nano Banana API using Nano Banana, Nano Banana 2, Nano Banana 2 Lite, Nano Banana 2.1, and Nano Banana Pro, including official Gemini model names such as gemini-2.5-flash-image, gemini-3-pro-image-preview, gemini-3.1-flash-image, gemini-3.1-flash-lite-image, and gemini-nano-banana-2.1.
curl --request POST \
--url https://api.ttapi.org/gemini/image/generate \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"prompt": "<string>",
"model": "gemini-3-pro-image-preview",
"refer_images": [
"https://cdn.ttapi.io/xxx1.png",
"https://cdn.ttapi.io/xxx2.png"
],
"aspect_ratio": "1:1",
"image_size": "1K",
"google_search": "false",
"image_search": "false"
}
'import requests
url = "https://api.ttapi.org/gemini/image/generate"
payload = {
"prompt": "<string>",
"model": "gemini-3-pro-image-preview",
"refer_images": ["https://cdn.ttapi.io/xxx1.png", "https://cdn.ttapi.io/xxx2.png"],
"aspect_ratio": "1:1",
"image_size": "1K",
"google_search": "false",
"image_search": "false"
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
model: 'gemini-3-pro-image-preview',
refer_images: ['https://cdn.ttapi.io/xxx1.png', 'https://cdn.ttapi.io/xxx2.png'],
aspect_ratio: '1:1',
image_size: '1K',
google_search: 'false',
image_search: 'false'
})
};
fetch('https://api.ttapi.org/gemini/image/generate', 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.ttapi.org/gemini/image/generate",
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' => '<string>',
'model' => 'gemini-3-pro-image-preview',
'refer_images' => [
'https://cdn.ttapi.io/xxx1.png',
'https://cdn.ttapi.io/xxx2.png'
],
'aspect_ratio' => '1:1',
'image_size' => '1K',
'google_search' => 'false',
'image_search' => 'false'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-API-KEY: <api-key>"
],
]);
$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.ttapi.org/gemini/image/generate"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model\": \"gemini-3-pro-image-preview\",\n \"refer_images\": [\n \"https://cdn.ttapi.io/xxx1.png\",\n \"https://cdn.ttapi.io/xxx2.png\"\n ],\n \"aspect_ratio\": \"1:1\",\n \"image_size\": \"1K\",\n \"google_search\": \"false\",\n \"image_search\": \"false\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-API-KEY", "<api-key>")
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.ttapi.org/gemini/image/generate")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model\": \"gemini-3-pro-image-preview\",\n \"refer_images\": [\n \"https://cdn.ttapi.io/xxx1.png\",\n \"https://cdn.ttapi.io/xxx2.png\"\n ],\n \"aspect_ratio\": \"1:1\",\n \"image_size\": \"1K\",\n \"google_search\": \"false\",\n \"image_search\": \"false\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.org/gemini/image/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"model\": \"gemini-3-pro-image-preview\",\n \"refer_images\": [\n \"https://cdn.ttapi.io/xxx1.png\",\n \"https://cdn.ttapi.io/xxx2.png\"\n ],\n \"aspect_ratio\": \"1:1\",\n \"image_size\": \"1K\",\n \"google_search\": \"false\",\n \"image_search\": \"false\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"message": "success",
"data": {
"prompt": "a cute cat",
"refer_images": null,
"image_url": "https://cdn.ttapi.io/other/2025-09-10/8b46aa28-4433-455f-bf5c-f5ccea48baf2.png",
"quota": 2
}
}{
"status": "FAILED",
"message": "\"prompt\" cannot be empty.",
"data": {}
}{
"status": "FAILED",
"message": "Wrong TT-API-KEY or email is not activated."
}Available Models
| Model | Alias |
|---|---|
gemini-2.5-flash-image | Nano Banana |
gemini-3-pro-image-preview | Nano Banana Pro |
gemini-3.1-flash-image | Nano Banana 2 |
gemini-3.1-flash-lite-image | Nano Banana 2 Lite |
gemini-nano-banana-2.1 | Nano Banana 2.1 |
Authorizations
You can obtain your API key from the TTAPI Dashboard.
Body
Image description for generation or modification
Model version
gemini-2.5-flash-image, gemini-3-pro-image-preview, gemini-3.1-flash-image, gemini-3.1-flash-lite-image, gemini-nano-banana-2.1 List of reference images
[
"https://cdn.ttapi.io/xxx1.png",
"https://cdn.ttapi.io/xxx2.png"
]
Image aspect ratio: Only supported by Gemini 3 and later models.
The aspect ratios 1:4, 4:1, 1:8, and 8:1 are supported by the gemini-3.1-flash-image, gemini-3.1-flash-lite-image, and gemini-nano-banana-2.1 models.
1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:4, 4:1, 1:8, 8:1 Image resolution. The 512px image size parameter is only supported by the gemini-3.1-flash-image model.
512px, 1K, 2K, 4K Whether to enable Google web search
Whether to enable Google image search
Thinking level. Supported values and defaults by model:
gemini-nano-banana-2.1:Minimal,Medium,High, defaultMediumgemini-3.1-flash-image:Minimal,High, defaultMinimalgemini-3.1-flash-lite-image:Minimal,High, defaultMinimal
Minimal, Medium, High