Image Generation API Now Live: One Key, 5 Models, Pay-as-you-go
May 9, 2026
Image Generation API Now Live: One Key, 5 Models, Pay-as-you-go
TL;DR: Adding image generation to your app used to mean three setup hurdles: register with the provider, attach an international credit card, configure a service account. The night you wanted to ship code, you ended up stuck in IAM dashboards instead.
Today CodeGateway ships its image generation API. Your existing sk-cg- key now calls
5 upstream models
: Google Imagen 4 (fast / std / ultra), Google Gemini 2.5 Flash Image, OpenAI gpt-image-2 / 1.5. Fully OpenAI Images API compatible.
CodeGateway proxies both Google and OpenAI image generation upstreams behind a single /v1/images/generations endpoint. Wire-protocol fully OpenAI Images API compatible: any project that already uses the OpenAI SDK can switch by changing OPENAI_BASE_URL to https://api.codegateway.dev/v1 and the key to sk-cg-.... Nothing else changes.
5 models + real pricing
Model ID
Route
Pricing
Strengths
imagen-4.0-fast-generate-001
Vertex (Imagen)
$0.02/image
Speed, cost, photoreal/concept illustration
imagen-4.0-generate-001
Vertex (Imagen)
$0.04/image
Standard quality
imagen-4.0-ultra-generate-001
Vertex (Imagen)
$0.06/image
Premium quality
gemini-2.5-flash-image
Vertex (Gemini)
per-token (~$0.04–0.08/image)
Text rendering, infographic labels
gpt-image-2
OpenAI
$0.005–$0.211/image (quality × aspect)
UI / cartoon, native 16:9
gpt-image-1.5
OpenAI
$0.009–$0.200/image
Same idea, slightly weaker — useful as fallback
Prices reflect upstream public rates plus CodeGateway's tiered markup (1.5x starter, 1.2x floor). Full pricing: /pricing.
3-step integration example
Step 1: Sign up + get a key (~2 min)
Open https://www.codegateway.dev, sign up with email, Dashboard → API Keys → Create Key. No international card needed, new accounts get a $2 starter credit.
The core value here: with CodeGateway, "switch model" is one field change; "switch provider" is also one field change. No lock-in — that's the core engineering value of this launch.
Real receipt: 4 blog posts, 16 images dogfooded
Pre-launch, we used this API to generate 16 cover and body images for 4 of our own blog posts:
4 heroes via imagen-4.0-generate-001: $0.16
3 photoreal illustrations via imagen-4.0-fast-generate-001: $0.06
9 labeled infographics via gemini-2.5-flash-image: $0.54
4 16:9-horizontal hero regenerations via gpt-image-2 medium: $0.164
The full generation script is open-sourced at Whitedit/code-gateway-cookbook — generate.py + spec-example.yaml, MIT licensed, copy and adapt.
FAQ
Q: One CodeGateway key really calls all 5 upstream models?
A: Yes. The gateway routes by the model field in the request body — imagen-* / gemini-* go through the Vertex AI route; gpt-image-* goes through OpenAI. Client code doesn't change.
Q: Who owns the generated image's copyright?
A: You do. Both Google and OpenAI's ToS allow commercial use (Google Generative AI Terms / OpenAI Usage Policies). CodeGateway as a gateway makes no claim. But copyright ≠ compliance — don't generate public figures / trademark infringement / platform-policy violations.
Q: Do failed requests get charged?
A: No. 4xx / 5xx responses are not billed. Only successful responses with b64_json or url deduct from balance. Our Sprint 4b dogfood 16 images all passed first try.
Q: Will upstream models go away or be repriced?
A: Upstream Google / OpenAI announce on their own cycle. The CodeGateway gateway tracks upstream — when prices change, our CMS price table updates and new prices appear at /pricing immediately. In-flight requests settle at the price at submission.
Q: How does the tier markup interact with image API usage?
A: Image API spend rolls into your 90-day rolling cumulative spend window — pooled with text API usage. New accounts at 1.5x; cumulative $10 drops to 1.4x; floor at 1.2x. Mixing image + text API hits lower tiers faster than going single-sided. See Tier markup explainer.
Q: Imagen 4's backend really hardcoded to 1024×1024?
A: Yes. The Imagen 4 route is currently fixed at 1024×1024; passing aspect_ratio is "accepted but ignored." For 16:9 / 9:16 horizontal/vertical, switch to gpt-image-2 (OpenAI route natively supports size).
Q: Can existing OpenAI SDK code migrate with zero changes?
A: Yes. Change OPENAI_BASE_URL to https://api.codegateway.dev/v1 and OPENAI_API_KEY to sk-cg-xxx. Application code stays the same. Cursor, Aider, and similar tools work the same way.
The job of a tool is to let you configure less and create more. One key, 5 models, $2 starter — collapse "which API to pick, how to sign up, how to bill" into a single motion. The energy you save goes back into the work that actually matters.