Add TTS endpoint (/v1/audio/speech) to local server#471
Open
j0nl1 wants to merge 1 commit into
Open
Conversation
- Import TTSKit and load Qwen3-TTS 0.6B model on server startup - New POST /v1/audio/speech endpoint compatible with OpenAI TTS API - Voice mapping: OpenAI names (alloy, echo, nova...) to Qwen3 voices - 10 language support: es, en, fr, de, pt, it, ja, ko, zh, ru - WAV encoder (24kHz mono 16-bit PCM)
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
Adds a text-to-speech endpoint to the local server (
argmax-cli serve), enabling the same server to handle both STT and TTS via OpenAI-compatible APIs.POST /v1/audio/transcriptions— STT (existing)POST /v1/audio/speech— TTS (new)Changes
TTSKitinServeCLI.swiftPOST /v1/audio/speechas a manual Vapor route (same pattern as/health)/routeMotivation
The local server currently only handles transcription. Adding TTS makes it a complete voice server — useful for smart home assistants, accessibility tools, or any application needing
both STT and TTS from a single local endpoint on Apple Silicon.
Real-world usage
I built a Home Assistant custom integration that consumes this endpoint: ha-argmax-tts. It registers as a TTS provider in Home Assistant,
allowing voice assistants to use argmax for local speech synthesis — no cloud APIs needed. The integration supports all 10 languages, configurable voice/model selection via UI, and
connection validation via
/health.Request format