Skip to content

fix(core): add aliases and thinking config for gemini-3.1 models#27007

Open
anishs1207 wants to merge 3 commits into
google-gemini:mainfrom
anishs1207:fix/core-handle-invalid-argument
Open

fix(core): add aliases and thinking config for gemini-3.1 models#27007
anishs1207 wants to merge 3 commits into
google-gemini:mainfrom
anishs1207:fix/core-handle-invalid-argument

Conversation

@anishs1207
Copy link
Copy Markdown

Summary

This PR resolves the INVALID_ARGUMENT (400) API error encountered when using Gemini 3.1 models. It ensures that all Gemini 3.1 variants are correctly mapped to the chat-base-3 configuration, which includes the mandatory thinkingLevel parameter required by the Google Generative AI API.

Details

The investigation revealed that while gemini-3.1-pro-preview was present, it lacked an entry in the aliases section of defaultModelConfigs.ts. This caused the CLI to fall back to a basic configuration that enabled "Thinking" mode but failed to provide a thinkingLevel (e.g., HIGH). Gemini 3.1 models strictly require this level when thinking is enabled; without it, the API rejects the request as an invalid argument.

Changes include:

  • Added gemini-3.1-pro-preview, gemini-3.1-pro-preview-customtools, and gemini-3.1-flash-lite-preview to the core alias registry.
  • Mapped these models to inherit from chat-base-3 to ensure ThinkingLevel.HIGH is included in all requests.

Related Issues

Fixes #26997, #27000, #27005, #26996

How to Validate

  1. Run Tests: Execute the updated test suite in packages/core/src/config/models.test.ts to ensure 3.1 models resolve with the correct config.
    • npm run test core
  2. Manual Verification: Use a Gemini 3.1 model to process a comparison prompt (e.g., "AMD Ryzen 9 9950X vs 9950X3D") and verify the 400 error no longer occurs.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • Windows (Validated via MINGW64/git-bash)
      • npm run

@anishs1207 anishs1207 requested a review from a team as a code owner May 13, 2026 18:13
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses API errors encountered when using Gemini 3.1 models by ensuring they are correctly registered and mapped to the appropriate base configuration. By inheriting from chat-base-3, these models now correctly include the required thinkingLevel parameter, preventing invalid argument errors during API requests.

Highlights

  • Model Configuration Updates: Added three new Gemini 3.1 models to the core alias registry: gemini-3.1-pro-preview, gemini-3.1-pro-preview-customtools, and gemini-3.1-flash-lite-preview.
  • Configuration Mapping: Mapped the new Gemini 3.1 models to the chat-base-3 configuration to ensure the mandatory thinkingLevel parameter is correctly included, resolving API 400 errors.
  • Test Coverage: Added comprehensive unit tests in models.test.ts to verify that all Gemini 3.1 models resolve to the expected configuration with the required thinkingLevel.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@anishs1207 anishs1207 changed the title fix(core): add aliases and thinking config for gemini-3.1 models fix(core): add aliases and thinking config for gemini-3.1 models (#27000) May 13, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds configurations for new Gemini 3.1 models (gemini-3.1-pro-preview, gemini-3.1-pro-preview-customtools, and gemini-3.1-flash-lite-preview) to the default model configurations, extending the chat-base-3 base. It also includes unit tests to ensure these models correctly resolve their configurations, specifically verifying the thinkingLevel property. I have no feedback to provide.

@gemini-cli gemini-cli Bot added the area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt label May 13, 2026
@anishs1207 anishs1207 changed the title fix(core): add aliases and thinking config for gemini-3.1 models (#27000) fix(core): add aliases and thinking config for gemini-3.1 models May 13, 2026
@anishs1207
Copy link
Copy Markdown
Author

anishs1207 commented May 13, 2026

Ready for review of PR @scidomino

@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality labels May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API Error "message": "Request contains an invalid argument."

1 participant