litellm/tests/e2e/llm_translation
mubashir1osmani ef030235fd
test(e2e): add vertex_ai passthrough spend-log coverage (#31781)
* test(e2e): add vertex_ai passthrough spend-log coverage

Port the de-flake of the SDK-based vertex spend test (#31689) into the
tests/e2e/llm_translation harness. The vertexai SDK intermittently ignored the
proxy api_endpoint override and billed Vertex directly, so the request never
reached LiteLLM and no spend was logged; driving native generateContent over the
shared transport always reaches the proxy, which the harness already guarantees.

The vertex deployment is added at runtime through /model/new with
use_in_pass_through rather than declared in the gateway config, and deleted on
teardown. That registers the deployment's service account for the /vertex_ai
route, so the passthrough call sends only its litellm virtual key in
x-litellm-api-key and no upstream bearer, and the proxy mints the Vertex token
itself. The credential is the one the proxy already holds, read from the same
VERTEXAI_CREDENTIALS/VERTEXAI_PROJECT env; the test never mints a token.

Asserts both that the forward succeeds and that a costed SpendLogs row lands
(vertex_ai provider, a gemini model, spend > 0, call_type pass_through_endpoint),
correlated by the x-litellm-call-id header.

* Update tests/e2e/llm_translation/test_vertex_passthrough_e2e.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Update tests/e2e/llm_translation/test_vertex_passthrough_e2e.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-07-02 17:32:46 -07:00
..
conftest.py test: add e2e tests for spend, budgets and llms (#30869) 2026-06-24 15:01:57 -07:00
LLM_TRANSLATION_COVERAGE_MATRIX.md test(e2e): add vertex_ai passthrough spend-log coverage (#31781) 2026-07-02 17:32:46 -07:00
passthrough_client.py test(e2e): add vertex_ai passthrough spend-log coverage (#31781) 2026-07-02 17:32:46 -07:00
test_custom_pricing_e2e.py test(e2e): drop xfail markers for the now-fixed team-budget-JSON and custom-pricing-leak bugs (#31249) 2026-06-24 18:51:10 -07:00
test_ocr_rust_e2e.py test(e2e): move rust OCR e2e into llm_translation on the shared harness 2026-06-26 19:21:55 -07:00
test_passthrough_e2e.py test: add e2e tests for spend, budgets and llms (#30869) 2026-06-24 15:01:57 -07:00
test_vertex_passthrough_e2e.py test(e2e): add vertex_ai passthrough spend-log coverage (#31781) 2026-07-02 17:32:46 -07:00