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 : mypy error

Sameer Kankute980860a8277d
diff --git a/litellm/main.py b/litellm/main.py
index f4d8609b21e..6e069988726 100644
--- a/litellm/main.py
+++ b/litellm/main.py
@@ -6538,10 +6538,18 @@ def speech( # noqa: PLR0915
if api_key is not None:
litellm_params_dict["api_key"] = api_key
+ # Convert voice to string if it's a dict (minimax handler expects Optional[str])
+ voice_str: Optional[str] = None
+ if isinstance(voice, str):
+ voice_str = voice
+ elif isinstance(voice, dict):
+ # Extract voice_id from dict if needed
+ voice_str = voice.get("voice_id") or voice.get("id") or voice.get("name")
+
response = base_llm_http_handler.text_to_speech_handler(
model=model,
input=input,
- voice=voice,
+ voice=voice_str,
text_to_speech_provider_config=minimax_config,
text_to_speech_optional_params=optional_params,
custom_llm_provider=custom_llm_provider,