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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Merge remote-tracking branch 'origin/main' into litellm_migrate_tests_p12
yuneng69133cc8cf81
diff --cc tests/unit/conftest.pyindex fa91437964f,b3bb19a8b8a..73a555e4455--- a/tests/unit/conftest.py+++ b/tests/unit/conftest.py@@@ -1,28 -1,27 +1,41 @@@import os+ from collections.abc import Iteratorfrom typing import Final+import litellmimport pytestfrom pytest_socket import enable_socket, socket_allow_hostsos.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"+ import litellm # noqa: E402 # litellm reads LITELLM_LOCAL_MODEL_COST_MAP at import+ import litellm.router as litellm_router_module # noqa: E402 # same import-time dependency+ import litellm.utils as litellm_utils_module # noqa: E402 # same import-time dependency+LOOPBACK_HOSTS: Final = ["127.0.0.1", "::1"]+ AMBIENT_AZURE_CREDENTIAL_ENV_VARS: Final = (+ "AZURE_AD_TOKEN",+ "AZURE_TENANT_ID",+ "AZURE_CLIENT_ID",+ "AZURE_CLIENT_SECRET",+ "AZURE_USERNAME",+ "AZURE_PASSWORD",+ )+def local_model_cost_map(monkeypatch):+ original_model_cost = litellm.model_cost+ monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")+ litellm.model_cost = litellm.get_model_cost_map(url="")+ litellm.get_model_info.cache_clear()+ try:+ yield+ finally:+ litellm.model_cost = original_model_cost+ litellm.get_model_info.cache_clear()++def _allow_loopback_only() -> None:socket_allow_hosts(LOOPBACK_HOSTS, allow_unix_socket=True)