Skip to content

Custom audio endpoints: send generation to a server you already run - #24

Merged
HamSanders merged 5 commits into
mainfrom
feat/22-custom-endpoints
Oct 24, 2026
Merged

HamSanders merged 5 commits into
mainfrom
feat/22-custom-endpoints

Conversation

@HamSanders

Copy link
Copy Markdown
Owner

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.

  • One model per endpoint. Each one shows up in the pickers as endpoint:<id>, after the local models. It never takes the VRAM residency slot, and the Models page hides Load, Unload and Delete for it.
  • Body template, not a fixed format. Servers that expose the same path disagree on field names (two /v1/audio/music implementations take prompt/duration_seconds and input/duration respectively), so the body is JSON with {{variables}}: prompt, lyrics, instrumental, duration, bpm and key (read from the prompt, e.g. "84 BPM, D minor"), seed, text, voice, voice_ref_b64 and 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.
  • Controls follow the template. No {{seed}} means no seed control, and {{lyrics}} turns on the lyrics box.
  • Responses. WAV is detected by header, audio/pcm is 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).
  • Presets for self-hosted servers only: LocalAI ACE-Step music, LocalAI sound effects, and OpenAI-compatible speech. Hosted APIs can be added by hand, but none gets a one-click preset.
  • Local-first stays visible. A URL outside this machine and the LAN gets a notice in the form, an Off-network badge, and a line in the model description saying prompts leave the machine.
  • Keys. API keys are write-only (api_key_set), the same as the HF token. Endpoints are per-profile and stored in settings.json under audio_endpoints.
  • Test button. It renders one short clip through the form as it stands, and nothing is saved to the library.

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 --noEmit clean; vitest run passes all 536 tests. 27 of them are new in test/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.json clean; oxlint src adds 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 updated (docs/ENDPOINTS.md, site docs index)
  • CHANGELOG.md updated under Unreleased
  • No new model catalog entries
  • No secrets, tokens or personal data in the diff
  • Screenshots of the real app (checked in mock mode only)

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]>
HamSanders and others added 4 commits October 24, 2026 16:20
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]>
@HamSanders
HamSanders merged commit 2501590 into main Oct 24, 2026
7 checks passed
@HamSanders
HamSanders deleted the feat/22-custom-endpoints branch October 24, 2026 22:43
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.

[Feature Request] Custom Music/Sound Generation Endpoints

1 participant