From 100da9f45c593a51c27ac724d7c82d040f791501 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 8 Mar 2026 02:32:49 +0000 Subject: [PATCH] fix: correct gemini flash model id --- CHANGELOG.md | 1 + docs/concepts/model-providers.md | 2 +- docs/gateway/configuration-reference.md | 2 +- docs/help/faq.md | 2 +- docs/help/testing.md | 6 +++--- docs/nodes/media-understanding.md | 6 +++--- .../models-config.providers.google-antigravity.test.ts | 8 ++++++++ src/agents/models-config.providers.ts | 7 +++++-- src/config/defaults.ts | 2 +- src/config/model-alias-defaults.test.ts | 4 ++-- 10 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19ec82fb2ec..a86393d8e29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -141,6 +141,7 @@ Docs: https://docs.openclaw.ai - Gateway/password CLI hardening: add `openclaw gateway run --password-file`, warn when inline `--password` is used because it can leak via process listings, and document env/file-backed password input as the preferred startup path. Fixes #27948. Thanks @vibewrk and @vincentkoc. - Config/heartbeat legacy-path handling: auto-migrate top-level `heartbeat` into `agents.defaults.heartbeat` (with merge semantics that preserve explicit defaults), and keep startup failures on non-migratable legacy entries in the detailed invalid-config path instead of generic migration-failed errors. (#32706) thanks @xiwan. - Plugins/SDK subpath parity: expand plugin SDK subpaths across bundled channels/extensions (Discord, Slack, Signal, iMessage, WhatsApp, LINE, and bundled companion plugins), with build/export/type/runtime wiring so scoped imports resolve consistently in source and dist while preserving compatibility. (#33737) thanks @gumadeiras. +- Google/Gemini Flash model selection: switch built-in `gemini-flash` defaults and docs/examples from the nonexistent `google/gemini-3.1-flash-preview` ID to the working `google/gemini-3-flash-preview`, while normalizing legacy OpenClaw config that still uses the old Flash 3.1 alias. - Plugins/bundled scoped-import migration: migrate bundled plugins from monolithic `openclaw/plugin-sdk` imports to scoped subpaths (or `openclaw/plugin-sdk/core`) across registration and startup-sensitive runtime files, add CI/release guardrails to prevent regressions, and keep root `openclaw/plugin-sdk` support for external/community plugins. Thanks @gumadeiras. - Routing/session duplicate suppression synthesis: align shared session delivery-context inheritance, channel-paired route-field merges, and reply-surface target matching so dmScope=main turns avoid cross-surface duplicate replies while thread-aware forwarding keeps intended routing semantics. (from #33629, #26889, #17337, #33250) Thanks @Yuandiaodiaodiao, @kevinwildenradt, @Glucksberg, and @bmendonca3. - Routing/legacy session route inheritance: preserve external route metadata inheritance for legacy channel session keys (`agent:::` and `...:thread:`) so `chat.send` does not incorrectly fall back to webchat when valid delivery context exists. Follow-up to #33786. diff --git a/docs/concepts/model-providers.md b/docs/concepts/model-providers.md index aa38fbf52c5..75333b014b0 100644 --- a/docs/concepts/model-providers.md +++ b/docs/concepts/model-providers.md @@ -104,7 +104,7 @@ OpenClaw ships with the pi‑ai catalog. These providers require **no** - Provider: `google` - Auth: `GEMINI_API_KEY` - Optional rotation: `GEMINI_API_KEYS`, `GEMINI_API_KEY_1`, `GEMINI_API_KEY_2`, `GOOGLE_API_KEY` fallback, and `OPENCLAW_LIVE_GEMINI_KEY` (single override) -- Example model: `google/gemini-3-pro-preview` +- Example model: `google/gemini-3.1-pro-preview` - CLI: `openclaw onboard --auth-choice gemini-api-key` ### Google Vertex, Antigravity, and Gemini CLI diff --git a/docs/gateway/configuration-reference.md b/docs/gateway/configuration-reference.md index e39d7777599..ceae117c81a 100644 --- a/docs/gateway/configuration-reference.md +++ b/docs/gateway/configuration-reference.md @@ -916,7 +916,7 @@ Time format in system prompt. Default: `auto` (OS preference). | `sonnet` | `anthropic/claude-sonnet-4-5` | | `gpt` | `openai/gpt-5.2` | | `gpt-mini` | `openai/gpt-5-mini` | -| `gemini` | `google/gemini-3-pro-preview` | +| `gemini` | `google/gemini-3.1-pro-preview` | | `gemini-flash` | `google/gemini-3-flash-preview` | Your configured aliases always win over defaults. diff --git a/docs/help/faq.md b/docs/help/faq.md index 65a580dd965..da9a243897f 100644 --- a/docs/help/faq.md +++ b/docs/help/faq.md @@ -2241,7 +2241,7 @@ Yes. OpenClaw ships a few default shorthands (only applied when the model exists - `sonnet` → `anthropic/claude-sonnet-4-5` - `gpt` → `openai/gpt-5.2` - `gpt-mini` → `openai/gpt-5-mini` -- `gemini` → `google/gemini-3-pro-preview` +- `gemini` → `google/gemini-3.1-pro-preview` - `gemini-flash` → `google/gemini-3-flash-preview` If you set your own alias with the same name, your value wins. diff --git a/docs/help/testing.md b/docs/help/testing.md index ba248dd5f88..ff1da245025 100644 --- a/docs/help/testing.md +++ b/docs/help/testing.md @@ -277,13 +277,13 @@ This is the “common models” run we expect to keep working: - OpenAI (non-Codex): `openai/gpt-5.2` (optional: `openai/gpt-5.1`) - OpenAI Codex: `openai-codex/gpt-5.4` - Anthropic: `anthropic/claude-opus-4-6` (or `anthropic/claude-sonnet-4-5`) -- Google (Gemini API): `google/gemini-3-pro-preview` and `google/gemini-3-flash-preview` (avoid older Gemini 2.x models) +- Google (Gemini API): `google/gemini-3.1-pro-preview` and `google/gemini-3-flash-preview` (avoid older Gemini 2.x models) - Google (Antigravity): `google-antigravity/claude-opus-4-6-thinking` and `google-antigravity/gemini-3-flash` - Z.AI (GLM): `zai/glm-4.7` - MiniMax: `minimax/minimax-m2.5` Run gateway smoke with tools + image: -`OPENCLAW_LIVE_GATEWAY_MODELS="openai/gpt-5.2,openai-codex/gpt-5.4,anthropic/claude-opus-4-6,google/gemini-3-pro-preview,google/gemini-3-flash-preview,google-antigravity/claude-opus-4-6-thinking,google-antigravity/gemini-3-flash,zai/glm-4.7,minimax/minimax-m2.5" pnpm test:live src/gateway/gateway-models.profiles.live.test.ts` +`OPENCLAW_LIVE_GATEWAY_MODELS="openai/gpt-5.2,openai-codex/gpt-5.4,anthropic/claude-opus-4-6,google/gemini-3.1-pro-preview,google/gemini-3-flash-preview,google-antigravity/claude-opus-4-6-thinking,google-antigravity/gemini-3-flash,zai/glm-4.7,minimax/minimax-m2.5" pnpm test:live src/gateway/gateway-models.profiles.live.test.ts` ### Baseline: tool calling (Read + optional Exec) @@ -291,7 +291,7 @@ Pick at least one per provider family: - OpenAI: `openai/gpt-5.2` (or `openai/gpt-5-mini`) - Anthropic: `anthropic/claude-opus-4-6` (or `anthropic/claude-sonnet-4-5`) -- Google: `google/gemini-3-flash-preview` (or `google/gemini-3-pro-preview`) +- Google: `google/gemini-3-flash-preview` (or `google/gemini-3.1-pro-preview`) - Z.AI (GLM): `zai/glm-4.7` - MiniMax: `minimax/minimax-m2.5` diff --git a/docs/nodes/media-understanding.md b/docs/nodes/media-understanding.md index ad784f22e5b..dae748633bd 100644 --- a/docs/nodes/media-understanding.md +++ b/docs/nodes/media-understanding.md @@ -337,7 +337,7 @@ When `mode: "all"`, outputs are labeled `[Image 1/2]`, `[Audio 2/2]`, etc. models: [ { provider: "google", - model: "gemini-3-pro-preview", + model: "gemini-3.1-pro-preview", capabilities: ["image", "video", "audio"], }, ], @@ -346,7 +346,7 @@ When `mode: "all"`, outputs are labeled `[Image 1/2]`, `[Audio 2/2]`, etc. models: [ { provider: "google", - model: "gemini-3-pro-preview", + model: "gemini-3.1-pro-preview", capabilities: ["image", "video", "audio"], }, ], @@ -355,7 +355,7 @@ When `mode: "all"`, outputs are labeled `[Image 1/2]`, `[Audio 2/2]`, etc. models: [ { provider: "google", - model: "gemini-3-pro-preview", + model: "gemini-3.1-pro-preview", capabilities: ["image", "video", "audio"], }, ], diff --git a/src/agents/models-config.providers.google-antigravity.test.ts b/src/agents/models-config.providers.google-antigravity.test.ts index 6879a392277..2d073cf362e 100644 --- a/src/agents/models-config.providers.google-antigravity.test.ts +++ b/src/agents/models-config.providers.google-antigravity.test.ts @@ -4,6 +4,7 @@ import { join } from "node:path"; import { describe, expect, it } from "vitest"; import { normalizeAntigravityModelId, + normalizeGoogleModelId, normalizeProviders, type ProviderConfig, } from "./models-config.providers.js"; @@ -47,6 +48,13 @@ describe("normalizeAntigravityModelId", () => { }); }); +describe("normalizeGoogleModelId", () => { + it("maps the deprecated 3.1 flash alias to the real preview model", () => { + expect(normalizeGoogleModelId("gemini-3.1-flash")).toBe("gemini-3-flash-preview"); + expect(normalizeGoogleModelId("gemini-3.1-flash-preview")).toBe("gemini-3-flash-preview"); + }); +}); + describe("google-antigravity provider normalization", () => { it("normalizes bare gemini pro IDs only for google-antigravity providers", () => { const agentDir = mkdtempSync(join(tmpdir(), "openclaw-test-")); diff --git a/src/agents/models-config.providers.ts b/src/agents/models-config.providers.ts index 1d2463ee6f4..e7cf16d7af9 100644 --- a/src/agents/models-config.providers.ts +++ b/src/agents/models-config.providers.ts @@ -547,8 +547,11 @@ export function normalizeGoogleModelId(id: string): string { if (id === "gemini-3.1-pro") { return "gemini-3.1-pro-preview"; } - if (id === "gemini-3.1-flash") { - return "gemini-3.1-flash-preview"; + // Preserve compatibility with earlier OpenClaw docs/config that pointed at a + // non-existent Gemini Flash preview ID. Google's current Flash text model is + // `gemini-3-flash-preview`. + if (id === "gemini-3.1-flash" || id === "gemini-3.1-flash-preview") { + return "gemini-3-flash-preview"; } return id; } diff --git a/src/config/defaults.ts b/src/config/defaults.ts index 71a046fb8d4..e9e1a02c1f8 100644 --- a/src/config/defaults.ts +++ b/src/config/defaults.ts @@ -29,7 +29,7 @@ const DEFAULT_MODEL_ALIASES: Readonly> = { // Google Gemini (3.x are preview ids in the catalog) gemini: "google/gemini-3.1-pro-preview", - "gemini-flash": "google/gemini-3.1-flash-preview", + "gemini-flash": "google/gemini-3-flash-preview", }; const DEFAULT_MODEL_COST: ModelDefinitionConfig["cost"] = { diff --git a/src/config/model-alias-defaults.test.ts b/src/config/model-alias-defaults.test.ts index dfe0d70a103..1d844b4d1b4 100644 --- a/src/config/model-alias-defaults.test.ts +++ b/src/config/model-alias-defaults.test.ts @@ -68,7 +68,7 @@ describe("applyModelDefaults", () => { defaults: { models: { "google/gemini-3.1-pro-preview": { alias: "" }, - "google/gemini-3.1-flash-preview": {}, + "google/gemini-3-flash-preview": {}, }, }, }, @@ -77,7 +77,7 @@ describe("applyModelDefaults", () => { const next = applyModelDefaults(cfg); expect(next.agents?.defaults?.models?.["google/gemini-3.1-pro-preview"]?.alias).toBe(""); - expect(next.agents?.defaults?.models?.["google/gemini-3.1-flash-preview"]?.alias).toBe( + expect(next.agents?.defaults?.models?.["google/gemini-3-flash-preview"]?.alias).toBe( "gemini-flash", ); });