mstar.api_server.openai.serving_speech#
/v1/audio/speech and /v1/audio/voices handlers (text-to-speech).
Non-streaming speech returns the full audio as a container blob (WAV by
default). Streaming returns one open-ended response as the audio is produced:
a WAV header followed by PCM16 frames, or, with response_format="pcm",
the bare PCM16 frames that the OpenAI TTS clients (LiveKit, Pipecat) expect.
/v1/audio/voices lists the voice values the served model accepts.
Long inputs can be synthesized as ordered sentence chunks (one engine request
per chunk, speech_chunking.split_sentences): the adapter’s
speech_chunk_min_chars turns this on for long texts, and a client can force
or suppress it per request with sentence_chunking: true|false. The next
chunks are submitted while the current one streams, so the engine batches them
and playback never waits for a prefill. An input needing more than the
adapter’s speech_chunk_max_pieces chunks is rejected.
A streaming request only commits to HTTP 200 once its first result chunk has
arrived and is not an error; an error chunk before that becomes the HTTP error
it carries (the non-streaming path gets the same from collect_results).
The adapter maps the request before anything is submitted, and that step can decode an uploaded clip or, where the server allows it, fetch one over HTTP. It runs in a worker thread so a slow reference cannot stall the streams the event loop is serving.
Functions
|
|
|
The served model's voices, or |