Imagen is shutting down — here’s what that means for you
If you search “how to use google imagen” today, every guide on the first page is missing one critical fact: Google deprecated the Imagen models, and they shut down on August 17, 2026. The replacement is Nano Banana, accessed through the gemini-2.5-flash-image model name.
This changes the question. “How to use Google Imagen” in late July 2026 isn’t just about picking an API endpoint — it’s about deciding whether to use the legacy Imagen API (still running, but on borrowed time), migrate to Nano Banana now, or route through a third-party API that abstracts the churn away from your codebase.
This guide covers all three paths with working code, real pricing, and the migration plan. One thing before we start: this guide is about Google DeepMind’s Imagen text-to-image model, not the unrelated Imagen photo editing app — different product, different company.
What you need before you start
Before you write a single line of code, you need API access. Here’s exactly what each path requires:
Gemini API path (simplest direct access):
- A Google AI Studio account
- A Gemini API key (free tier available — Google AI Plans lists current quotas)
- The Google Gen AI SDK installed:
pip install google-genai
Vertex AI path (enterprise Google Cloud):
- A Google Cloud project with billing enabled
- Vertex AI API enabled in your project
- Authentication set up via service account or
gcloud auth
Third-party API path (no Google setup):
- An API key from an aggregator that offers Imagen models (we’ll cover Modellix — disclosure: we run it)
- No Google Cloud project, no SDK installation beyond a standard HTTP client
Pick the path that matches your setup. The code examples below work with all three — the only difference is the base URL and authentication header.
Generate images with the Gemini API
The Gemini API is the most direct way to call Imagen. Here’s a working example in Python, JavaScript, and raw cURL.
Python
1 | from google import genai |
JavaScript / Node.js
1 | import { GoogleGenAI } from "@google/genai"; |
cURL (REST API)
Most guides only show SDK code. But if you’re using a language without a Google Gen AI SDK, here’s the raw REST call:
1 | curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/imagen-4.0-generate-001:generateImages" \ |
If you’re new to image generation APIs, our text-to-image API guide walks through the fundamentals — prompt structure, aspect ratios, and how different models handle the same input.
What you get back
The API returns base64-encoded PNG images inside a JSON response. Each generated image includes a SynthID digital watermark — invisible to the eye but detectable by Google’s verification tools. This is on by default and can’t be disabled.
Prompt tips that actually work
The official Imagen prompt guide recommends starting short and iterating. In practice:
- Start with subject, context, style: “A ceramic coffee mug on a wooden desk, morning light through window blinds, product photography style”
- Add negative details if needed: “No text, no logos, no people”
- Imagen 4 handles text in images well: You can include prompts like “A storefront sign reading ‘Open’ in neon pink cursive”
- Aspect ratios: Supported values are
1:1,3:4,4:3,9:16,16:9
Rate limits depend on your Google AI plan tier. The free tier typically allows around 2-5 images per minute.
Generate images through Vertex AI
If you’re already in the Google Cloud ecosystem, Vertex AI gives you the same Imagen models with enterprise controls — IAM permissions, VPC service controls, and usage billing through your existing Cloud account.
The code is nearly identical to the Gemini API path. The main differences:
1 | from google import genai |
The trade-off: Vertex AI requires billing enabled on your Google Cloud project and the Vertex AI API enabled. This adds 5-10 minutes of setup but gives you production-grade infrastructure. For prototyping, the Gemini API with a free API key is faster.
Skip the setup — use Imagen through an API aggregator
The Google-native paths work, but they come with overhead: you’re managing Google Cloud projects, API keys, rate limits, and now — a deprecation deadline. When Imagen shuts down on August 17, every line of code that calls imagen-4.0-generate-001 breaks.
API aggregators solve this differently. Instead of calling Google directly, you call a single API that routes your request to the model — and when the underlying model changes, the aggregator updates the routing, not your code.
Modellix is one such aggregator (full disclosure: we run it). We integrated Imagen 4.0 alongside Nano Banana and Veo 3.1 in June 2026. It offers Imagen 4 through the same REST API as 210+ other image and video models. Here’s what that looks like:
1 | curl -X POST "https://api.modellix.ai/v1/images/generate" \ |
The key difference: no Google Cloud project, no SDK installation, no per-platform API key. One key, one REST endpoint, and transparent per-call pricing that shows you exactly what each generation costs before you run it. When Google transitions Imagen to Nano Banana, the model name on Modellix updates — your integration code doesn’t change.
Other aggregators like Replicate also host Imagen models, with per-run pricing around $0.04/image at the time of writing.
What Imagen API access actually costs
One of the top PAA questions for this keyword is “How much does it cost to use Imagen?” — and none of the first-page results give a clear answer. Here it is:
| Access path | Pricing model | Estimated cost per image (1024×1024) |
|---|---|---|
| Gemini API (free tier) | Free quota (rate-limited) | $0.00 (within quota) |
| Gemini API (paid) | Per-image, billed through Google AI Plans | ~$0.02–$0.04/image |
| Vertex AI | Per-image, billed through Google Cloud | ~$0.02–$0.04/image |
| Modellix (aggregator) | Pay-as-you-go, per call | $0.025/image |
| Replicate (aggregator) | Per-run, hardware-time based | ~$0.04/image |
Pricing checked July 2026. Google’s official rates are on the Gemini API pricing page. Aggregator prices change — check their current model pages.
The free tier through Google AI Studio is the cheapest way to experiment. For production workloads, the cost differences between channels are negligible at low volume. The real cost isn’t per-image pricing — it’s the engineering time to set up and maintain each integration. That’s where the aggregator path saves money: zero setup, zero maintenance when Google deprecates models.
After August 17, 2026 — migrating to Nano Banana
When Imagen shuts down, Google’s replacement is Nano Banana, accessed through the Gemini API using the model name gemini-2.5-flash-image. The migration involves three changes to your code:
1. Model name changes:
1 | # Before (Imagen) |
2. Method changes:
1 | # Before (Imagen-specific method) |
3. Response handling: Nano Banana returns image data inside standard content parts, not a dedicated generated_images array. You’ll need to extract the image from response.candidates[0].content.parts.
If you’re using an API aggregator like Modellix, none of these changes affect your code — the aggregator handles the model transition behind its API. Your integration keeps working with the same endpoint and authentication.
The official migration guide has more detail on response structure changes. If you’re considering whether to stick with Google’s migration path or explore alternatives to the Nano Banana API, we’ve compared the options — including staying on Imagen through an aggregator that abstracts the transition.
If you want to skip the Google Cloud setup entirely, Modellix gives you Imagen 4 (and 210+ other models) behind a single REST API key — no per-platform onboarding, transparent per-call pricing, and automatic model updates when providers deprecate endpoints. Sign up and get an API key in under a minute.