Skip to content

Commit e1c4415

Browse files
hattonclaude
andcommitted
Fix image generation: use stable Gemini image keys
OpenRouter retired the "-preview" Gemini image keys; their remaining endpoints no longer advertise image output, so every image request failed with "404 No endpoints found that support the requested output modalities: text, image". Switch the catalog and pinned tool models to the republished stable keys: google/gemini-3.1-flash-image-preview -> google/gemini-3.1-flash-image google/gemini-3-pro-image-preview -> google/gemini-3-pro-image Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent bc03931 commit e1c4415

6 files changed

Lines changed: 16 additions & 19 deletions

File tree

components/tools/ImageTool.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ import { DEFAULT_SIZE_TOKEN, pickSizeTokenForLongEdge } from "../../lib/imageSiz
4141
import { ToolModelPicker } from "./ToolModelPicker";
4242
import { theme } from "../../themes";
4343

44-
// Must match the catalog id in data/models-registry.json5, which is the
45-
// "-preview" key while OpenRouter only exposes the preview. Keep in sync if the
46-
// non-preview key is ever published and the registry id is updated.
47-
const GEMINI_3_1_FLASH_MODEL_ID = "google/gemini-3.1-flash-image-preview";
44+
// Must match the catalog id in data/models-registry.json5 (the stable,
45+
// non-preview key now that OpenRouter has retired the "-preview" key). Keep in
46+
// sync if the registry id changes.
47+
const GEMINI_3_1_FLASH_MODEL_ID = "google/gemini-3.1-flash-image";
4848

4949
const LOCALIZE_TOOL_ORDER = [
5050
"extract_cast_of_characters",

components/tools/tools-registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,8 @@ export const TOOLS: ToolDefinition[] = (
580580
referenceImages: "0",
581581
// Only offer these two engines: Gemini 3 Pro Preview (default) and
582582
// GPT-5.4 Image 2 as a secondary option. Other catalog models are hidden.
583-
modelIds: ["google/gemini-3-pro-image-preview", "openai/gpt-5.4-image-2"],
584-
recommendedModelIds: ["google/gemini-3-pro-image-preview"],
583+
modelIds: ["google/gemini-3-pro-image", "openai/gpt-5.4-image-2"],
584+
recommendedModelIds: ["google/gemini-3-pro-image"],
585585
},
586586
{
587587
id: "remove_object",

data/models-registry.json5

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Add comments, trailing commas, etc.
33
[
44
{
5-
id: "google/gemini-3-pro-image-preview",
5+
id: "google/gemini-3-pro-image",
66
name: "Gemini 3 Pro Preview",
77
badge: "Great but Expensive",
88
description: "'Nano Banana Pro' Good for editing, as it preserves the original image.",
@@ -26,14 +26,11 @@
2626
default: false,
2727
},
2828
{
29-
// OpenRouter currently only exposes the "-preview" key. We can NOT pre-list
30-
// the not-yet-published "google/gemini-3.1-flash-image" as a fallbackId:
31-
// OpenRouter validates every id in the `models` array up front and rejects
32-
// the whole request with 400 ("... is not a valid model ID") for any key it
33-
// doesn't recognize. (The `models` fallback only fails over on runtime
34-
// errors of *valid* models, not unknown ids.) When OpenRouter retires the
35-
// preview and republishes the non-preview key, update `id` here.
36-
id: "google/gemini-3.1-flash-image-preview",
29+
// OpenRouter retired the "-preview" key and republished the stable
30+
// "google/gemini-3.1-flash-image" key (the preview now has no
31+
// image-output endpoint, surfacing as "404 No endpoints found that support
32+
// the requested output modalities: text, image"). Use the stable key.
33+
id: "google/gemini-3.1-flash-image",
3734
name: "Gemini 3.1 Flash",
3835
badge: "Great",
3936
description: "'Nano Banana 2'. Good for editing, as it preserves the original image. Not quite as good at instruction understanding as Gemini 3 Pro.",

lib/__tests__/modelSelection.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from "../modelsCatalog";
1212
import type { ToolDefinition } from "../../types";
1313

14-
const GEMINI_FLASH = "google/gemini-3.1-flash-image-preview";
14+
const GEMINI_FLASH = "google/gemini-3.1-flash-image";
1515
const GPT5_IMAGE = "openai/gpt-5-image";
1616
const GPT54_IMAGE_2 = "openai/gpt-5.4-image-2";
1717

tests/experiments/cdp-run.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ await page.evaluate((level) => {
130130
const state = JSON.parse(RAW);
131131
state.modelReasoningLevels = state.modelReasoningLevels || {};
132132
if (level === "default") {
133-
delete state.modelReasoningLevels["google/gemini-3-pro-image-preview"];
133+
delete state.modelReasoningLevels["google/gemini-3-pro-image"];
134134
} else {
135-
state.modelReasoningLevels["google/gemini-3-pro-image-preview"] = level;
135+
state.modelReasoningLevels["google/gemini-3-pro-image"] = level;
136136
}
137137
localStorage.setItem("imageToolsAppState.v1", JSON.stringify(state));
138138
return "ok";

tests/experiments/gemini-grid-experiment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const INPUT = process.env.INPUT_IMAGE
1818
const OUT_IMAGE = path.resolve(here, "output-grid.png");
1919
const OUT_TEXT = path.resolve(here, "output-text.txt");
2020

21-
const MODEL = process.env.EXPERIMENT_MODEL || "google/gemini-3.1-flash-image-preview";
21+
const MODEL = process.env.EXPERIMENT_MODEL || "google/gemini-3.1-flash-image";
2222
const KEY = process.env.BLOOM_OPENROUTER_KEY_FOR_PLAYWRIGHT_TESTS;
2323

2424
const PROMPT = `This image is a single page containing several separate illustrated panels (a comic / instructional poster). Do TWO things.

0 commit comments

Comments
 (0)