图片生成
curl --request POST \
--url https://api.tikway.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gemini-3-pro-image",
"prompt": "Generate a photorealistic red apple on a rustic wooden table.",
"size": "1:1",
"quality": "standard"
}
'import requests
url = "https://api.tikway.ai/v1/images/generations"
payload = {
"model": "gemini-3-pro-image",
"prompt": "Generate a photorealistic red apple on a rustic wooden table.",
"size": "1:1",
"quality": "standard"
}
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: 'gemini-3-pro-image',
prompt: 'Generate a photorealistic red apple on a rustic wooden table.',
size: '1:1',
quality: 'standard'
})
};
fetch('https://api.tikway.ai/v1/images/generations', 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.tikway.ai/v1/images/generations",
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' => 'gemini-3-pro-image',
'prompt' => 'Generate a photorealistic red apple on a rustic wooden table.',
'size' => '1:1',
'quality' => 'standard'
]),
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.tikway.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"gemini-3-pro-image\",\n \"prompt\": \"Generate a photorealistic red apple on a rustic wooden table.\",\n \"size\": \"1:1\",\n \"quality\": \"standard\"\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.tikway.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gemini-3-pro-image\",\n \"prompt\": \"Generate a photorealistic red apple on a rustic wooden table.\",\n \"size\": \"1:1\",\n \"quality\": \"standard\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tikway.ai/v1/images/generations")
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\": \"gemini-3-pro-image\",\n \"prompt\": \"Generate a photorealistic red apple on a rustic wooden table.\",\n \"size\": \"1:1\",\n \"quality\": \"standard\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}Nano Banana
图片生成
统一 OpenAI 兼容入口。size 表示宽高比,quality 映射到 Gemini 的图片分辨率。
| 模型 | 输出分辨率 | 参考图 | 搜索与思考 |
|---|---|---|---|
gemini-3.1-flash-image | 512px、1K、2K、4K;支持 1:4/4:1/1:8/8:1 极端比例 | 最多 14 张(最多 10 个对象 + 4 个角色) | google_search、image_search、thinking_level |
gemini-3-pro-image | 1K、2K、4K | 最多 14 张(最多 6 个对象 + 5 个角色 + 3 个风格) | google_search、thinking_level;不支持图片搜索 |
gemini-2.5-flash-image | 固定 1K | 建议最多 3 张 | 不支持 Google Search、图片搜索和思考 |
此入口不接受原生 generationConfig、aspect_ratio 或 image_size,请使用 size 和 quality。
POST
https://api.tikway.ai
/
v1
/
images
/
generations
图片生成
curl --request POST \
--url https://api.tikway.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gemini-3-pro-image",
"prompt": "Generate a photorealistic red apple on a rustic wooden table.",
"size": "1:1",
"quality": "standard"
}
'import requests
url = "https://api.tikway.ai/v1/images/generations"
payload = {
"model": "gemini-3-pro-image",
"prompt": "Generate a photorealistic red apple on a rustic wooden table.",
"size": "1:1",
"quality": "standard"
}
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: 'gemini-3-pro-image',
prompt: 'Generate a photorealistic red apple on a rustic wooden table.',
size: '1:1',
quality: 'standard'
})
};
fetch('https://api.tikway.ai/v1/images/generations', 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.tikway.ai/v1/images/generations",
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' => 'gemini-3-pro-image',
'prompt' => 'Generate a photorealistic red apple on a rustic wooden table.',
'size' => '1:1',
'quality' => 'standard'
]),
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.tikway.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"gemini-3-pro-image\",\n \"prompt\": \"Generate a photorealistic red apple on a rustic wooden table.\",\n \"size\": \"1:1\",\n \"quality\": \"standard\"\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.tikway.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gemini-3-pro-image\",\n \"prompt\": \"Generate a photorealistic red apple on a rustic wooden table.\",\n \"size\": \"1:1\",\n \"quality\": \"standard\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tikway.ai/v1/images/generations")
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\": \"gemini-3-pro-image\",\n \"prompt\": \"Generate a photorealistic red apple on a rustic wooden table.\",\n \"size\": \"1:1\",\n \"quality\": \"standard\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}授权
请求体
application/json
响应
200 - application/json
GPT Image 模型的 token 用量。
Hide child attributes
Hide child attributes

