Scan your repo for retiring Google image and TTS ids (Python)
A 30-line Python scanner that finds Imagen 4, Nano Banana and Gemini TTS preview ids in your files and prints the replacement Google names for each one.

Run the script below from your repo root. It walks every text file and prints each Google image or TTS model id that Google's deprecations page lists for retirement, with the replacement Google names. The ids come from the rows read on October 7, 2026. It needs only the Python standard library.
The scanner
Pass a folder as the first argument, or run it with none to scan the current one. The pattern refuses a match that sits inside a longer id, so gemini-3.1-flash-image does not fire on gemini-3.1-flash-image-preview; each id is reported once under its own name.
import os
import re
import sys
NB, TTS = "gemini-nano-banana-2.1", "gemini-3.8-flash-tts / -lite-tts"
RETIRING = {
"imagen-4.0-generate-001": NB,
"imagen-4.0-ultra-generate-001": NB,
"imagen-4.0-fast-generate-001": NB,
"gemini-2.5-flash-image": "gemini-3.1-flash-lite-image",
"gemini-3.1-flash-image": NB,
"gemini-3.1-flash-image-preview": NB,
"gemini-3-pro-image-preview": "gemini-3-pro-image",
"gemini-3.1-flash-tts-preview": TTS,
"gemini-2.5-flash-preview-tts": TTS,
"gemini-2.5-pro-preview-tts": TTS,
}
ids = "|".join(map(re.escape, sorted(RETIRING, key=len, reverse=True)))
PATTERN = re.compile(rf"(?<![\w.-])({ids})(?![\w.-])")
root = sys.argv[1] if len(sys.argv) > 1 else "."
for folder, dirs, files in os.walk(root):
dirs[:] = [d for d in dirs if d not in {".git", "node_modules", ".venv"}]
for name in files:
path = os.path.join(folder, name)
try:
with open(path, encoding="utf-8") as fh:
for no, line in enumerate(fh, 1):
for m in PATTERN.finditer(line):
print(f"{path}:{no}: {m.group(1)} -> {RETIRING[m.group(1)]}")
except (UnicodeDecodeError, OSError):
passWhat the ids mean
The ids cover three groups. Two of the groups are on a clock.
| Id group | Date | Status on Oct 7 |
|---|---|---|
| imagen-4.0-*-generate-001 | Aug 17, 2026 | Already past |
| gemini-3.1-flash-image-preview, gemini-3-pro-image-preview | Jun 25, 2026 | Already past |
| gemini-3.1-flash-tts-preview, 2.5 TTS previews | Nov 17, 2026 | Upcoming |
| gemini-2.5-flash-image | Mar 15, 2027 (Oct 2, 2026 on the pricing page) | Verify now |
| gemini-3.1-flash-image | None announced | Deprecated Oct 6 |
After the scan
- Fix the past-date ids first, since those calls should already fail.
- Change the TTS ids before November 17 and listen to the output first.
- Treat
gemini-3.1-flash-imageas a to-do, not an emergency: Google lists no shutdown date. - Also search environment files, CI settings and docs, which the walk includes only if they are text and not in the skipped folders.
Sources
Related posts
More in Developers
- SHA-256 the batch body into the Sume idempotency key for bulk chunks
Derive each bulk chunk's Idempotency-Key from a hash of its items so replays reuse the queue and edited rows get a new key instead of a 409 conflict.
- Turn a shot list into Gemini Omni requests: Python on Sume
Submit every line of a shot list as its own Omni job with stable Idempotency-Keys, then poll them in one pass. Runnable Python and the cost of a 3-shot list.
- Should my backend call Sume over hosted MCP or the REST API?
REST from a backend, hosted MCP from an agent client. Where they differ: auth, wait limits, REST-only Image 1.0 and Video 1.0, and write budgets.
- Retiring a webhook endpoint: Sume runs already carrying it still POST
Any run created with a webhook_url can POST when it ends, even after you decommission the endpoint. Retries run 10 times, and the receipt holds the real result.
Written by Sume