Google's Imagen 4 image API is dead — migrate to Gemini now
Three imagen-4.0 endpoints now hard-error instead of warn. The drop-in, gemini-3.1-flash-image, runs 68% pricier per image — unless you batch.

Copy markdown
The three endpoints that stopped answering
imagen-4.0-generate-001, imagen-4.0-ultra-generate-001, and imagen-4.0-fast-generate-001 shut down on Aug 17 and now return a hard error, not a deprecation warning. If your app still calls them, image generation is already broken in production.
The drop-in costs 68% more per image
Google's recommended replacement, gemini-3.1-flash-image, runs $0.067 per standard image versus Imagen 4's $0.040 — a 67.5% jump. The Batch API undercuts the old price at $0.034, so push any non-interactive generation through batch to come out ahead.
Your code changes, not just the model name
Swap generate_images() for generate_content(), and read pixels from response.candidates[0].content.parts inline_data instead of the old response.generated_images array. Each call now returns a single image, so loop where you used number_of_images.
What you lose in the move
Negative prompts and format/aspect controls are gone, and SynthID watermarking is now mandatory on every output. Test aspect ratios, safety, latency and quota against your real prompts before you route production traffic to the new model.