mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-30 01:08:33 +00:00
Gradium (https://gradium.ai) is a voice AI provider whose TTS had no
LiteLLM route. Adds it as a first-class TTS provider behind the existing
BaseTextToSpeechConfig seam, so `litellm.speech(model="gradium/default")`
and the proxy's /v1/audio/speech both work.
The provider targets Gradium's REST TTS endpoint
(POST /api/post/speech/tts) rather than its Python SDK, so the call
flows through base_llm_http_handler and keeps retries, logging and cost
tracking that an SDK-internal HTTP client would bypass.
Notes on the mapping:
- `only_audio: true` is always sent. Without it Gradium answers a
line-delimited JSON message stream instead of audio bytes, which
/v1/audio/speech callers cannot read.
- The six canonical OpenAI voice names map to Gradium library voice IDs;
anything else is forwarded verbatim, so raw Gradium voice IDs work.
- Gradium has no mp3/aac/flac encoder, so those response_formats raise
UnsupportedParamsError instead of silently returning mislabeled audio.
`litellm.drop_params` falls back to the default format.
- Pre-stream failures come back as HTTP 500 with a plain-text body, so
the response transform raises rather than handing the caller an opaque
binary payload.
- Cost is per character of input text (1 credit/char), priced from the
published add-on credit rate.
Backport of #46427 to lts/1.108.x.
Cherry-picked from 3342c8200a (kabooboo:feat/gradium-text-to-speech).
0 lines
Python
0 lines
Python