Skip to content

feat(media): support self-hosted STT/TTS providers (Whisper local, Piper, custom URL) #5740

Description

@DaBlitzStein

Problem

The STT provider list in media_understanding.rs is hardcoded to 6 cloud providers (Groq, OpenAI, MiniMax, Fireworks, Together, SiliconFlow). There is no way to point STT at a self-hosted Whisper-compatible server or use offline TTS like Piper.

For on-prem/air-gapped deployments, all voice processing must stay local. Current implementation makes this impossible.

Proposed solution

STT: custom Whisper-compatible URL

Allow audio_provider = "custom" (or any unrecognized name) with a configurable URL:

[media]
audio_provider = "local-whisper"

[media.providers.local-whisper]
url = "http://localhost:8080/v1/audio/transcriptions"
api_key = ""  # optional, local servers often don't need auth
model = "large-v3"

The Whisper API format is a de-facto standard — faster-whisper-server, whisper.cpp server, and others all implement the same /v1/audio/transcriptions multipart endpoint. No protocol changes needed, just allow custom URLs.

TTS: Piper and custom URL

Same pattern for TTS:

[tts]
provider = "piper"

[tts.providers.piper]
url = "http://localhost:5000/api/tts"
voice = "en_US-lessac-medium"

Piper runs as a local HTTP server and produces high-quality speech offline. Other self-hosted options: Coqui TTS, VITS, Bark.

Implementation notes

  • whisper_provider_config() currently returns Err for unknown providers — change to check [media.providers.<name>] config section before erroring
  • TtsConfig already has stt_url/tts_url fields but the STT code path doesn't use them — unify
  • No new dependencies needed — all self-hosted servers expose HTTP APIs

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/runtimeAgent loop, LLM drivers, WASM sandboxenhancementNew feature or requesthas-prA pull request has been linked to this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions