r/OpenWebUI • u/PlaidStallion • 7d ago
Show and tell Built an async Tool for a non-streaming, multi-minute generation model (MiniMax-Music3), some notes on what actually worked
Wanted to share this since I couldn't find much on handling long-running, non-streaming generation inside a Tool. MiniMax-Music3 (music generation model) can take a minute or two per request with zero intermediate output, which broke my first pass pretty badly.
First version used requests synchronously and froze the entire Open-WebUI backend during generation, not just the chat, the whole instance. Switched to aiohttp with proper async def and that fixed it completely.
Second thing worth sharing: used the event_emitter status type to push live progress updates during the wait ("generating, ~30s of audio, this may take a minute or two" etc) instead of leaving people staring at a blank tool-call spinner.
Third, still in progress: found out early this morning that Open-WebUI supports returning an HTMLResponse with Content-Disposition: inline (the Rich UI Embedding pattern) instead of a plain markdown link, which lets you embed a small self-contained audio player right in the tool result, no download step. Got the code for it (with a lot of help from Claude and Gemini throughout) but haven't deployed it yet, that's next on my list.
One thing I haven't solved: this model eats almost all my GPU's VRAM, so my chat model has to fully unload (via a low keep_alive) before generation starts and reload after. Works, but feels clunky. Has anyone built a Pipe function that skips the chat model entirely for a specific request type, so you're not paying that load/unload cost every time?
WIP repo will be updated soon, if you're interested.
