TL;DR
- Imagen 4 has three tiers: Fast (3–5s, cheapest), Standard (balanced), Ultra (highest quality, 20–45s).
- Connect through CodeGateway's OpenAI-compatible endpoint — same SDK, just change
base_url. - strong for: ultra-realistic photos and human portraits. Does not support transparent backgrounds or inpainting.
Imagen 4 Tier Specs
Tier | Model ID | Speed | Official price (approx.) |
|---|---|---|---|
Fast |
| 3–5s | $0.02/image |
Standard |
| 8–15s | $0.04/image |
Ultra |
| 20–45s | $0.08/image |
Source: Google Cloud Vertex AI documentation (May 2026). Check Google's pricing page for current rates.
CodeGateway adds a tier multiplier (1.2x–1.5x). See CodeGateway pricing tiers.
Quality Benchmark
In May 2026 internal testing, we ran the same prompt through all three Imagen 4 tiers and GPT-Image-2 (high quality):
Prompt: "An Asian female software engineer in a modern office, holding a coffee cup, code on her monitors, cinematic lighting, ultra-realistic photography style"
Model | Face naturalness | Detail richness | Skin texture | Lighting quality |
|---|---|---|---|---|
Imagen 4 Fast | Good | Medium | Smooth | Decent |
Imagen 4 Standard | Natural | High | Realistic | Good |
Imagen 4 Ultra | Exceptional, pore-level detail | Very high | Film-grade | Cinematic |
GPT-Image-2 high | Natural | High | Good | Good |
Takeaway: Imagen 4 Ultra wins on photorealism and face fidelity. GPT-Image-2 holds the lead on text rendering accuracy.
Python Quickstart
pip install openaifrom openai import OpenAI
# Imagen 4 via CodeGateway's OpenAI-compatible endpoint
client = OpenAI(
api_key="your-codegateway-api-key",
base_url="https://api.codegateway.dev/v1"
)
# Imagen 4 Standard — good default
response = client.images.generate(
model="imagen-4-0", # or "imagen-4-flash" / "imagen-4-ultra"
prompt="A modern city skyline wrapped in morning fog, ultra-realistic photography, golden hour light, 4K detail",
n=1,
size="1024x1024"
)
print(f"Image URL: {response.data[0].url}") # Valid ~60 minutesSave to disk
import base64
response = client.images.generate(
model="imagen-4-ultra",
prompt="A young engineer with glasses, intensely focused on three monitors, realistic office environment, natural light",
n=1,
size="1024x1024",
output_format="jpeg"
)
img_bytes = base64.b64decode(response.data[0].b64_json)
with open("output.jpg", "wb") as f:
f.write(img_bytes)aspectRatio Parameter
Imagen 4 supports aspect ratio control — a feature GPT-Image-2 lacks.
# Portrait (9:16) — mobile wallpapers, short video covers
response = client.images.generate(
model="imagen-4-0",
prompt="Cyberpunk city street, neon rain, vertical composition, cinematic",
n=1,
aspect_ratio="9:16"
)
# Landscape (16:9) — website banners, video thumbnails
response = client.images.generate(
model="imagen-4-0",
prompt="Minimalist white office, floor-to-ceiling windows, sunlight, commercial photography",
n=1,
aspect_ratio="16:9"
)Supported values: 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3.
Batch Generation
# Imagen 4 supports up to 4 images per request
response = client.images.generate(
model="imagen-4-0",
prompt="Professional API documentation screenshots, tech aesthetic, blue color scheme",
n=4,
size="1024x1024"
)
for i, img in enumerate(response.data):
print(f"Variant {i+1}: {img.url}")Tier Selection Guide
Use case | Recommended tier | Reason |
|---|---|---|
Draft validation, rapid iteration |
| Fastest, lowest cost |
General commercial images |
| Balanced speed and quality |
Final product photos, portrait photography |
| strong quality ceiling |
Images with readable text (logos, posters) | GPT-Image-2 | Better text rendering |
Transparent background output | GPT-Image-2 | Imagen 4 doesn't support it |
Editing an existing image | GPT-Image-2 | Imagen 4 doesn't support inpainting |
Cost Comparison (100 images/day, CodeGateway new user 1.5x)
Config | Official price | CodeGateway price | Monthly cost |
|---|---|---|---|
Imagen 4 Fast | $0.02/image | $0.030 | ~$90 |
Imagen 4 Standard | $0.04/image | $0.060 | ~$180 |
Imagen 4 Ultra | $0.08/image | $0.120 | ~$360 |
GPT-Image-2 medium | $0.042/image | $0.063 | ~$189 |
Imagen 4 Fast is the budget option for high-volume, lower-stakes generation. Ultra and GPT-Image-2 high are in similar price territory but serve different use cases (photorealism vs. text rendering).
FAQ
Q: English or non-English prompts for Imagen 4?
A: A: English prompts give more precise control over style, lighting, and composition descriptors. Other languages work, but key style terms in English tend to produce more predictable results.
Q: How long are generated image URLs valid?
A: A: Approximately 60 minutes. For durable storage, request b64_json format and save to your own object storage.
Q: How much slower is Ultra vs. Standard?
A: A: Ultra: 20–45s. Standard: 8–15s. Fast: 3–5s. For any user-facing real-time display, use Fast or Standard.
Q: How does Imagen 4 compare to Gemini's image generation?
A: A: Imagen 4 is a dedicated image generation API optimized for high-quality output. Gemini's image generation is integrated into a multimodal model, better suited for conversational "generate an image while we chat" scenarios. For dedicated image generation tasks, Imagen 4 is the right tool.
Q: Does CodeGateway support both Imagen 4 and GPT-Image-2?
A: A: Yes — both models work through the same CodeGateway API key and base_url. Switch between them by changing the model parameter.
Related
- Image API Comparison: Imagen, Gemini, and GPT-Image
- GPT-Image-2 API Quickstart
- CodeGateway Pricing Tiers
- CodeGateway Billing Guide
- Google Imagen Documentation
References
Anthropic multimodal docs · OpenAI image generation reference
