Google AI Studio
Fast Preview
Gemini 3.1 Flash Image Preview 🍌 (AI Studio)
Google AI Studio preview image generation model optimized for speed and efficiency, ideal for fast interactive responses and high throughput
Try itGoogle AI Studio
PositioningDesigned for speed and efficiency in interactive and high-throughput image generation
AvailabilityStandard / Batch
Pricing & Specs
💰 Pricing
Input$0.25 / M tokens
Output$1.50 / M tokens
Price$60.00 / M image tokens
⚙️ Specs
Try itGoogle AI Studio
PositioningDesigned for speed and efficiency in interactive and high-throughput image generation
AvailabilityStandard / Batch
Input Price (Paid Tier)$0.25 / 1M tokens (text/image)
Output Price (Paid Tier)$1.50 / 1M tokens (text and thinking)
Image Output Price (Paid Tier)$60.00 / 1M tokens (~$0.045 per 0.5K, $0.067 per 1K, $0.101 per 2K, $0.151 per 4K image)
Preview NoticePreview models may change before stabilizing and typically have stricter rate limits
ProviderGoogle AI Studio
API Examples
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="Generate a 1K banana-themed minimalist poster in bright yellow and white",
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"}
}
}'