#23034: Add Gemini 3.1 Pro to Google model normalizer and OpenCode Zen catalog
agents
size: XS
trusted-contributor
Cluster:
Gemini Provider Enhancements
## Problem
Gemini 3.1 Pro (`gemini-3.1-pro-preview`) launched on 2026-02-19 with improved reasoning capabilities. Users who set `gemini-3.1-pro` in their Google provider config or pick it via OpenCode Zen aliases get unknown-model errors because:
1. `normalizeGoogleModelId` only handles `gemini-3-pro` → `gemini-3-pro-preview`, not the 3.1 variant
2. The OpenCode Zen alias table still points `gemini`/`gemini-pro` at the older `gemini-3-pro`
3. The Zen static fallback catalog has no entry for `gemini-3.1-pro`
Existing PRs cover antigravity (#21920, #22899) and gemini-cli (#21181) providers, but the direct Google API key path and OpenCode Zen were not addressed.
## Changes
- **`models-config.providers.ts`**: add `gemini-3.1-pro` → `gemini-3.1-pro-preview` mapping in `normalizeGoogleModelId`
- **`opencode-zen-models.ts`**:
- Update aliases: `gemini`, `gemini-pro`, `gemini-3` now point to `gemini-3.1-pro`; add `gemini-3.1` alias; keep `gemini-3-pro` as legacy alias
- Add `gemini-3.1-pro` to cost table ($2/$12 per 1M tokens, same as 3.0), context window (1M), max output (65536), display name, and static fallback list
## Tests
5 new tests in `models-config.normalize-google.test.ts` covering all normalize paths.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds support for Gemini 3.1 Pro (`gemini-3.1-pro-preview`) across Google model normalizer and OpenCode Zen catalog. Updates primary aliases (`gemini`, `gemini-pro`, `gemini-3`) to point to the newer 3.1 variant, while keeping `gemini-3-pro` as a legacy alias that now redirects to 3.1. Adds comprehensive test coverage for the Google normalizer function.
**Major changes:**
- `normalizeGoogleModelId`: adds `gemini-3.1-pro` → `gemini-3.1-pro-preview` mapping
- OpenCode Zen aliases: updated `gemini`/`gemini-pro`/`gemini-3` to resolve to `gemini-3.1-pro`; added `gemini-3.1` alias; converted `gemini-3-pro` to legacy alias
- Model catalog: added `gemini-3.1-pro` entries for cost ($2/$12), context window (1M), max output (65536), display name, and static fallback list
- Tests: 5 new test cases for `normalizeGoogleModelId`
**Issues found:**
- Breaking test failures in `opencode-zen-models.e2e.test.ts` - 4 test assertions expect aliases to resolve to `gemini-3-pro` but now resolve to `gemini-3.1-pro`
- Static fallback model count increased from 10 to 11, breaking length assertion
<h3>Confidence Score: 2/5</h3>
- This PR contains breaking test failures that will prevent CI from passing
- The implementation is clean and comprehensive, with proper test coverage for the new normalizer function. However, the PR modifies alias mappings without updating existing tests in `opencode-zen-models.e2e.test.ts`. Four test assertions (lines 19, 27, 90, 99) expect `gemini-3-pro` but will now receive `gemini-3.1-pro`, and the static fallback model count test (line 56) expects 10 models but will now see 11. These are guaranteed test failures that block merging.
- The test file `src/agents/opencode-zen-models.e2e.test.ts` needs updates to match the new alias mappings and model count
<sub>Last reviewed commit: 383299b</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23424: feat: add Gemini 3.1 Pro Preview support (google-gemini-cli)
by hongchanroh · 2026-02-22
83.8%
#21257: # feat: add Gemini 3.1 Pro (low/high reasoning) model support
by GhadiSaab · 2026-02-19
83.5%
#21263: fix: add google-vertex support for Gemini 3.1 models
by pdd-cli · 2026-02-19
82.4%
#23040: Upgrade default Google model to Gemini 3.1 Pro and add Venice catal...
by Clawborn · 2026-02-21
82.2%
#22899: fix(models): synthesize antigravity Gemini 3.1 pro high/low models
by Phineas1500 · 2026-02-21
81.2%
#21181: fix(models): add gemini-3.1-pro-preview forward-compat for google-g...
by Mellowambience · 2026-02-19
80.4%
#22337: fix(models): add fallback Gemini 3.1 Pro Preview catalog entry
by AIflow-Labs · 2026-02-21
79.1%
#21920: fix(antigravity): map deprecated Gemini 3 Pro to Gemini 3.1 Pro
by Asm3r96 · 2026-02-20
78.5%
#23129: build(deps): move @discordjs/opus to optionalDependencies
by Imccccc · 2026-02-22
78.3%
#15205: fix(models): normalize google-antigravity api field from google-gem...
by wboudy · 2026-02-13
76.6%