Repository navigation
feat(tts): add a gateway-backed TextToSpeech engine alongside local llama-tts - #1136
Merged
Merged
Conversation
…lama-tts text_to_speech.engine now accepts 'gateway' next to qwen3-tts (still the default): synthesis goes through the gateway's Audio API (/v1/audio/speech, SDK v1.36.0 CreateSpeech), so requests appear in gateway logs and traces. Under gateway, model is 'provider/model' and the new voice key selects the provider voice; voice_sample is forwarded as reference_audio for zero-shot cloning. The CLI-managed gateway starts with ENABLE_AUDIO=true when the gateway engine is configured. Closes #1126
edenreich
force-pushed
the
feat/tts-gateway-engine
branch
from
August 31, 2026 21:44
2e57371 to
c435405
Compare
…the engine - bump inference-gateway/sdk v1.36.0 -> v1.37.0 (types synced with schemas v0.27.1) - text_to_speech.engine now defaults to gateway; an empty model resolves to the gateway's built-in local/qwen3-tts, so TTS works with the auto-started local gateway and zero provider config - auto-download follows the engine: under gateway the CLI forwards AUDIO_LOCAL_AUTO_DOWNLOAD so the gateway fetches its own binary and models; under qwen3-tts the CLI now auto-downloads llama-tts from the inference-gateway/binaries release (sha256-verified) in addition to the GGUFs - point the binary downloader at the renamed binaries repo (latest release) and handle the .exe asset/cache naming on Windows, matching the gateway's ~/.infer/bin cache layout; both sides download via temp file + atomic rename into the same shared dirs, so concurrent fetches can never corrupt the cache
edenreich
commented
Sep 1, 2026
Co-authored-by: Eden Reich <[email protected]>
…the tool prompt - when text-to-speech uses the gateway engine and an already-running gateway answers 404 on /v1/audio/speech (started before TTS was enabled, or an older binary), the manager now restarts it with AUDIO_ENABLED=true instead of silently reusing it; the restart path also refreshes a stale binary - tighten the TextToSpeech prompt and parameter descriptions: voice_sample and output_path are bare file names only, the WAV always lands in the configured output directory, and a not-ready first call should be retried
3 tasks
…del id The gateway serves local/qwen3-tts only when the provider query parameter is absent and the request body keeps the full model id; splitting it into provider=local caused a 400 Provider-not-found. Real providers still get the stripped model name.
3 tasks
Contributor
|
🎉 This PR is included in version 0.186.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1126. Closes #1137. Adds a gateway-backed synthesis engine to the
TextToSpeechtool and makes it the default:text_to_speech.engine: gatewayroutes synthesis through the gateway's Audio API (POST /v1/audio/speech), with the gateway's built-inlocal/qwen3-ttsas the default model — so TTS works with the auto-started local gateway and zero provider config.llama-ttsbecomes one backend (engine: qwen3-tts) rather than the only one.Changes
CreateSpeech(ctx, provider, CreateSpeechRequest) ([]byte, error)forPOST /v1/audio/speech(v1.36.0) plus the schemas v0.27.1 type sync (v1.37.0). TheAnthropicMessagesadapter and the counterfeiter SDK fake gained the new interface method.enginedefaults togateway(empty means gateway); under it, an emptymodelresolves tolocal/qwen3-ttsviaResolveGatewayModel(), and a non-empty one must beprovider/model(validated with an actionable error). The newvoicekey selects the provider voice.binary_path,models_dir,ffmpeg_pathand the Qwen3modelpresets remain qwen3-only.text_to_speech.auto_downloadgoverns whichever side synthesizes:gateway: the managed gateway is started withAUDIO_ENABLED=trueandAUDIO_LOCAL_AUTO_DOWNLOAD=<auto_download>(docker and binary paths), and fetches its own llama-tts binary + GGUFs in a background warmup.qwen3-tts: the CLI auto-downloads the models (as before) and now thellama-ttsbinary from theinference-gateway/binariesrelease (sha256-verified) — resolution orderbinary_path→PATH→~/.infer/bincache, same as the gateway.~/.infer/bin,~/.infer/models/tts) and identical asset/GGUF filenames. Engine selection makes downloads mutually exclusive in practice, and both sides download via existence-check → temp file in the destination dir → atomicos.Rename, so even a genuine concurrent fetch can only duplicate a download, never corrupt or tear a file the other side picks up.[email protected]release toinference-gateway/binarieslatest (also fixes whisper-cli/ffmpeg to track current assets), with.exeasset/cache naming on Windows matching the gateway's cache layout.internal/agent/infrastructure/speech_service.gomirrorsImageService: requests WAV (so existing.wavoutput paths and duration reporting are unchanged) and forwards avoice_samplerecording asreference_audiofor zero-shot voice cloning. Exposed through a newagentdomain.SpeechServiceport and injected via the container.engineinstead of always constructingaudio.NewSynthesizer; gateway engine with no service available means the tool is simply not registered.docs/text-to-speech.mdrestructured around both engines (gateway-first, shared-cache and warmup/Retry-After notes, llama-tts auto-download);docs/tools-reference.mdand README rows updated.Testing
task precommit:runandtask testpass.local/qwen3-ttsmodel, voice, WAV format, reference audio, error paths), config validation (gateway default, empty-model defaulting, bad models still rejected), registry backend selection (including the nil-service case), andresolveBinaryauto-download against a stub release server.local/qwen3-tts, first call may 503-retry during warmup) still needs a run on a real machine.Cross-repo impact
inference-gateway/docs— docs follow-up needed: [DOCS] Document the CLI text_to_speech engines (gatewaydefault withlocal/qwen3-tts,provider/model+voice,AUDIO_ENABLED/AUDIO_LOCAL_AUTO_DOWNLOADforwarding, localqwen3-ttsengine with llama-tts auto-download frominference-gateway/binaries, shared~/.infercache semantics).inference-gateway/binaries— consumed (llama-tts, whisper-cli, ffmpeg assets); no changes needed.schemas,sdk, gateway — already shipped; consumed here, no changes needed.