Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Merge branch 'litellm_internal_staging' into feature/improve-gigachat-provider

KnyazSh736411bd6792
diff --cc litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
index 3dab313bd5c,9a3bc82c6fa..a3fe2911038
--- a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
@@@ -6,8 -6,7 +6,9 @@@ Provider-specific Pass-Through Endpoint
Use litellm with Anthropic SDK, Vertex AI SDK, Cohere SDK, etc.
"""
+from __future__ import annotations
+
+ import hmac
import json
import os
import re
@@@ -28,11 -27,15 +29,16 @@@ from litellm.constants import
BEDROCK_AGENT_RUNTIME_PASS_THROUGH_ROUTES,
)
from litellm.llms.anthropic.common_utils import AnthropicModelInfo
+from litellm.llms.custom_httpx.http_handler import get_async_httpx_client
from litellm.llms.vertex_ai.vertex_llm_base import VertexBase
from litellm.proxy._types import *
+ from litellm.proxy.auth.handle_jwt import JWTHandler
from litellm.proxy.auth.route_checks import RouteChecks
- from litellm.proxy.auth.user_api_key_auth import user_api_key_auth, user_api_key_auth_websocket
+ from litellm.proxy.auth.user_api_key_auth import (
+ _get_bearer_token,
+ user_api_key_auth,
+ user_api_key_auth_websocket,
+ )
from litellm.proxy.common_utils.http_parsing_utils import (
_read_request_body,
_safe_get_request_headers,
@@@ -1760,14 -1888,16 +1902,16 @@@ async def _prepare_vertex_auth_headers
vertex_location: Vertex location
base_target_url: Base URL for the Vertex AI service
get_vertex_pass_through_handler: Handler for the specific Vertex AI service
+ user_api_key_dict: The caller's resolved authentication, so only the secret that
+ authenticated them is stripped on the credential-less branch
Returns:
- Tuple containing:
+ tuple containing:
- headers: dict - Authentication headers to use
- - base_target_url: Optional[str] - Updated base target URL
+ - base_target_url: str | None - Updated base target URL
- headers_passed_through: bool - Whether headers were passed through from request
- - vertex_project: Optional[str] - Updated vertex project ID
- - vertex_location: Optional[str] - Updated vertex location
+ - vertex_project: str | None - Updated vertex project ID
+ - vertex_location: str | None - Updated vertex location
"""
vertex_llm_base: Final = VertexBase()
headers_passed_through = False
diff --cc tests/test_litellm/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py
index 9b2b4238c5b,3b506324ad7..b138ddc6711
--- a/tests/test_litellm/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py
+++ b/tests/test_litellm/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py
@@@ -11,12 -12,12 +12,14 @@@ from unittest.mock import AsyncMock, Ma
import httpx
import pytest
from fastapi import HTTPException, Request, Response
+from fastapi.responses import StreamingResponse
from fastapi.testclient import TestClient
+ from starlette.datastructures import FormData
import litellm
+from litellm.proxy.common_request_processing import ProxyBaseLLMRequestProcessing
+ from litellm.constants import LITELLM_PROXY_MASTER_KEY_ALIAS
from litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints import (
BaseOpenAIPassThroughHandler,
RouteChecks,