Skip to content

server: optional input on /v1/audio/speech/live for s2s and vc models - #822

Merged
0xShug0 merged 2 commits into
0xShug0:mainfrom
Liquid4All:lfm2-audio-live-input
Oct 7, 2026
Merged

0xShug0 merged 2 commits into
0xShug0:mainfrom
Liquid4All:lfm2-audio-live-input

Conversation

@ykhrustalev

Copy link
Copy Markdown
Contributor

Lets a speech-to-speech or voice-conversion request on the live route leave out input, so the model uses its own default.

Problem

  • POST /v1/audio/speech/live refuses every request without input, before it looks up the model
  • input is the text a TTS model speaks. An s2s or vc model takes it as an optional prompt: LFM2.5-Audio's system prompt, PersonaPlex's persona prompt. MeanVC2 does not read it
  • So a client had to send a dummy or repeat the default. The lfm2_audio docs' curl example sent liquid-audio's prompt, Respond with interleaved text and audio.

What this PR changes

  • app/server/live_speech_input.h: live_speech_requires_input(VoiceTaskKind), false for s2s, vc and svc. Both runtimes use it
  • The check moves from the top of handle_speech_live to after the mode=streaming check, with the same message. In the parallel runtime both come after the lease
  • With neither input nor language, the request carries no text_input, as /v1/tasks/run does without text
  • Tests: live_speech_optional_input in server_parallel_lifecycle_test (s2s, vc and tts fixture entries), and a legacy check in server_runtime_selection_test through its public handler. Lines the contract doc links do not move
  • Docs: the server README's live paragraph says when input is needed, and the lfm2_audio live example drops &input=

What changes for users

  • lfm2_audio S2S without input uses liquid-audio's system prompt. PersonaPlex runs with no persona prompt, its documented default, and system_prompt= no longer needs a dummy input. MeanVC2 no longer needs one
  • Without input, an unknown model or an entry not configured with mode=streaming now gets that error instead of the input one
  • Parallel runtime: a TTS request without input gets its 400 once it holds a slot, or the busy error if none frees in time. On main it was refused at once. With the entry's only slot busy, it waited for the running stream (3 of 3 trials)

What does not change

  • TTS and every other task: the same 400 with the same body
  • Requests that send input give the same output as main

Testing

  • With ENGINE_BUILD_EXTENDED_TESTS=ON, the 10 server-memory-guard CI tests and server_speech_option_exceptions_test pass (11/11) on Linux (CPU build) and an M3 Ultra (Metal). The two changed tests pass three runs in a row on each, the lifecycle test for slots 1, 2 and 4. With main's two runtime files, both new tests fail on the input 400
  • Linux, ASan (gcc-12) and TSan (clang-19): all 11 pass, and TSan reports nothing in three more runs of each changed test
  • End to end, lfm2_audio EN and JP Q8_0 streaming S2S entries, seed 1, legacy and --parallel-jobs, on an A10 (CUDA, and the CPU) and the M3 Ultra (Metal, and the CPU):
    • No input, input= and language=en alone give the same stream as the explicit default prompt: events, text deltas and every audio delta. Raw PCM (stream_format=audio) too
    • Byte-identical to main (no input against main with the prompt, and input against the same input): 40 comparisons on Linux, 24 on the Mac
    • Another input still changes the reply. Legacy and parallel give the same output
  • TTS streaming entry: without input or with input=, the same 400 body as main in all 16 requests on Linux and 8 on the Mac. With input, the same audio as main on each backend
  • The docs' curl example, as written, streams text and audio in both runtimes (4 runs)
  • Parallel runtime: /v1/models shows nothing active or queued after the 400s
  • PersonaPlex and MeanVC2 were not run. From the code: PersonaPlex turns a missing text_input into no persona prompt and its system_prompt option still wins. MeanVC2 never reads text_input
  • Unchanged from main: a streamed TTS reply on this route ends with the SSE error live streaming response did not observe input end, some TTS requests with a short body got a connection reset on both trees, and the input 400 comes before the body is read, so a client still uploading may see a reset

Build and run

cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENGINE_BUILD_TESTS=ON -DENGINE_BUILD_EXTENDED_TESTS=ON \
  -DAUDIOCPP_MODEL_SET=custom -DAUDIOCPP_MODELS=lfm2_audio
ninja -C build audiocpp_server server_parallel_lifecycle_test server_runtime_selection_test
./build/bin/server_parallel_lifecycle_test && ./build/bin/server_runtime_selection_test

Then run the curl example in docs/community_models/lfm2_audio.md against a streaming S2S entry.

The live route asked every model for `input`, the text a TTS model
speaks. A speech-to-speech or voice-conversion model answers or
converts the live audio instead, and takes `input` as an optional
prompt: LFM2.5-Audio's system prompt or PersonaPlex's persona prompt.
MeanVC2 does not read it. So a request had to send a dummy, or repeat
the default prompt, to get the model's default behaviour.

`input` is now required only when the entry's task is not s2s, vc or
svc. The check moves after the model lookup, next to the
mode=streaming check, with the same message, so TTS keeps its 400. In
the parallel runtime both checks come after the lease, so a TTS
request without `input` gets its 400 once it holds a slot, or the busy
error if none frees in time. An unknown model without `input` now
gets "unknown model id". With neither `input` nor `language` the
request carries no text_input, as /v1/tasks/run does without `text`,
and the model uses its default.

The lifecycle test covers s2s, vc and tts streaming entries in the
parallel runtime; the runtime selection test checks the same gate in
the legacy one through its public handler.
app/server/README.md says which models need `input` on
/v1/audio/speech/live. The lfm2_audio live example drops it, so the
reply uses liquid-audio's system prompt.
@0xShug0
0xShug0 merged commit a1c24b2 into 0xShug0:main Oct 7, 2026
11 checks passed
@0xShug0

0xShug0 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

@ykhrustalev Thanks! This is a general server improvement. PR merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants