Repository navigation
Custom audio endpoints: send generation to a server you already run - #24
Merged
Merged
Conversation
Settings → Endpoints adds a sound-effects, music or speech endpoint: a URL,
an optional key and a JSON body template with {{variables}} (prompt, lyrics,
bpm and key read from the prompt, duration, seed, voice…). Each endpoint is
a model in the pickers (endpoint:<id>) and never takes the VRAM slot.
Responses: WAV by header, audio/pcm at a declared rate, base64 inside JSON
by path, and anything else through ffmpeg when it is on PATH. Presets cover
self-hosted servers only (LocalAI ACE-Step and sound, OpenAI-compatible
speech). Off-network hosts are flagged, since prompts leave the machine.
Fixes #22
Co-Authored-By: Claude Opus 5.5 <[email protected]>
LocalAI's field table names it model_id, and the issue author's server takes model_id. The hint and docs say to rename it to model if a server follows LocalAI's ACE-Step example instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous commit changed only the server preset. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # CHANGELOG.md
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.
What this changes
Adds custom endpoints (Settings → Endpoints): Soundbox sends sound-effects, music or speech requests to a server you already run, such as LocalAI or an OpenAI-compatible speech server, instead of downloading the model. Fixes #22.
endpoint:<id>, after the local models. It never takes the VRAM residency slot, and the Models page hides Load, Unload and Delete for it./v1/audio/musicimplementations takeprompt/duration_secondsandinput/durationrespectively), so the body is JSON with{{variables}}:prompt,lyrics,instrumental,duration,bpmandkey(read from the prompt, e.g. "84 BPM, D minor"),seed,text,voice,voice_ref_b64and more. Bare placeholders keep their JSON type, null fields are dropped, and values are JSON-encoded so a prompt can't break the body. Unknown variables are rejected when you save.{{seed}}means no seed control, and{{lyrics}}turns on the lyrics box.audio/pcmis read at a declared rate, base64 inside JSON is found by path, and anything else is decoded with ffmpeg when it's on PATH (with a clear error when it isn't).api_key_set), the same as the HF token. Endpoints are per-profile and stored insettings.jsonunderaudio_endpoints.New API:
GET /api/endpoints,PUT/DELETE /api/endpoints/:id,POST /api/endpoints/test. Docs:docs/ENDPOINTS.md, registered on the site under "Using Soundbox".Not supported on endpoints: extend, cover, repaint, stems and voice conversion. Those still need a local model.
How it was tested
server:tsc --noEmitclean;vitest runpasses all 536 tests. 27 of them are new intest/endpoints.test.ts: template rendering and escaping, BPM/key extraction, the local/remote host rule, WAV/PCM/JSON decoding, and an end-to-end run that saves an endpoint, lists it as a model, generates through a stub HTTP server, checks the exact rendered body and that the sound lands in the library, tests the endpoint with the saved key, and deletes it.app:tsc -p tsconfig.app.jsonclean;oxlint srcadds no warnings.In the app (mock mode): added the LocalAI ACE-Step preset, ran Test, saved it, and confirmed it in Settings, on the Models page (no Load button; details point to Settings) and in the Music page's model picker. Typing a public URL shows the off-network notice.
Not tested against a real LocalAI instance, and the ffmpeg decode path wasn't run against a real MP3 server.
npm run typecheck(server and app)npm run lint(app files)npm test(server)Tried it in the app (mock backend)
Checklist
docs/ENDPOINTS.md, site docs index)CHANGELOG.mdupdated under Unreleased