#21263: fix: add google-vertex support for Gemini 3.1 models
agents
size: XS
Cluster:
Gemini 3.1 Model Enhancements
## Summary
- **`live-model-filter.ts`**: `isModernModelRef()` now recognizes `google-vertex` as a valid provider alongside `google` and `google-gemini-cli`. Previously, `google-vertex/gemini-3.1-pro-preview` fell through to `return false`, causing "Unknown model" errors.
- **`model-forward-compat.ts`**: Added forward-compat handler for `gemini-3.1-*` models that clones the corresponding `gemini-3-*` template from pi-ai's built-in catalog. This follows the same pattern used for `claude-opus-4-6` (from `claude-opus-4-5`) and `gpt-5.3-codex` (from `gpt-5.2-codex`).
## Context
Google released Gemini 3.1 Pro on Feb 19, 2026. Users configuring `google-vertex/gemini-3.1-pro-preview` hit two independent failures:
1. The model filter didn't recognize `google-vertex` as a Google provider
2. The model registry couldn't find `gemini-3.1-pro-preview` in pi-ai's catalog (which only has `gemini-3-pro-preview`)
Both fixes are needed — the filter fix alone isn't sufficient since the model still wouldn't resolve from the registry.
## Test plan
- [ ] Verify `google-vertex/gemini-3.1-pro-preview` resolves without error
- [ ] Verify `google-vertex/gemini-3.1-flash-preview` resolves without error
- [ ] Verify existing `google-vertex/gemini-3-pro-preview` still works
- [ ] Verify `google/gemini-3.1-pro-preview` also works (forward-compat covers all Google providers)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds support for Google Vertex AI's newly released Gemini 3.1 models (`gemini-3.1-pro-preview` and `gemini-3.1-flash-preview`). The fix addresses two independent failures:
- **Filter fix**: `isModernModelRef()` now recognizes `google-vertex` as a valid Google provider (line 59), allowing Gemini 3.1 requests to pass validation
- **Registry fix**: `resolveGoogleGemini31ForwardCompatModel()` clones the corresponding Gemini 3 template configurations (`gemini-3-pro-preview` → `gemini-3.1-pro-preview`, `gemini-3-flash-preview` → `gemini-3.1-flash-preview`) when the 3.1 models aren't found in pi-ai's catalog
The implementation follows established patterns from other forward-compat handlers (claude-opus-4-6, gpt-5.3-codex, glm-5) and works across all Google provider variants (`google-vertex`, `google`, `google-gemini-cli`).
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The changes are minimal, focused, and follow established patterns in the codebase. Both modifications are necessary to fully enable Gemini 3.1 support - the filter fix allows `google-vertex` provider recognition, and the forward-compat handler ensures model resolution when the catalog lacks 3.1 entries. The implementation is conservative (explicit mapping vs wildcard matching), well-documented, and consistent with other forward-compat functions.
- No files require special attention
<sub>Last reviewed commit: 8cae4e9</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#21181: fix(models): add gemini-3.1-pro-preview forward-compat for google-g...
by Mellowambience · 2026-02-19
88.1%
#22899: fix(models): synthesize antigravity Gemini 3.1 pro high/low models
by Phineas1500 · 2026-02-21
86.3%
#21257: # feat: add Gemini 3.1 Pro (low/high reasoning) model support
by GhadiSaab · 2026-02-19
85.7%
#11464: feat(models): add forward-compat fallback for gemini-3-pro-image
by ben-milanko · 2026-02-07
84.4%
#22337: fix(models): add fallback Gemini 3.1 Pro Preview catalog entry
by AIflow-Labs · 2026-02-21
82.7%
#23040: Upgrade default Google model to Gemini 3.1 Pro and add Venice catal...
by Clawborn · 2026-02-21
82.5%
#23034: Add Gemini 3.1 Pro to Google model normalizer and OpenCode Zen catalog
by Clawborn · 2026-02-21
82.4%
#23424: feat: add Gemini 3.1 Pro Preview support (google-gemini-cli)
by hongchanroh · 2026-02-22
82.3%
#13119: fix: add forward-compat for google-antigravity claude-opus-4-6 models
by sdb001 · 2026-02-10
81.1%
#16687: fix(antigravity): default to Gemini 3 Pro and remove broken depreca...
by vincentkoc · 2026-02-15
78.8%