Skip to content

Commit bb5b7bd

Browse files
fix(google): use stable Gemini image model
Google's preview Gemini image IDs and legacy Imagen 4 IDs are being retired, but OpenClaw still advertised preview/retired IDs across the Google/OpenRouter image-generation defaults and compatibility migration paths. This keeps stable Flash as the default while preserving explicit Pro selections by mapping Pro preview configs and provider catalogs to the stable Pro image IDs. - switch Google and OpenRouter image-generation provider defaults to gemini-3.1-flash-image - preserve stable Pro image models in Google/OpenRouter provider catalogs and lightweight metadata - migrate Flash preview/Imagen refs to stable Flash, while migrating Pro preview refs to stable Pro - update image-generation docs, provider/tool tests, and doctor migration coverage Rebased onto latest main to resolve merge conflicts.
1 parent 8656c3b commit bb5b7bd

26 files changed

Lines changed: 219 additions & 158 deletions

docs/cli/infer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Notes:
182182
```bash
183183
openclaw infer image providers --json
184184
openclaw infer image generate \
185-
--model google/gemini-3.1-flash-image-preview \
185+
--model google/gemini-3.1-flash-image \
186186
--prompt "Minimal flat test image: one blue square on a white background, no text." \
187187
--output ./openclaw-infer-image-smoke.png \
188188
--json

docs/gateway/config-agents.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Time format in system prompt. Default: `auto` (OS preference).
371371
},
372372
imageGenerationModel: {
373373
primary: "openai/gpt-image-2",
374-
fallbacks: ["google/gemini-3.1-flash-image-preview"],
374+
fallbacks: ["google/gemini-3.1-flash-image"],
375375
},
376376
videoGenerationModel: {
377377
primary: "qwen/wan2.6-t2v",
@@ -408,7 +408,7 @@ Time format in system prompt. Default: `auto` (OS preference).
408408
- Prefer explicit `provider/model` refs. Bare IDs are accepted for compatibility; if a bare ID uniquely matches a configured image-capable entry in `models.providers.*.models`, OpenClaw qualifies it to that provider. Ambiguous configured matches require an explicit provider prefix.
409409
- `imageGenerationModel`: accepts either a string (`"provider/model"`) or an object (`{ primary, fallbacks }`).
410410
- Used by the shared image-generation capability and any future tool/plugin surface that generates images.
411-
- Typical values: `google/gemini-3.1-flash-image-preview` for native Gemini image generation, `fal/fal-ai/flux/dev` for fal, `openai/gpt-image-2` for OpenAI Images, or `openai/gpt-image-1.5` for transparent-background OpenAI PNG/WebP output.
411+
- Typical values: `google/gemini-3.1-flash-image` for native Gemini image generation, `fal/fal-ai/flux/dev` for fal, `openai/gpt-image-2` for OpenAI Images, or `openai/gpt-image-1.5` for transparent-background OpenAI PNG/WebP output.
412412
- If you select a provider/model directly, configure matching provider auth too (for example `GEMINI_API_KEY` or `GOOGLE_API_KEY` for `google/*`, `OPENAI_API_KEY` or OpenAI Codex OAuth for `openai/gpt-image-2` / `openai/gpt-image-1.5`, `FAL_KEY` for `fal/*`).
413413
- If omitted, `image_generate` can still infer an auth-backed provider default. It tries the current default provider first, then the remaining registered image-generation providers in provider-id order.
414414
- `musicGenerationModel`: accepts either a string (`"provider/model"`) or an object (`{ primary, fallbacks }`).

docs/help/testing-live.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ Docker runners below with an explicit `OPENCLAW_PROFILE_FILE`.
518518
- Optional narrowing:
519519
- `OPENCLAW_LIVE_IMAGE_GENERATION_PROVIDERS="openai,google,openrouter,xai"`
520520
- `OPENCLAW_LIVE_IMAGE_GENERATION_PROVIDERS="deepinfra"`
521-
- `OPENCLAW_LIVE_IMAGE_GENERATION_MODELS="openai/gpt-image-2,google/gemini-3.1-flash-image-preview,openrouter/google/gemini-3.1-flash-image-preview,xai/grok-imagine-image"`
521+
- `OPENCLAW_LIVE_IMAGE_GENERATION_MODELS="openai/gpt-image-2,google/gemini-3.1-flash-image,openrouter/google/gemini-3.1-flash-image,xai/grok-imagine-image"`
522522
- `OPENCLAW_LIVE_IMAGE_GENERATION_CASES="google:flash-generate,google:pro-edit,openrouter:generate,xai:default-generate,xai:default-edit"`
523523
- Optional auth behavior:
524524
- `OPENCLAW_LIVE_REQUIRE_PROFILE_KEYS=1` to force profile-store auth and ignore env-only overrides
@@ -530,7 +530,7 @@ test passes:
530530
OPENCLAW_LIVE_TEST=1 OPENCLAW_LIVE_INFER_CLI_TEST=1 pnpm test:live -- test/image-generation.infer-cli.live.test.ts
531531
openclaw infer image providers --json
532532
openclaw infer image generate \
533-
--model google/gemini-3.1-flash-image-preview \
533+
--model google/gemini-3.1-flash-image \
534534
--prompt "Minimal flat test image: one blue square on a white background, no text." \
535535
--output ./openclaw-infer-image-smoke.png \
536536
--json

docs/providers/google.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,10 @@ instead of sending it.
197197
## Image generation
198198

199199
The bundled `google` image-generation provider defaults to
200-
`google/gemini-3.1-flash-image-preview`.
200+
`google/gemini-3.1-flash-image`.
201201

202-
- Also supports `google/gemini-3-pro-image-preview`
202+
- Also supports `google/gemini-3.1-flash-image`
203+
- Also supports `google/gemini-3-pro-image`
203204
- Generate: up to 4 images per request
204205
- Edit mode: enabled, up to 5 input images
205206
- Geometry controls: `size`, `aspectRatio`, and `resolution`
@@ -211,7 +212,7 @@ To use Google as the default image provider:
211212
agents: {
212213
defaults: {
213214
imageGenerationModel: {
214-
primary: "google/gemini-3.1-flash-image-preview",
215+
primary: "google/gemini-3.1-flash-image",
215216
},
216217
},
217218
},

docs/providers/openrouter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ under `agents.defaults.imageGenerationModel`:
105105
agents: {
106106
defaults: {
107107
imageGenerationModel: {
108-
primary: "openrouter/google/gemini-3.1-flash-image-preview",
108+
primary: "openrouter/google/gemini-3.1-flash-image",
109109
timeoutMs: 180_000,
110110
},
111111
},

docs/tools/image-generation.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ internal image endpoints remain blocked by default.
7373

7474
## Common routes
7575

76-
| Goal | Model ref | Auth |
77-
| ---------------------------------------------------- | -------------------------------------------------- | -------------------------------------- |
78-
| OpenAI image generation with API billing | `openai/gpt-image-2` | `OPENAI_API_KEY` |
79-
| OpenAI image generation with Codex subscription auth | `openai/gpt-image-2` | OpenAI ChatGPT/Codex OAuth |
80-
| OpenAI transparent-background PNG/WebP | `openai/gpt-image-1.5` | `OPENAI_API_KEY` or OpenAI Codex OAuth |
81-
| DeepInfra image generation | `deepinfra/black-forest-labs/FLUX-1-schnell` | `DEEPINFRA_API_KEY` |
82-
| fal Krea 2 expressive/style-directed generation | `fal/krea/v2/medium/text-to-image` | `FAL_KEY` |
83-
| OpenRouter image generation | `openrouter/google/gemini-3.1-flash-image-preview` | `OPENROUTER_API_KEY` |
84-
| LiteLLM image generation | `litellm/gpt-image-2` | `LITELLM_API_KEY` |
85-
| Microsoft Foundry MAI image generation | `microsoft-foundry/<deployment-name>` | `AZURE_OPENAI_API_KEY` or Entra ID |
86-
| Google Gemini image generation | `google/gemini-3.1-flash-image-preview` | `GEMINI_API_KEY` or `GOOGLE_API_KEY` |
76+
| Goal | Model ref | Auth |
77+
| ---------------------------------------------------- | -------------------------------------------- | -------------------------------------- |
78+
| OpenAI image generation with API billing | `openai/gpt-image-2` | `OPENAI_API_KEY` |
79+
| OpenAI image generation with Codex subscription auth | `openai/gpt-image-2` | OpenAI ChatGPT/Codex OAuth |
80+
| OpenAI transparent-background PNG/WebP | `openai/gpt-image-1.5` | `OPENAI_API_KEY` or OpenAI Codex OAuth |
81+
| DeepInfra image generation | `deepinfra/black-forest-labs/FLUX-1-schnell` | `DEEPINFRA_API_KEY` |
82+
| fal Krea 2 expressive/style-directed generation | `fal/krea/v2/medium/text-to-image` | `FAL_KEY` |
83+
| OpenRouter image generation | `openrouter/google/gemini-3.1-flash-image` | `OPENROUTER_API_KEY` |
84+
| LiteLLM image generation | `litellm/gpt-image-2` | `LITELLM_API_KEY` |
85+
| Microsoft Foundry MAI image generation | `microsoft-foundry/<deployment-name>` | `AZURE_OPENAI_API_KEY` or Entra ID |
86+
| Google Gemini image generation | `google/gemini-3.1-flash-image` | `GEMINI_API_KEY` or `GOOGLE_API_KEY` |
8787

8888
The same tool handles text-to-image and reference-image editing. Use `image`
8989
for one reference or `images` for multiple. For Krea 2 models on fal, those
@@ -96,19 +96,19 @@ backend emits it.
9696

9797
## Supported providers
9898

99-
| Provider | Default model | Edit support | Auth |
100-
| ----------------- | --------------------------------------- | ---------------------------------- | ----------------------------------------------------- |
101-
| ComfyUI | `workflow` | Yes (1 image, workflow-configured) | `COMFY_API_KEY` or `COMFY_CLOUD_API_KEY` for cloud |
102-
| DeepInfra | `black-forest-labs/FLUX-1-schnell` | Yes (1 image) | `DEEPINFRA_API_KEY` |
103-
| fal | `fal-ai/flux/dev` | Yes (model-specific limits) | `FAL_KEY` |
104-
| Google | `gemini-3.1-flash-image-preview` | Yes (up to 5 images) | `GEMINI_API_KEY` or `GOOGLE_API_KEY` |
105-
| LiteLLM | `gpt-image-2` | Yes (up to 5 input images) | `LITELLM_API_KEY` |
106-
| Microsoft Foundry | `<deployment-name>` | Yes (MAI-Image-2.5 models only) | `AZURE_OPENAI_API_KEY` or Entra ID (`az login`) |
107-
| MiniMax | `image-01` | Yes (subject reference) | `MINIMAX_API_KEY` or MiniMax OAuth (`minimax-portal`) |
108-
| OpenAI | `gpt-image-2` | Yes (up to 5 images) | `OPENAI_API_KEY` or OpenAI ChatGPT/Codex OAuth |
109-
| OpenRouter | `google/gemini-3.1-flash-image-preview` | Yes (up to 5 input images) | `OPENROUTER_API_KEY` |
110-
| Vydra | `grok-imagine` | No | `VYDRA_API_KEY` |
111-
| xAI | `grok-imagine-image` | Yes (up to 5 images) | `XAI_API_KEY` |
99+
| Provider | Default model | Edit support | Auth |
100+
| ----------------- | ---------------------------------- | ---------------------------------- | ----------------------------------------------------- |
101+
| ComfyUI | `workflow` | Yes (1 image, workflow-configured) | `COMFY_API_KEY` or `COMFY_CLOUD_API_KEY` for cloud |
102+
| DeepInfra | `black-forest-labs/FLUX-1-schnell` | Yes (1 image) | `DEEPINFRA_API_KEY` |
103+
| fal | `fal-ai/flux/dev` | Yes (model-specific limits) | `FAL_KEY` |
104+
| Google | `gemini-3.1-flash-image` | Yes (up to 5 images) | `GEMINI_API_KEY` or `GOOGLE_API_KEY` |
105+
| LiteLLM | `gpt-image-2` | Yes (up to 5 input images) | `LITELLM_API_KEY` |
106+
| Microsoft Foundry | `<deployment-name>` | Yes (MAI-Image-2.5 models only) | `AZURE_OPENAI_API_KEY` or Entra ID (`az login`) |
107+
| MiniMax | `image-01` | Yes (subject reference) | `MINIMAX_API_KEY` or MiniMax OAuth (`minimax-portal`) |
108+
| OpenAI | `gpt-image-2` | Yes (up to 5 images) | `OPENAI_API_KEY` or OpenAI ChatGPT/Codex OAuth |
109+
| OpenRouter | `google/gemini-3.1-flash-image` | Yes (up to 5 input images) | `OPENROUTER_API_KEY` |
110+
| Vydra | `grok-imagine` | No | `VYDRA_API_KEY` |
111+
| xAI | `grok-imagine-image` | Yes (up to 5 images) | `XAI_API_KEY` |
112112

113113
Use `action: "list"` to inspect available providers and models at runtime:
114114

@@ -208,8 +208,8 @@ translation.
208208
primary: "openai/gpt-image-2",
209209
timeoutMs: 180_000,
210210
fallbacks: [
211-
"openrouter/google/gemini-3.1-flash-image-preview",
212-
"google/gemini-3.1-flash-image-preview",
211+
"openrouter/google/gemini-3.1-flash-image",
212+
"google/gemini-3.1-flash-image",
213213
"fal/fal-ai/flux/dev",
214214
],
215215
},
@@ -388,7 +388,7 @@ support 1.
388388
agents: {
389389
defaults: {
390390
imageGenerationModel: {
391-
primary: "openrouter/google/gemini-3.1-flash-image-preview",
391+
primary: "openrouter/google/gemini-3.1-flash-image",
392392
},
393393
},
394394
},
@@ -398,8 +398,8 @@ support 1.
398398
OpenClaw forwards `prompt`, `count`, reference images, and
399399
Gemini-compatible `aspectRatio` / `resolution` hints to OpenRouter.
400400
Current built-in OpenRouter image model shortcuts include
401-
`google/gemini-3.1-flash-image-preview`,
402-
`google/gemini-3-pro-image-preview`, and `openai/gpt-5.4-image-2`. Use
401+
`google/gemini-3.1-flash-image`,
402+
`google/gemini-3-pro-image`, and `openai/gpt-5.4-image-2`. Use
403403
`action: "list"` to see what your configured plugin exposes.
404404

405405
</Accordion>

0 commit comments

Comments
 (0)