Skip to content

feat(models): add Claude Sonnet 4.5 and Opus 4.8 model definitions - #28803

Closed
RussellZager wants to merge 20 commits into
google-gemini:mainfrom
RussellZager:feat/claude-4-5-models
Closed

RussellZager wants to merge 20 commits into
google-gemini:mainfrom
RussellZager:feat/claude-4-5-models

Conversation

@RussellZager

Copy link
Copy Markdown

Summary

  • Adds claude-sonnet-4-5 and claude-opus-4-8 model constants, alias resolution, and policy chain fallbacks.
  • Updates resolveModel mapping to handle explicit version IDs (claude-4-5-sonnet, claude-4-8-opus).
  • Updates DEFAULT_MODEL_CONFIGS with display names and descriptions.
  • Ensures all unit and typecheck suites pass cleanly.

Test Plan

  • Ran npm run test:claude (16 passing tests)
  • Ran policy catalog unit tests (14 passing tests)
  • Ran npm run typecheck (zero TypeScript errors)

@RussellZager
RussellZager requested review from a team as code owners August 13, 2026 20:01
@github-actions github-actions Bot added the size/xl An extra large PR label Aug 13, 2026
@github-actions

Copy link
Copy Markdown

📊 PR Size: size/XL

  • Lines changed: 20912
  • Additions: +17889
  • Deletions: -3023
  • Files changed: 77

@github-actions

Copy link
Copy Markdown

🛑 Action Required: Evaluation Approval

Steering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged.

Maintainers:

  1. Go to the Workflow Run Summary.
  2. Click the yellow 'Review deployments' button.
  3. Select the 'eval-gate' environment and click 'Approve'.

Once approved, the evaluation results will be posted here automatically.

@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 introduces support for new Claude models, specifically Claude Sonnet 4.5 and Claude Opus 4.8. The changes include defining these models within the system, updating the model resolution logic to handle their specific version IDs, and ensuring that the default configurations are updated to include these new options. The changes have been validated through the existing test infrastructure to ensure stability and correctness.

Highlights

  • Model Definitions: Added claude-sonnet-4-5 and claude-opus-4-8 model constants, including alias resolution and policy chain fallbacks.
  • Mapping Updates: Updated resolveModel to support explicit version IDs and updated DEFAULT_MODEL_CONFIGS with appropriate display names and descriptions.
  • Testing: Verified changes with updated unit and typecheck suites, ensuring clean passes for Claude-related functionality.
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. ↩

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

Copy link
Copy Markdown
Contributor

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 implements a comprehensive integration of Anthropic Claude models (including Sonnet 5 and Opus 5) into the Gemini CLI, introducing direct Anthropic SDK and Vertex AI Claude routing via AnthropicContentGenerator, along with dual-mode execution launchers, custom fallback policies, and extensive testing harnesses. The review comments correctly identify two critical issues: first, VERTEX_CLAUDE_MODEL_MAP incorrectly maps Claude aliases back to themselves instead of actual Vertex AI publisher model IDs, which will trigger 404 errors on Vertex AI; second, an integration test in claudeModelRouting.test.ts expects AuthType.GATEWAY instead of the newly updated AuthType.USE_GEMINI, which will cause test failures. Both comments are highly actionable and should be addressed.

Note: Security Review did not run due to the size of the PR.

Comment on lines +739 to +749
export const VERTEX_CLAUDE_MODEL_MAP: Record<string, string> = {
[CLAUDE_SONNET_5_MODEL]: CLAUDE_SONNET_5_MODEL,
[CLAUDE_OPUS_5_MODEL]: CLAUDE_OPUS_5_MODEL,
[CLAUDE_SONNET_4_5_MODEL]: CLAUDE_SONNET_4_5_MODEL,
[CLAUDE_OPUS_4_8_MODEL]: CLAUDE_OPUS_4_8_MODEL,
'claude-4-5-sonnet': CLAUDE_SONNET_4_5_MODEL,
'claude-4-8-opus': CLAUDE_OPUS_4_8_MODEL,
'claude-3-5-sonnet': CLAUDE_SONNET_5_MODEL,
'claude-3-7-sonnet': 'claude-3-7-sonnet',
'claude-3-opus': 'claude-3-opus',
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The VERTEX_CLAUDE_MODEL_MAP currently maps canonical Claude model aliases (like CLAUDE_SONNET_5_MODEL / 'claude-sonnet-5') back to themselves. However, GCP Vertex AI endpoints do not support these generic alias strings directly and will reject them with a ModelNotFoundError (404).

As correctly outlined in the proposal (docs/proposals/cli-launcher-refactoring.md), these aliases must be mapped to the actual Vertex AI publisher model IDs (e.g., 'claude-3-5-sonnet-v2@20241022', 'claude-3-opus@20240229').

Suggested change
export const VERTEX_CLAUDE_MODEL_MAP: Record<string, string> = {
[CLAUDE_SONNET_5_MODEL]: CLAUDE_SONNET_5_MODEL,
[CLAUDE_OPUS_5_MODEL]: CLAUDE_OPUS_5_MODEL,
[CLAUDE_SONNET_4_5_MODEL]: CLAUDE_SONNET_4_5_MODEL,
[CLAUDE_OPUS_4_8_MODEL]: CLAUDE_OPUS_4_8_MODEL,
'claude-4-5-sonnet': CLAUDE_SONNET_4_5_MODEL,
'claude-4-8-opus': CLAUDE_OPUS_4_8_MODEL,
'claude-3-5-sonnet': CLAUDE_SONNET_5_MODEL,
'claude-3-7-sonnet': 'claude-3-7-sonnet',
'claude-3-opus': 'claude-3-opus',
};
export const VERTEX_CLAUDE_MODEL_MAP: Record<string, string> = {
[CLAUDE_SONNET_5_MODEL]: 'claude-3-5-sonnet-v2@20241022',
[CLAUDE_OPUS_5_MODEL]: 'claude-3-opus@20240229',
[CLAUDE_SONNET_4_5_MODEL]: 'claude-3-5-sonnet-v2@20241022',
[CLAUDE_OPUS_4_8_MODEL]: 'claude-3-opus@20240229',
'claude-4-5-sonnet': 'claude-3-5-sonnet-v2@20241022',
'claude-4-8-opus': 'claude-3-opus@20240229',
'claude-3-5-sonnet': 'claude-3-5-sonnet-v2@20241022',
'claude-3-7-sonnet': 'claude-3-7-sonnet@20250219',
'claude-3-opus': 'claude-3-opus@20240229',
};

Comment on lines +44 to +53
it('should preserve environment-configured authType without forcing Vertex AI when GOOGLE_GEMINI_BASE_URL is present', () => {
const originalEnv = { ...process.env };
delete process.env['GOOGLE_GENAI_USE_VERTEXAI'];
process.env['GOOGLE_GEMINI_BASE_URL'] = 'http://127.0.0.1:4000';

const authType = getAuthTypeFromEnv(CLAUDE_OPUS_5_MODEL);
expect(authType).toBe(AuthType.GATEWAY);

process.env = originalEnv;
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The integration test asserts that getAuthTypeFromEnv(CLAUDE_OPUS_5_MODEL) returns AuthType.GATEWAY. However, in packages/core/src/core/contentGenerator.ts, the environment check for GOOGLE_GEMINI_BASE_URL was updated to return AuthType.USE_GEMINI instead of AuthType.GATEWAY. This mismatch will cause this integration test to fail.

Suggested change
it('should preserve environment-configured authType without forcing Vertex AI when GOOGLE_GEMINI_BASE_URL is present', () => {
const originalEnv = { ...process.env };
delete process.env['GOOGLE_GENAI_USE_VERTEXAI'];
process.env['GOOGLE_GEMINI_BASE_URL'] = 'http://127.0.0.1:4000';
const authType = getAuthTypeFromEnv(CLAUDE_OPUS_5_MODEL);
expect(authType).toBe(AuthType.GATEWAY);
process.env = originalEnv;
});
it('should preserve environment-configured authType without forcing Vertex AI when GOOGLE_GEMINI_BASE_URL is present', () => {
const originalEnv = { ...process.env };
delete process.env['GOOGLE_GENAI_USE_VERTEXAI'];
process.env['GOOGLE_GEMINI_BASE_URL'] = 'http://127.0.0.1:4000';
const authType = getAuthTypeFromEnv(CLAUDE_OPUS_5_MODEL);
expect(authType).toBe(AuthType.USE_GEMINI);
process.env = originalEnv;
});

This branch had an error being deployed

1 failed deployment
eval-gate — 58005bee Deployed Aug 13, 2026 by RussellZager via Evaluate Steering & Regressions #1776
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl An extra large PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants