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
fix: allow github aliases to reuse upstream model metadata
SolitudePy7fc29dc9f107
diff --git a/litellm/utils.py b/litellm/utils.pyindex 6a18fcc9e35..241b9d217b7 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -5294,6 +5294,9 @@ def _check_provider_match(model_info: dict, custom_llm_provider: Optional[str])# as a last attempt if the model is not on Azure AI, Azure then fallback to OpenAI cost# tracking the cost is better than attributing 0 cost to it.return True+ elif custom_llm_provider == "github":+ # Allow github/<model> aliases to reuse existing provider metadata.+ return Trueelse:return Falsediff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.pyindex 7b29a4d90aa..6170f6b6f55 100644--- a/tests/test_litellm/test_utils.py+++ b/tests/test_litellm/test_utils.py@@ -56,6 +56,55 @@ def test_check_provider_match_azure_ai_allows_openai_and_azure():) is False+def test_check_provider_match_github_allows_upstream_provider_metadata():+ """+ Test that github provider can match upstream provider metadata.+ GitHub Models can provide models from multiple providers.+ """+ assert _check_provider_match(+ model_info={"litellm_provider": "openai"},+ custom_llm_provider="github",+ ) is True++ assert _check_provider_match(+ model_info={"litellm_provider": "github"},+ custom_llm_provider="github",+ ) is True++ assert _check_provider_match(+ model_info={"litellm_provider": "anthropic"},+ custom_llm_provider="github",+ ) is True+++def test_supports_function_calling_github_openai_alias():+ assert litellm.utils.supports_function_calling(model="github/gpt-4o-mini") is True+ assert (+ litellm.utils.supports_function_calling(+ model="gpt-4o-mini", custom_llm_provider="github"+ )+ is True+ )+++def test_supports_function_calling_github_anthropic_alias():+ assert (+ litellm.utils.supports_function_calling(+ model="github/claude-3-5-sonnet-latest"+ )+ is True+ )+++def test_supports_function_calling_unknown_github_alias_returns_false():+ assert (+ litellm.utils.supports_function_calling(+ model="github/non-existent-model-for-capability-check"+ )+ is False+ )++def test_get_optional_params_image_gen():from litellm.llms.azure.image_generation import AzureGPTImageGenerationConfig