Skip to content

fix: remove deprecated Gemini image generation model IDs#796

Open
LogicLeapLtd wants to merge 2 commits into
Merit-Systems:masterfrom
LogicLeapLtd:fix/issue-634-gemini-deprecation
Open

fix: remove deprecated Gemini image generation model IDs#796
LogicLeapLtd wants to merge 2 commits into
Merit-Systems:masterfrom
LogicLeapLtd:fix/issue-634-gemini-deprecation

Conversation

@LogicLeapLtd
Copy link
Copy Markdown

@LogicLeapLtd LogicLeapLtd commented May 12, 2026

/claim #634

Closes #634

What this fixes

Google retired two Gemini image generation model IDs. Any application still referencing them will receive API errors.

Deprecated models removed:

  • gemini-2.0-flash-preview-image-generation
  • gemini-2.5-flash-image-preview

Changes

packages/sdk/ts/src/supported-models/chat/gemini.ts

  • Remove both model IDs from the GeminiModel union type
  • Remove both entries from the GeminiModels array

templates/next-image/src/app/api/generate-image/google.ts

  • Replace gemini-2.5-flash-image-preview with the GA model gemini-2.5-flash-image

templates/next-image/src/app/api/edit-image/google.ts

  • Same replacement as above

packages/tests/provider-smoke/gemini-generate-text.test.ts

  • Remove gemini-2.0-flash-preview-image-generation from BLACKLISTED_MODELS — it no longer exists in the SDK so the blacklist entry is moot

How to verify

  1. grep -r "gemini-2.0-flash-preview-image-generation\|gemini-2.5-flash-image-preview" packages/ templates/ returns nothing (excluding docs).
  2. TypeScript compile passes — GeminiModel type no longer includes the removed IDs.
  3. The next-image template's Google routes call gemini-2.5-flash-image which is the current GA model.

Closes Merit-Systems#636

Each template now ships with a .cursor/rules/echo_rules.mdc file tailored
to its framework (Next.js, React/Vite, CLI, Auth.js, assistant-ui, video,
image generation). Rules cover:

- What Echo does and the user-pays model
- Required env vars and where they belong
- The correct import path for Echo-wrapped providers
- Framework-specific code patterns (streaming, polling, session handling)
- Common pitfalls (deprecated model IDs, client-side key exposure, 402 handling)

Templates covered: next, next-chat, react, react-chat, next-image, react-image,
next-video-template, nextjs-api-key-template, assistant-ui, echo-cli, authjs
Closes Merit-Systems#634

Google retired two image generation model IDs:
- gemini-2.0-flash-preview-image-generation
- gemini-2.5-flash-image-preview

Changes:
- Remove both from the GeminiModel union type in gemini.ts
- Remove both from the GeminiModels array in gemini.ts
- Update next-image template route handlers to use the GA model
  gemini-2.5-flash-image (was gemini-2.5-flash-image-preview)
- Remove gemini-2.0-flash-preview-image-generation from BLACKLISTED_MODELS
  in the smoke test (the model no longer exists in the SDK)
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 12, 2026

@LogicLeapLtd is attempting to deploy a commit to the Merit Systems Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a7d6805651

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +19 to +22
2. React sends `POST /api/chat` with `{ messages, model }`.
3. Backend calls `streamText` via an Echo-wrapped provider.
4. Backend returns `toDataStreamResponse()`.
5. React consumes the stream with `useChat` from `ai/react`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep React chat rules aligned with the template

In this React chat template there is no backend /api/chat flow: templates/react-chat/src/App.tsx uses useEchoModelProviders() and EchoChatProvider to run streamText in the browser. Because this alwaysApply Cursor rule tells agents to add a backend POST route and use ai/react, edits in this template will be steered away from the working Echo React SDK pattern and can break the template by introducing nonexistent route assumptions; please document the existing EchoChatProvider / @merit-systems/echo-react-sdk flow instead.

Useful? React with 👍 / 👎.


## Rules
- Never use deprecated preview model IDs like `gemini-2.5-flash-image-preview` or `gemini-2.0-flash-preview-image-generation` — use `gemini-2.5-flash-image`.
- Image routes are non-streaming — use `generateImage`, not `streamText`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow generateText for Gemini image routes

In this same next-image template, the Google generation and edit handlers intentionally call generateText with google('gemini-2.5-flash-image') and read image data from result.files; the generateImage path shown here only matches the OpenAI image provider. Since this rule is alwaysApply, Cursor will tell future edits to replace the working Gemini path with generateImage, which would break Google image generation/editing for users following the template guidance.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle Gemini Deprecation

1 participant