litellm/tests/unit/proxy/pass_through_endpoints
Matthew Lapointe ad566c90dd
fix(proxy): use OpenAI workload identity federation tokens on /openai_passthrough (#44140)
* fix(proxy): use OpenAI workload identity federation tokens on /openai_passthrough

The OpenAI passthrough routes (HTTP and websocket) only looked up a static
OpenAI API key, so proxies authenticating to OpenAI through workload identity
federation failed with "Required 'OPENAI_API_KEY'". When no non-empty static
key is configured, exchange the workload identity subject token for a bearer
token, scoped to the passthrough's own OPENAI_API_BASE so the token is never
sent to a non-OpenAI host

* fix(proxy): close the OpenAI websocket passthrough cleanly when the workload identity exchange fails

A rejected, unreachable or unreadable workload identity exchange raised out of
the websocket route before the handshake was accepted, so clients saw a bare
handshake failure. Log the cause and close with 1011 and a fixed reason instead

* refactor(openai): resolve workload identity bearer tokens for an api base in the OpenAI provider module

The passthrough route only owns the static key lookup now and asks the OpenAI
provider module for a workload identity bearer token scoped to its api base

---------

Co-authored-by: Krrish Dholakia <krrish+github@berri.ai>
2026-10-03 04:07:09 +00:00
..
llm_provider_handlers feat: add Bespoke Nimble gateway and OSS classifier support (#44246) 2026-10-02 19:37:08 -07:00
__init__.py
test_carry_guardrail_logging_info.py
test_deepgram_ws_passthrough_routes.py
test_llm_pass_through_endpoints.py fix(proxy): use OpenAI workload identity federation tokens on /openai_passthrough (#44140) 2026-10-03 04:07:09 +00:00
test_managed_id_rewriter.py
test_method_specific_routing.py
test_pass_through_endpoints.py fix(proxy): carry key, team and project tags into pass-through spend logs (#42662) 2026-10-02 19:38:44 +00:00
test_passthrough_auth_default.py
test_passthrough_endpoint_router.py
test_passthrough_endpoints_common_utils.py
test_passthrough_guardrail_block_otel_span.py feat: add Laya gateway and OSS classifier providers (#43626) 2026-10-02 11:29:36 -07:00
test_passthrough_guardrails.py
test_passthrough_guardrails_field_targeting.py
test_passthrough_post_call_guardrails.py
test_streaming_handler.py test: repair stale and polluting tests red on scheduled main CI (#44229) 2026-10-02 21:32:17 +00:00
test_streaming_handler_interrupt.py
test_upstream_usage_headers.py
test_vertex_ai_batch_passthrough.py
test_vertex_passthrough_load_balancing.py feat: add Laya gateway and OSS classifier providers (#43626) 2026-10-02 11:29:36 -07:00
test_watsonx_proxy_route.py