Image Generation API
Guide to FastRouter's OpenAI-compatible Image Generation endpoint, including SDK and direct API examples in Python, Curl, and JavaScript for seamless LLM interactions.
Introduction
FastRouter allows you to generate high-quality images using an OpenAI-compatible Image Generation endpoint, supporting models from OpenAI and Google. You can create images in multiple sizes, formats, and quality levels — all while benefiting from FastRouter’s unified API layer and no vendor lock-in.
FastRouter supports:
Native Image Generation API for OpenAI models (
openai/gpt-image-1,openai/gpt-image-1-mini,openai/dall-e-2,openai/dall-e-3)Image generation via Chat Completions for Google’s Gemini Nano Banana (
google/gemini-2.5-flash-image) including aspect ratio support
Before getting started, replace placeholders like <FASTROUTER_API_KEY> with your actual API key found in your dashboard (see Keys & Settings).
Endpoint
POST https://go.fastrouter.ai/api/v1/images/generationsBase URL
https://go.fastrouter.ai/api/v1Supported Models
OpenAI Image Models (via Image Generation API)
openai/gpt-image-1openai/gpt-image-1-miniopenai/dall-e-2openai/dall-e-3
Google Image Models (via Chat Completion API)
google/gemini-2.5-flash-image(Nano Banana)
Note: Nano Banana supports image generation only through the Chat Completions API and includes support for custom aspect ratios.
Parameters (Image Generation Endpoint)
n
integer or null
Optional
1
1–10
Only n = 1 is supported for dall-e-3.
output_format
string or null
Optional
png
png, jpeg, webp
Only supported for gpt-image-1 and openai/gpt-image-1-mini
quality
string or null
Optional
auto
auto, high, medium, low, hd, standard
gpt-image-1and gpt-image-1-mini: auto/high/medium/low
dall-e-3: auto/hd/standard
dall-e-2: standard only
size
string or null
Optional
auto
See model support
gpt-image-1 and gpt-image-1-mini auto, 1024×1024, 1536×1024, 1024×1536
dall-e-2: 256×256, 512×512, 1024×1024
dall-e-3: 1024×1024, 1792×1024, 1024×1792
background
string or null
Optional
auto
transparent, opaque, auto
Only for gpt-image-1 and gpt-image-1-miniTransparent requires png/webp.
OpenAI-Compatible Image Request Format
FastRouter follows the same schema as OpenAI’s Image Generation API.
Calling FastRouter Directly (No SDK)
Image Generation via Google Gemini Nano Banana (using Chat Completions Endpoint)
FastRouter supports google/gemini-2.5-flash-image — also known as Nano Banana — through the Chat Completions API.
Nano Banana supports:
High-quality image generation
Custom aspect ratios
Flexible prompt inputs using Chat-style messages
Nano Banana Chat Completion Example
Supported Aspect Ratios (Nano Banana)
1:1
1024×1024
1290
2:3
832×1248
1290
3:2
1248×832
1290
3:4
864×1184
1290
4:3
1184×864
1290
4:5
896×1152
1290
5:4
1152×896
1290
9:16
768×1344
1290
16:9
1344×768
1290
21:9
1536×672
1290
Key Takeaway
FastRouter’s Image Generation features give you:
OpenAI-compatible Image API
Support for OpenAI’s latest image models
Google Gemini Nano Banana via Chat Completions
Custom aspect ratios
Unified API + zero vendor lock-in
Last updated