Skip to content
Guides

OpenClaw music generation

Five providers behind one tool, the async task that wakes the session, lyrics and instrumental controls, and the selection order

5 min read

The music tool creates music or audio through a shared music-generation capability backed by ComfyUI, fal, Google, MiniMax and OpenRouter, and it only appears when at least one provider is available, through an explicit media-models config or an auth-configured provider. In a session-backed run it starts as a background task, tracks progress in the task ledger, and wakes the agent when the track is ready so it can tell you and attach the audio. Here is the quick start on both paths, the providers and what each controls, the parameters, the async lifecycle, the selection order and the provider notes.

Quick start

  • Shared provider-backed: set an API key for at least one provider, Gemini or MiniMax for example, optionally pick a default model under the media models config, and ask the agent; the tool is called automatically with no allow-listing.
  • ComfyUI workflow: configure the plugin’s music section with a workflow JSON and its prompt and output nodes, add a cloud key if you use Comfy Cloud, and call the tool with a prompt.
  • The list action inspects providers and models, the status action inspects the active session task, and a direct call can set instrumental output.
  • Without a session-backed run, direct or local contexts, the tool runs inline and returns the final media path in the same result.
The agent calls music_generate automatically. No tool allow-listing needed.

Providers and parameters

ComfyUI runs a workflow with up to one reference image; fal defaults to a MiniMax-backed music model with lyrics, instrumental, duration and format controls, plus two prompt-only audio models; Google’s Lyria clip preview takes up to ten reference images with lyrics, instrumental and format, outputs only mp3 while the pro model also supports wav; MiniMax takes lyrics and instrumental with mp3 only, registers two provider ids for API-key and OAuth auth, and also exposes free and cover models; OpenRouter defaults to the Lyria pro preview with one image and the full control set. The parameters: the prompt; an action of generate, status or list; a model override; lyrics where supported; an instrumental flag; one or up to ten reference images; a duration hint; a format of mp3 or wav; and a filename hint. Hard limits such as input counts are validated before submission, a duration above a provider’s maximum is clamped to the closest supported value, unsupported optional hints are ignored with a warning, and the result reports applied settings with a normalisation record. Provider request timeouts are operator configuration only: a configured value below two minutes is raised to two minutes, and the default is five.

The async lifecycle

  • The tool creates a background task and returns a started response immediately, later posting the finished track in a follow-up message; while a task is queued or running, further calls in the same session return its status instead of starting another, and a recently completed matching request is deduplicated for two minutes.
  • An internal completion event wakes the same session so the model writes the user-facing follow-up itself, later turns get a small hint while a task is in flight so the model does not call the tool again blindly, and the tasks CLI lists, shows and cancels; if the requester session is inactive or its wake fails, an idempotent direct fallback delivers just the missing audio.
  • The states are the general task registry’s: queued, running for thirty seconds to three minutes depending on provider and duration, succeeded, when the agent wakes and posts, and failed with error details.

OpenClaw video generation is the tool with the same lifecycle and a longer provider list, and OpenClaw image generation the still-image sibling.

Selection and the two paths

The model parameter alone when set, then the configured primary, then the fallbacks in order, then auto-detection only when nothing is configured, with the current default text-model provider first if it also offers music and the remaining providers alphabetically; an explicit configuration limits fallback to the list. The docs’ advice on paths: the shared provider-backed path when you want model selection, failover and the built-in task flow, the ComfyUI plugin path when you need a custom workflow graph or a provider outside the bundled set. OpenClaw text to speech is the other audio the agent can produce, and OpenClaw automations explains the task machinery behind the wake-up.

On Diali

On Diali the music tool appears once a provider key is in the vault; the track lands in the assistant’s media storage and comes back in the chat as an audio file. Hosted OpenClaw on Diali is the assistant.

  • No provider, no tool; one key is enough.
  • A background task, a wake-up, a follow-up with the file.
  • Lyria for images and wav, MiniMax for mp3 and lyrics.
Get started

Stop reading about it, build one

Set up an agent, pick a channel, and have it working inside the app you already keep open.