← Back to PRs

#23034: Add Gemini 3.1 Pro to Google model normalizer and OpenCode Zen catalog

by Clawborn open 2026-02-21 23:24 View on GitHub →
agents size: XS trusted-contributor
## 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