Gemini 3.1 Flash Image VIP 圖像生成
curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"n": 123,
"image_urls": [
{
"url": "<string>"
}
],
"metadata": {
"resolution": "<string>"
}
}
'import requests
url = "https://toapis.com/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"n": 123,
"image_urls": [{ "url": "<string>" }],
"metadata": { "resolution": "<string>" }
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
size: '<string>',
n: 123,
image_urls: [{url: '<string>'}],
metadata: {resolution: '<string>'}
})
};
fetch('https://toapis.com/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://toapis.com/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' => '<string>',
'prompt' => '<string>',
'size' => '<string>',
'n' => 123,
'image_urls' => [
[
'url' => '<string>'
]
],
'metadata' => [
'resolution' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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://toapis.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"n\": 123,\n \"image_urls\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {\n \"resolution\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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://toapis.com/v1/images/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"n\": 123,\n \"image_urls\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {\n \"resolution\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://toapis.com/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"n\": 123,\n \"image_urls\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {\n \"resolution\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_bodyGemini-3.1-Flash-Image VIP
Gemini 3.1 Flash Image VIP 圖像生成
Gemini 3.1 Flash Image VIP 支持文生圖和圖生圖, 最多 14 張參考圖.
POST
/
v1
/
images
/
generations
Gemini 3.1 Flash Image VIP 圖像生成
curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"n": 123,
"image_urls": [
{
"url": "<string>"
}
],
"metadata": {
"resolution": "<string>"
}
}
'import requests
url = "https://toapis.com/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"n": 123,
"image_urls": [{ "url": "<string>" }],
"metadata": { "resolution": "<string>" }
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
size: '<string>',
n: 123,
image_urls: [{url: '<string>'}],
metadata: {resolution: '<string>'}
})
};
fetch('https://toapis.com/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://toapis.com/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' => '<string>',
'prompt' => '<string>',
'size' => '<string>',
'n' => 123,
'image_urls' => [
[
'url' => '<string>'
]
],
'metadata' => [
'resolution' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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://toapis.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"n\": 123,\n \"image_urls\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {\n \"resolution\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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://toapis.com/v1/images/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"n\": 123,\n \"image_urls\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {\n \"resolution\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://toapis.com/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"n\": 123,\n \"image_urls\": [\n {\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {\n \"resolution\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body中國大陸用戶請注意: 中國大陸用戶請使用
https://toapis.cn 作為接口地址(Base URL)。文檔示例中的 https://toapis.com 請替換為 https://toapis.cn。版本選擇
參考圖數量指輸入圖片總數, 不代表輸出圖片數量. 三個版本使用不同的模型 ID, 請按對應頁面的參數和示例調用.當前版本
使用model: "gemini-3.1-flash-image-preview-vip" 選擇 VIP, 支持文生圖和最多 14 張參考圖的圖生圖或圖像編輯.
適合需要 7 到 14 張參考圖的編輯或多圖組合. 多圖請求可按列表順序說明各張圖片的用途.
請求異步執行, 提交成功後通過任務 ID 查詢結果.
image_urls 僅支持圖片 URL, 不直接接收 base64. 請先使用 上傳圖片接口 獲取可訪問的 URL.認證
請求參數
string
預設值:"gemini-3.1-flash-image-preview-vip"
必填
固定使用
gemini-3.1-flash-image-preview-vip. 普通模型名和其他別名不會自動切換到本 VIP 路由.string
必填
描述需要生成或編輯的圖像. 傳入多張參考圖時, 可按列表順序說明各圖的用途.
string
圖像寬高比, 例如
1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9.integer
預設值:1
每次請求生成 1 張圖片. 使用數字
1, 不要使用字符串 "1".object[]
請求示例
curl --request POST 'https://toapis.com/v1/images/generations' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-3.1-flash-image-preview-vip",
"prompt": "保留第一張圖的人物, 採用第二張圖的背景和配色, 生成一張自然光肖像.",
"size": "1:1",
"n": 1,
"image_urls": [
{"url": "https://example.com/reference-1.png"},
{"url": "https://example.com/reference-2.png"}
],
"metadata": {"resolution": "1K"}
}'
image_urls, 並修改提示詞.
查詢結果
提交響應中的id 是任務 ID. 使用 圖片任務查詢接口 獲取狀態和最終圖片.
任務查詢和 Webhook 回調 沿用通用異步圖片接口約定.