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]

fix(gigachat): honor ssl_verify config on router passthrough and type the request body

mateo-berrice52e39052ea
diff --git a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
index 0ddcf99a938..6c7d0c92e58 100644
--- a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
@@ -2839,10 +2839,11 @@ async def gigachat_proxy_route(
)
## check for streaming
- request_body: Final = await get_request_body(request) # pyright: ignore[reportUnknownVariableType] # get_request_body returns Unknown
+ request_body: Final[dict[str, object]] = await get_request_body(request)
is_router_model = False # rebind-ok: conditionally set to True when model uses router
- model: Final = request_body.get("model") # pyright: ignore[reportUnknownVariableType] # get_request_body returns Unknown
+ raw_model: Final = request_body.get("model")
+ model: Final = raw_model if isinstance(raw_model, str) else None
if model:
is_router_model = is_passthrough_request_using_router_model(
request_body, llm_router
@@ -2995,7 +2996,6 @@ async def handle_gigachat_passthrough_router_model(
llm_provider=LlmProviders.GIGACHAT,
params={ # mutable-ok: httpx client params
"timeout": httpx.Timeout(timeout=600.0, connect=5.0),
- "ssl_verify": False,
},
)
diff --git 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
index b969917c8ab..225e1b3d998 100644
--- 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
@@ -2228,6 +2228,7 @@ class TestGigachatProxyRoute:
assert isinstance(result, Response)
assert result.status_code == 200
assert captured_kwargs["target"] == "https://gigachat.devices.sberbank.ru/api/v1/models"
+ assert captured_kwargs["custom_headers"] == {"Authorization": "Bearer gigachat-test-token"}
@pytest.mark.asyncio
async def test_allm_passthrough_streaming_preserves_upstream_headers(self):