fix: correct gemini flash model id

This commit is contained in:
Peter Steinberger 2026-03-08 02:32:49 +00:00
parent 46008178d1
commit 100da9f45c
10 changed files with 26 additions and 14 deletions

View File

@ -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:<agent>:<channel>:<peer>` and `...:thread:<id>`) so `chat.send` does not incorrectly fall back to webchat when valid delivery context exists. Follow-up to #33786.

View File

@ -104,7 +104,7 @@ OpenClaw ships with the piai 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

View File

@ -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.

View File

@ -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.

View File

@ -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`

View File

@ -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"],
},
],

View File

@ -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-"));

View File

@ -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;
}

View File

@ -29,7 +29,7 @@ const DEFAULT_MODEL_ALIASES: Readonly<Record<string, string>> = {
// 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"] = {

View File

@ -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",
);
});