docs(google): clarify gemini 3.1 pro alias

This commit is contained in:
Peter Steinberger 2026-04-28 05:41:22 +01:00
parent 2bce63cb65
commit 66a0aa47e4
No known key found for this signature in database
4 changed files with 10 additions and 0 deletions

View file

@ -195,6 +195,7 @@ Anthropic staff told us OpenClaw-style Claude CLI usage is allowed again, so Ope
- 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 models: `google/gemini-3.1-pro-preview`, `google/gemini-3-flash-preview`
- Compatibility: legacy OpenClaw config using `google/gemini-3.1-flash-preview` is normalized to `google/gemini-3-flash-preview`
- Alias: `google/gemini-3.1-pro` is accepted and normalized to Google's live Gemini API id, `google/gemini-3.1-pro-preview`
- CLI: `openclaw onboard --auth-choice gemini-api-key`
- Thinking: `/think adaptive` uses Google dynamic thinking. Gemini 3/3.1 omit a fixed `thinkingLevel`; Gemini 2.5 sends `thinkingBudget: -1`.
- Direct Gemini runs also accept `agents.defaults.models["google/<model>"].params.cachedContent` (or legacy `cached_content`) to forward a provider-native `cachedContents/...` handle; Gemini cache hits surface as OpenClaw `cacheRead`

View file

@ -102,6 +102,8 @@ Choose your preferred auth method and follow the setup steps.
- Runtime: `google-gemini-cli`
- Alias: `gemini-cli`
Gemini 3.1 Pro's Gemini API model id is `gemini-3.1-pro-preview`. OpenClaw accepts the shorter `google/gemini-3.1-pro` as a convenience alias and normalizes it before provider calls.
**Environment variables:**
- `OPENCLAW_GEMINI_OAUTH_CLIENT_ID`

View file

@ -23,6 +23,11 @@ describe("google model id helpers", () => {
expect(normalizeGoogleModelId("gemini-3.1-flash-preview")).toBe("gemini-3-flash-preview");
});
it("keeps bare Gemini 3.1 Pro as an alias for Google's preview-suffixed API id", () => {
expect(normalizeGoogleModelId("gemini-3.1-pro")).toBe("gemini-3.1-pro-preview");
expect(normalizeGoogleModelId("gemini-3.1-pro-preview")).toBe("gemini-3.1-pro-preview");
});
it("adds the preview suffix for gemini 3.1 flash-lite", () => {
expect(normalizeGoogleModelId("gemini-3.1-flash-lite")).toBe("gemini-3.1-flash-lite-preview");
});

View file

@ -7,6 +7,8 @@ export function normalizeGoogleModelId(id: string): string {
if (id === "gemini-3-flash") {
return "gemini-3-flash-preview";
}
// Google exposes Gemini 3.1 Pro in the Gemini API as the preview-suffixed id.
// Keep the bare form as a user convenience alias, not as a canonical API id.
if (id === "gemini-3.1-pro") {
return "gemini-3.1-pro-preview";
}