Skip to content

feat: add gemini-3.1-pro-preview support#21543

Closed
Imccccc wants to merge 6 commits intoopenclaw:mainfrom
Imccccc:feat/gemini-3.1
Closed

feat: add gemini-3.1-pro-preview support#21543
Imccccc wants to merge 6 commits intoopenclaw:mainfrom
Imccccc:feat/gemini-3.1

Conversation

@Imccccc
Copy link
Contributor

@Imccccc Imccccc commented Feb 20, 2026

Adds explicit catalog fallback and alias for gemini-3.1-pro-preview to unblock usage before upstream pi-ai update.

Greptile Summary

Adds explicit catalog fallback and alias for gemini-3.1-pro-preview model to enable usage before upstream pi-ai update. The implementation follows existing patterns:

  • Adds applyGemini31PreviewFallback function to inject model entry if not present in catalog
  • Adds "gemini-3.1" alias mapping to "google/gemini-3.1-pro-preview" in defaults
  • Model configuration includes 2M context window, reasoning support, and text+image input

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation follows established patterns for model fallbacks (identical structure to applyOpenAICodexSparkFallback), adds a simple alias mapping consistent with existing Gemini aliases, and introduces no breaking changes. The fallback function safely checks for model existence before adding it, preventing duplicates.
  • No files require special attention

Last reviewed commit: 7c05c1f

@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: XS commands Command implementations size: S and removed size: XS commands Command implementations labels Feb 20, 2026
Copy link

@freddyteddy123 freddyteddy123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smartcommit

Copy link

@freddyteddy123 freddyteddy123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AIO

Copy link

@freddyteddy123 freddyteddy123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VivallaTrallalla

Copy link

@freddyteddy123 freddyteddy123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok . Co mr ted jonson

Copy link

@freddyteddy123 freddyteddy123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:d

@Sapientropic
Copy link

Confirmed working workaround on macOS with openclaw@2026.2.19-2 (API route, no OAuth):

  • Set GEMINI_API_KEY
  • Add google/gemini-3.1-pro-preview to allowed models
  • In models.providers.google, set:
    • baseUrl: https://generativelanguage.googleapis.com/v1beta
    • api: google-generative-ai
    • add model id gemini-3.1-pro-preview in provider catalog
  • Restart gateway and verify with:
    • openclaw models status --json --agent gemini
    • openclaw agent --local --agent gemini --message 'just reply OK' --json --timeout 45

Result from local validation:

  • meta.agentMeta.provider=google
  • meta.agentMeta.model=gemini-3.1-pro-preview

I documented reproducible steps here:
https://github.com/Sapientropic/openclaw-gemini-31pro-api-guide

If useful, maintainers can either merge the provider catalog update or keep this as temporary workaround in docs.

@Sapientropic
Copy link

Follow-up: please also watch the adaptation details, not only adding one model id.

From real integration testing, these are the common breakpoints:

  1. Name/alias normalization

    • users may use variants like gemini31, gemini-3.1pro, gemini-3.1-pro-preview
    • route resolution should be deterministic to the canonical id
  2. Provider catalog + capability alignment

    • provider model catalog entry and allowed model list should be updated together
    • avoid config/validation passing but runtime resolving to unknown model
  3. Modality schema compatibility

    • if Gemini 3.1 model capabilities include more modalities, schema should not reject them at validation time
    • related context: model input union constraints can block otherwise valid configs
  4. Regression checks

    • keep gemini-3-pro-preview baseline green while adding 3.1
    • include one real agent --local smoke test in CI (not only static config validation)

This helps prevent the “looks added in config but still fails in runtime” class of bugs.

@Skeptomenos
Copy link

Hey there! Thanks for adding support for Gemini 3.1.

Would it be possible to also add the gemini-3.1-pro-preview-customtools endpoint to the catalog in this PR?

According to the official Google documentation, this specific variant is explicitly optimized for agentic workflows that rely on bash and custom tools, which makes it particularly relevant for OpenClaw's architecture.

It would be amazing to have native support for this endpoint out of the box! Thanks for your hard work on this.

@betasecond
Copy link

+1 for this! 🎉

Just encountered this issue today - OpenClaw currently blocks gemini-3.1-pro-preview at the local validation layer before even sending requests to Vertex AI.

Looking forward to this being merged so we can use the newly released Gemini 3.1 Pro. Thanks for the quick PR!

Imccccc pushed a commit to Imccccc/openclaw that referenced this pull request Feb 20, 2026
This update addresses feedback from PR openclaw#21543:
- Adds 'gemini-3.1-pro-preview' and 'gemini-3.1-pro-preview-customtools' to OpenCode Zen model catalog (aliases, costs, capabilities).
- Adds normalization for 'gemini-3.1-pro-customtools' -> 'gemini-3.1-pro-preview-customtools'.
- Updates tests to cover new models and aliases.
@Imccccc Imccccc force-pushed the feat/gemini-3.1 branch 2 times, most recently from edc6422 to 790051b Compare February 21, 2026 03:20
@openclaw-barnacle openclaw-barnacle bot added channel: discord Channel integration: discord gateway Gateway runtime labels Feb 21, 2026
@openclaw-barnacle openclaw-barnacle bot removed the channel: discord Channel integration: discord label Feb 21, 2026
@Imccccc Imccccc force-pushed the feat/gemini-3.1 branch 2 times, most recently from eb4090b to 3e940a8 Compare February 21, 2026 04:49
@openclaw-barnacle openclaw-barnacle bot added gateway Gateway runtime and removed gateway Gateway runtime size: S labels Feb 21, 2026
Includes:
- Defaults alias 'gemini-3.1' -> 'gemini-3.1-pro-preview'
- Normalization for 'gemini-3.1-pro' variants (including customtools)
- OpenCode Zen catalog definitions
- Model catalog fallback injection for preview models
@openclaw-barnacle openclaw-barnacle bot added the channel: msteams Channel integration: msteams label Feb 21, 2026
@Imccccc
Copy link
Contributor Author

Imccccc commented Feb 21, 2026

⚠️ CI failed on Windows in 'extensions/msteams/src/messenger.test.ts'. Diagnosed as 'isLocalPath' failing to detect temporary paths on Windows. I have updated 'isLocalPath' in 'extensions/msteams/src/media-helpers.ts' to use 'path.isAbsolute()' and support Windows long paths, which should resolve the detection issue.

@Imccccc
Copy link
Contributor Author

Imccccc commented Feb 21, 2026

Hi @Skeptomenos, thanks for the suggestion! The gemini-3.1-pro-preview-customtools model ID is already included in this PR (see applyGemini31PreviewFallback in src/agents/model-catalog.ts), so it should work out of the box once merged. 🎉

@fil512
Copy link

fil512 commented Feb 21, 2026

Is this a duplicate of #21257 ?
which one will be merged?

@Imccccc
Copy link
Contributor Author

Imccccc commented Feb 21, 2026

Is this a duplicate of #21257 ? which one will be merged?

i believe it is

@Imccccc Imccccc closed this Feb 21, 2026
@Imccccc
Copy link
Contributor Author

Imccccc commented Feb 21, 2026

Closing this PR as Release 2026.2.21 already includes Gemini 3.1 Pro support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: msteams Channel integration: msteams commands Command implementations size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants