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
- Seedance 2.5 30-second clip via API: the request, poll and price
Send model seedance-2.5 with duration 30 to POST /v1/videos on Sume, poll the job, and expect about $17 at 720p 16:9. Request and Python poll loop.
- Seedance 2.5 30-second job: set a 20-minute client deadline in Python
A 30-second Seedance 2.5 job outlives any HTTP timeout. Submit async to Sume, poll with next_poll_after_seconds, and set the deadline in your client.
- Seedance 2.5 API in Python: a 30-second clip with an audio reference
Submit a 30-second Seedance 2.5 job on Sume with requests: an image and an audio reference in input_references, polling, download, and limits to check.
- Seedance 2.5 estimate vs usage.cost: reconcile a job in Node
Compute the Seedance 2.5 price from width, height and seconds, submit one job to Sume, and compare it with usage.cost on the poll. A runnable Node 18 script.
Written by Sume