gemini-3.1-flash-image
Google gemini-3.1-flash-image
Use gemini-3.1-flash-image with the compatible aiftopia API below. Prices and groups are synced from newapi.aiftopia.com/pricing when the documentation is built; account groups and availability are shown in the console.
#Pricing
List price
- Per request
- ¥0.055 / request
Price by groupUnit: ¥ / request, list price × group multiplier
| Group | Per request |
|---|---|
| default分组×1默认分组 | ¥0.055 |
| 绘图&视频分组×1需要绘图或视频选这个分组(按次调用,选1k/2k/4k、时长等参数都是一样的价格) | ¥0.055 |
Prices and groups synced at 2026-11-02.
#Image editing
POST
https://newapi.aiftopia.com/v1/images/generations#Request parameters
| Parameter | Type | Required | Default | Enum / Constraints | Description |
|---|---|---|---|---|---|
prompt | string | Yes | — | — | Text prompt describing the desired image generation or edit. |
image_urls | array | No | — | maxItems: 6 | Reference images for generation or multi-image editing, one per line, maximum 6. |
previous_request_id | string | No | — | — | request_id (it_...) of the immediately preceding image generation/edit owned by the same API key, enabling multi-turn editing. |
seed | integer | No | — | — | Random seed for reproducible generation. |
#Request example
curl -X POST "https://newapi.aiftopia.com/v1/images/generations" \
-H "Authorization: Bearer $FOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
}'import os
import requests
url = "https://newapi.aiftopia.com/v1/images/generations"
headers = {
"Authorization": "Bearer " + os.environ["FOXROUTER_API_KEY"],
"Content-Type": "application/json",
}
payload = """{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
}"""
response = requests.post(url, headers=headers, data=payload)
print(response.status_code)
print(response.text)const payload = {
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
};
const response = await fetch("https://newapi.aiftopia.com/v1/images/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FOXROUTER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status, await response.text());import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
}
""";
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("https://newapi.aiftopia.com/v1/images/generations"))
.header("Authorization", "Bearer " + System.getenv("FOXROUTER_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(builder.build(), HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}#Try it online
curl -X POST "https://newapi.aiftopia.com/v1/images/generations" \
-H "Authorization: Bearer $FOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"image_urls": [
"https://example.com/reference-1.png"
]
}'import os
import requests
url = "https://newapi.aiftopia.com/v1/images/generations"
headers = {
"Authorization": "Bearer " + os.environ["FOXROUTER_API_KEY"],
"Content-Type": "application/json",
}
payload = """{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"image_urls": [
"https://example.com/reference-1.png"
]
}"""
response = requests.post(url, headers=headers, data=payload)
print(response.status_code)
print(response.text)const payload = {
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"image_urls": [
"https://example.com/reference-1.png"
]
};
const response = await fetch("https://newapi.aiftopia.com/v1/images/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FOXROUTER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status, await response.text());import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"image_urls": [
"https://example.com/reference-1.png"
]
}
""";
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("https://newapi.aiftopia.com/v1/images/generations"))
.header("Authorization", "Bearer " + System.getenv("FOXROUTER_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(builder.build(), HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
#Image generation
POST
https://newapi.aiftopia.com/v1/images/generations#Request parameters
| Parameter | Type | Required | Default | Enum / Constraints | Description |
|---|---|---|---|---|---|
prompt | string | Yes | — | — | Text prompt describing the desired image generation or edit. |
aspect_ratio | string | No | "1:1" | 1:1 | 16:9 | 9:16 | 4:3 | 3:4 | 3:2 | 2:3 | 21:9 | Aspect ratio of the output image. |
image_size | string | No | "1K" | 1K | 2K | 4K | square_hd | landscape_16_9 | portrait_16_9 | Output resolution tier or preset alias, e.g. 1K, 2K, 4K, square_hd. |
seed | integer | No | — | — | Random seed for reproducible generation. |
#Request example
curl -X POST "https://newapi.aiftopia.com/v1/images/generations" \
-H "Authorization: Bearer $FOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
}'import os
import requests
url = "https://newapi.aiftopia.com/v1/images/generations"
headers = {
"Authorization": "Bearer " + os.environ["FOXROUTER_API_KEY"],
"Content-Type": "application/json",
}
payload = """{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
}"""
response = requests.post(url, headers=headers, data=payload)
print(response.status_code)
print(response.text)const payload = {
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
};
const response = await fetch("https://newapi.aiftopia.com/v1/images/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FOXROUTER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status, await response.text());import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
}
""";
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("https://newapi.aiftopia.com/v1/images/generations"))
.header("Authorization", "Bearer " + System.getenv("FOXROUTER_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(builder.build(), HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}#Try it online
curl -X POST "https://newapi.aiftopia.com/v1/images/generations" \
-H "Authorization: Bearer $FOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
}'import os
import requests
url = "https://newapi.aiftopia.com/v1/images/generations"
headers = {
"Authorization": "Bearer " + os.environ["FOXROUTER_API_KEY"],
"Content-Type": "application/json",
}
payload = """{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
}"""
response = requests.post(url, headers=headers, data=payload)
print(response.status_code)
print(response.text)const payload = {
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
};
const response = await fetch("https://newapi.aiftopia.com/v1/images/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FOXROUTER_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status, await response.text());import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"model": "gemini-3.1-flash-image",
"prompt": "A minimalist product poster of a ceramic vase, soft studio light.",
"aspect_ratio": "1:1",
"image_size": "1K"
}
""";
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create("https://newapi.aiftopia.com/v1/images/generations"))
.header("Authorization", "Bearer " + System.getenv("FOXROUTER_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(builder.build(), HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}