litellm/tests/e2e/claude_code/passthrough/test_vertex_ai.py
Mateo Wang 28b58b8d72
test(e2e): move the Claude Code matrix to Opus, Sonnet and Haiku 5.5, Fable 5.2 and GPT-6 (#54305)
* test(e2e): move the Claude Code matrix to Opus, Sonnet and Haiku 5.5 and add Fable 5.2

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(e2e): drop Fable 5.2 from the Bedrock cells of the Claude Code matrix

The stage account behind the e2e Bedrock role has no Marketplace subscription for Fable 5.2, so every Bedrock Invoke and Converse call to it answers 403

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(e2e): move the GPT cells of the Claude Code matrix to GPT-6 and add Astra

OpenAI and Bedrock Mantle move to gpt-6.2-sol, gpt-6.1-terra and gpt-6-luna and gain gpt-6.2-astra. Azure OpenAI moves to gpt-6.1-sol and gpt-6-luna, gains gpt-6-astra, and keeps gpt-5.6-terra because Azure has no GPT-6 Terra

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(e2e): shorten the Bedrock Fable omission notes to a TODO

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(e2e): drop the repeated Azure Terra notes and keep one TODO in the config

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-25 01:47:03 +00:00

55 lines
2 KiB
Python

"""passthrough x Vertex AI.
Drive the real `claude` CLI in vertex mode (CLAUDE_CODE_USE_VERTEX=1)
with ANTHROPIC_VERTEX_BASE_URL aimed at the proxy's `/vertex_ai`
passthrough route. The CLI speaks the native rawPredict wire --
`POST .../projects/{p}/locations/{l}/publishers/anthropic/models/{model}:streamRawPredict`
-- with the proxy alias in the model segment; the proxy resolves the
alias through its router, replaces the placeholder project/location
path segments with the deployment's `vertex_project` /
`vertex_location`, and attaches its own Google credentials
(CLAUDE_CODE_SKIP_VERTEX_AUTH=1 keeps the CLI from minting a token).
The (feature, provider) for this cell is inferred from the file path by
`tests/e2e/claude_code/conftest.py`:
tests/e2e/claude_code/passthrough/test_vertex_ai.py
^^^^^^^^^^^ ^^^^^^^^^
feature_id provider
This cell requires the vertex deployments in the proxy config to carry
`use_in_pass_through: true` (see test_config.yaml) -- that is what
registers their credentials with the passthrough router. Without it
the proxy forwards the CLI's own headers (the virtual-key bearer) to
Google and every tier fails with a 401.
"""
from __future__ import annotations
from e2e_metadata import Domain, Mode, Provider, Route, Subject, meta
from claude_code._passthrough import run_passthrough_cell, vertex_extra_env
VERTEX_MODELS = [
"claude-haiku-5-5-vertex",
"claude-sonnet-5-5-vertex",
"claude-opus-5-5-vertex",
]
@meta(
Subject(
domain=Domain.PASSTHROUGH,
route=Route.PASSTHROUGH,
providers=(Provider.VERTEX_AI,),
models=tuple(VERTEX_MODELS),
mode=Mode.STREAM,
)
)
def test_passthrough_vertex_ai(compat_result):
"""Drive the `claude` CLI through `{proxy}/vertex_ai` and assert a reply."""
run_passthrough_cell(
compat_result=compat_result,
models=VERTEX_MODELS,
prompt="Reply with the single word 'pong' and nothing else.",
build_extra_env=vertex_extra_env,
)