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(health): keep realtime credential hydration immutable

Devin AIe668a313847c
diff --git a/litellm/realtime_api/main.py b/litellm/realtime_api/main.py
index 336fb3cef12..6fdadc52f13 100644
--- a/litellm/realtime_api/main.py
+++ b/litellm/realtime_api/main.py
@@ -28,8 +28,9 @@ from litellm.types.realtime import (
)
from litellm.types.router import GenericLiteLLMParams
from litellm.types.utils import CallTypes, LlmProviders
-from litellm.utils import ProviderConfigManager, load_credentials_from_list
+from litellm.utils import ProviderConfigManager
+from ..litellm_core_utils.credential_accessor import CredentialAccessor
from ..litellm_core_utils.get_litellm_params import get_litellm_params
from ..litellm_core_utils.litellm_logging import Logging as LiteLLMLogging
from ..llms.azure.common_utils import get_azure_ad_token
@@ -57,9 +58,11 @@ _EMPTY_MODEL_PARAMS: Final[Mapping[str, Any]] = MappingProxyType({})
def _model_params_with_stored_credentials(model_params: Mapping[str, Any]) -> Mapping[str, Any]:
- hydrated: Final = dict(model_params)
- load_credentials_from_list(hydrated)
- return MappingProxyType(hydrated)
+ credential_name: Final = model_params.get("litellm_credential_name")
+ credential_values: Final = (
+ CredentialAccessor.get_credential_values(credential_name) if isinstance(credential_name, str) else {}
+ )
+ return MappingProxyType({**credential_values, **model_params})
def _with_resolved_session_model(session: dict[str, object], model_name: str) -> dict[str, object]:
diff --git a/tests/test_litellm/realtime_api/test_main.py b/tests/test_litellm/realtime_api/test_main.py
index 25eeb0c407f..dcd4c01730d 100644
--- a/tests/test_litellm/realtime_api/test_main.py
+++ b/tests/test_litellm/realtime_api/test_main.py
@@ -267,10 +267,13 @@ async def test_azure_health_check_resolves_stored_credentials(monkeypatch):
model="gpt-realtime",
custom_llm_provider="azure",
api_key=None,
+ realtime_protocol="beta",
model_params={"model": "azure/gpt-realtime", "litellm_credential_name": "azure-rt"},
)
assert connect.kwargs["additional_headers"] == {"api-key": "sk-from-credential"}
- assert connect.url is not None and connect.url.startswith("wss://example.openai.azure.com")
+ assert connect.url is not None
+ assert connect.url.startswith("wss://example.openai.azure.com")
+ assert "api-version=2025-04-01-preview" in connect.url
@pytest.mark.asyncio