litellm/gateway
mateo-berri 9799a1f16a feat(elevenlabs): stream text-to-speech over a WebSocket pass-through and bill it per character
Adds /elevenlabs/v1/text-to-speech/{voice_id}/stream-input and /multi-stream-input. The proxy authenticates the caller with a LiteLLM key, relays the session to ElevenLabs with the proxy's own xi-api-key, and writes one spend row per session at characters times the cost-map input_cost_per_character of elevenlabs/<model_id>. A missing model_id gets eleven_multilingual_v2, an unpriced model or a bad voice_id is refused with 1008 before ElevenLabs is contacted, and caller credentials are stripped from the query string and from every frame

The shared relay takes a frame policy. ElevenLabs parses each client frame once, forwards the re-serialized frame and records its text from that same parse, and closes with 1007 on a frame it cannot read, so the forwarded text and the billed text never disagree

The shared relay also changes for every WebSocket pass-through. A client that drops while upstream frames are still streaming now ends the session normally, so the success handler logs the spend for what was used instead of dropping the whole session on the failure path
2026-10-20 20:59:21 -07:00
..
routes feat(elevenlabs): stream text-to-speech over a WebSocket pass-through and bill it per character 2026-10-20 20:59:21 -07:00
Dockerfile build(docker): cache the Rust extension build in its own stage (#47033) 2026-10-16 20:49:53 -07:00
launch.py feat(proxy): let the in-container pgbouncer follow rotating RDS IAM and Azure Entra tokens (#40623) 2026-09-10 16:18:00 -07:00
main.py fix(proxy): preserve state through composed lifespans (#44214) 2026-10-02 10:56:52 -07:00