Google AI Studio
极速 预览版
Gemini 3.1 Flash Image Preview 🍌 (AI Studio)
Google AI Studio 面向速度与效率的图像生成预览模型,适合快速交互响应和高吞吐场景
Try itGoogle AI Studio
模型定位为速度与效率设计,适合快速交互响应与高吞吐图像生成
可用形态Standard / Batch
定价与规格
💰 定价
输入$0.25 / M tokens
输出$1.50 / M tokens
价格$60.00 / M image tokens
⚙️ 规格
Try itGoogle AI Studio
模型定位为速度与效率设计,适合快速交互响应与高吞吐图像生成
可用形态Standard / Batch
输入价格(Paid Tier)$0.25 / 1M tokens(文本/图像输入)
输出价格(Paid Tier)$1.50 / 1M tokens(文本与思维)
图像输出价格(Paid Tier)$60.00 / 1M tokens(约 0.5K:$0.045, 1K:$0.067, 2K:$0.101, 4K:$0.151 每张)
预览版说明预览模型在稳定前可能调整,且速率限制通常更严格
提供商Google AI Studio
API 调用示例
Python
from google import genai
from google.genai import types
from google.api_core.client_options import ClientOptions
client = genai.Client(
api_key="your-api-key",
client_options=ClientOptions(api_endpoint="https://api.xairouter.com")
)
resp = client.models.generate_content(
model="gemini-3.1-flash-image-preview",
contents="生成一张 1K 香蕉主题的极简海报,明亮黄白配色,平面设计风格",
config=types.GenerateContentConfig(
response_modalities=["IMAGE", "TEXT"],
image_config=types.ImageConfig(
aspect_ratio="1:1",
image_size="1K"
)
)
)
for part in resp.parts:
if image := part.as_image():
image.save("banana-poster.png")
elif part.text:
print(part.text)cURL
curl -X POST \
"https://api.xairouter.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
-H "x-goog-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"role": "user", "parts":[{"text":"Generate a 1K banana-themed minimalist poster in bright yellow and white"}]}],
"generationConfig": {
"responseModalities": ["IMAGE"],
"imageConfig": {"aspectRatio": "1:1", "imageSize": "1K"}
}
}'