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(utils): make supports_audio_output read the supports_audio_output cost-map key (#45294)

devin-ai-integration[bot]8683f1418ee5
diff --git a/litellm/utils.py b/litellm/utils.py
index 89544cf31e2..9ded4ff1131 100644
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@ -2962,7 +2962,7 @@ def supports_pdf_input(model: str, custom_llm_provider: str | None = None) -> bo
def supports_audio_output(model: str, custom_llm_provider: str | None = None) -> bool:
"""Check if a given model supports audio output in a chat completion call"""
- return supports_factory(model=model, custom_llm_provider=custom_llm_provider, key="supports_audio_input")
+ return supports_factory(model=model, custom_llm_provider=custom_llm_provider, key="supports_audio_output")
def supports_prompt_caching(model: str, custom_llm_provider: str | None = None) -> bool:
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
index 7551a310977..cf3e749df95 100644
--- a/tests/unit/test_utils.py
+++ b/tests/unit/test_utils.py
@@ -325,6 +325,25 @@ 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
[email protected](("audio_input", "audio_output"), [(True, False), (False, True)])
+def test_supports_audio_output_reads_its_own_cost_map_flag(
+ local_model_cost_map: None, monkeypatch: pytest.MonkeyPatch, audio_input: bool, audio_output: bool
+) -> None:
+ model: Final = "openai/audio-flags-disagree-model"
+ monkeypatch.setitem(
+ litellm.model_cost,
+ model,
+ {
+ "litellm_provider": "openai",
+ "mode": "chat",
+ "supports_audio_input": audio_input,
+ "supports_audio_output": audio_output,
+ },
+ )
+ assert litellm.supports_audio_input(model) is audio_input
+ assert litellm.supports_audio_output(model) is audio_output
+
+
def test_get_optional_params_image_gen():
from litellm.llms.azure.image_generation import AzureGPTImageGenerationConfig