Register the bare model id 'claude-opus-5' to the Vertex AI route. - #758
Open
copybara-service[bot] wants to merge 1 commit into
Open
Register the bare model id 'claude-opus-5' to the Vertex AI route.#758copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test_967886387
branch
from
August 20, 2026 17:48
19114d3 to
1365924
Compare
WHY
`lf.LanguageModel.get('claude-opus-5')` returns the direct Anthropic API
client instead of the Vertex AI one. `vertexai.py` binds Anthropic models by
iterating `anthropic.SUPPORTED_MODELS` and registering only those entries
whose `provider` is 'VertexAI'. The Claude Opus 5 entry declares
`provider='Anthropic'`, so that loop skips it and the bare id stays bound to
the direct-API class registered by `anthropic.py`. Callers that select a model
purely by bare id therefore get the wrong transport. The neighbouring
claude-opus-4-6 / 4-7 / 4-8 ids avoid this because each is listed in an
explicit override block; Claude Opus 5 was absent from that block.
WHAT
One line added to `_register_vertexai_models()`:
lf.LanguageModel.register('claude-opus-5', VertexAIClaude5Opus)
HOW
The line extends the existing override block that encodes the convention
"bare model ids resolve as VertexAI (primary use case)".
`VertexAIClaude5Opus` is already defined in this module with
`model = 'claude-opus-5'`; it was declared but never registered, so no new
class, import, dependency or BUILD change is required.
Ordering is load-bearing: `_register_vertexai_models()` applies these explicit
overrides after the `SUPPORTED_MODELS` loops, so the override replaces the
earlier direct-API binding rather than being shadowed by it.
Only the bare id is registered. The sibling opus-4-x entries additionally pin
an '@latest' alias to the direct API; no such alias is defined for Opus 5, so
no corresponding line is added here.
PiperOrigin-RevId: 967886387
copybara-service
Bot
force-pushed
the
test_967886387
branch
from
August 21, 2026 22:03
1365924 to
b975131
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Register the bare model id 'claude-opus-5' to the Vertex AI route.
WHY
lf.LanguageModel.get('claude-opus-5')returns the direct Anthropic APIclient instead of the Vertex AI one.
vertexai.pybinds Anthropic models byiterating
anthropic.SUPPORTED_MODELSand registering only those entrieswhose
provideris 'VertexAI'. The Claude Opus 5 entry declaresprovider='Anthropic', so that loop skips it and the bare id stays bound tothe direct-API class registered by
anthropic.py. Callers that select a modelpurely by bare id therefore get the wrong transport. The neighbouring
claude-opus-4-6 / 4-7 / 4-8 ids avoid this because each is listed in an
explicit override block; Claude Opus 5 was absent from that block.
WHAT
One line added to
_register_vertexai_models():lf.LanguageModel.register('claude-opus-5', VertexAIClaude5Opus)
HOW
The line extends the existing override block that encodes the convention
"bare model ids resolve as VertexAI (primary use case)".
VertexAIClaude5Opusis already defined in this module withmodel = 'claude-opus-5'; it was declared but never registered, so no newclass, import, dependency or BUILD change is required.
Ordering is load-bearing:
_register_vertexai_models()applies these explicitoverrides after the
SUPPORTED_MODELSloops, so the override replaces theearlier direct-API binding rather than being shadowed by it.
Only the bare id is registered. The sibling opus-4-x entries additionally pin
an '@latest' alias to the direct API; no such alias is defined for Opus 5, so
no corresponding line is added here.