fix: remove deprecated Gemini image generation model IDs#796
fix: remove deprecated Gemini image generation model IDs#796LogicLeapLtd wants to merge 2 commits into
Conversation
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)
|
@LogicLeapLtd is attempting to deploy a commit to the Merit Systems Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
💡 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".
| 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`. |
There was a problem hiding this comment.
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`. |
There was a problem hiding this comment.
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 👍 / 👎.
/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-generationgemini-2.5-flash-image-previewChanges
packages/sdk/ts/src/supported-models/chat/gemini.tsGeminiModelunion typeGeminiModelsarraytemplates/next-image/src/app/api/generate-image/google.tsgemini-2.5-flash-image-previewwith the GA modelgemini-2.5-flash-imagetemplates/next-image/src/app/api/edit-image/google.tspackages/tests/provider-smoke/gemini-generate-text.test.tsgemini-2.0-flash-preview-image-generationfromBLACKLISTED_MODELS— it no longer exists in the SDK so the blacklist entry is mootHow to verify
grep -r "gemini-2.0-flash-preview-image-generation\|gemini-2.5-flash-image-preview" packages/ templates/returns nothing (excluding docs).GeminiModeltype no longer includes the removed IDs.gemini-2.5-flash-imagewhich is the current GA model.