Skip to main content
Glama

Generate Music or Audio with Replicate

replicate_generate_audio

Generates music, ambient audio, or full songs from a text prompt using selectable models, returning playable audio links or locally downloaded files.

Instructions

Generate music, ambient audio, or full songs from a text prompt.

DISPLAY REQUIREMENT — after this tool returns successfully, include the URL(s) printed in the tool's text content as a markdown link [Audio](URL) in your reply so the user can play it. URLs expire in ~24h.

Models:

  • "musicgen" (default): Meta MusicGen. Instrumental music up to 30s. prompt → "prompt" field.

  • "ace-step": Full songs with lyrics. prompt → "tags" field (style/genre tags). Pass lyrics separately via extra_input.lyrics. ~3-4 minutes runtime.

  • "riffusion": Loop-friendly ambient/electronic. prompt → "prompt_a" field. No duration control.

  • "minimax-music": MiniMax Music 2.6. Full songs up to 6min. prompt=style description; pass lyrics via extra_input.lyrics.

  • "lyria-3-pro": Google Lyria 3 Pro. Full songs up to 3min WITH sung vocals. Put genre, mood, lyrics, and structure ([Verse]/[Chorus]) directly in the prompt. No duration — do NOT pass duration_seconds. Also "lyria-3" (30s clips) and "lyria-2" (48kHz instrumental).

Args:

  • prompt (string): Description of the music. For ace-step this maps to the "tags" field (style tags like "rock, guitar, upbeat"). For riffusion this maps to "prompt_a". For lyria put genre/mood/lyrics/structure here.

  • model (string, default "musicgen"): Curated key (musicgen, ace-step, riffusion, minimax-music, lyria-3-pro, lyria-3, lyria-2) or "owner/name[:version]".

  • duration_seconds (1-300, optional): Duration in seconds. Supported by musicgen and ace-step. Ignored for riffusion and the lyria models (they have no duration parameter).

  • extra_input (object, optional): Additional inputs. Examples: {temperature: 1.0, top_k: 250} for MusicGen; {lyrics: "verse lyrics here"} for ace-step.

  • download (boolean, default true): Download as MP3/WAV.

  • timeout_ms: Default 300000 (5min).

Returns: PredictionResult. local_paths contain audio files.

Examples:

  • prompt="upbeat synthwave with driving bassline", duration_seconds=15 → musicgen

  • prompt="indie folk, acoustic guitar, female vocals", model="ace-step", extra_input={lyrics: "Leaving home on a rainy day..."}

  • prompt="ambient lo-fi chill", model="riffusion"

Input Schema

NameRequiredDescriptionDefault
modelNoEither a curated key (musicgen, ace-step, riffusion, minimax-music, lyria-3-pro, lyria-3, lyria-2) or a Replicate identifier.musicgen
promptYesDescription of the music/audio. For songs with lyrics (ace-step), include the lyrics here.
downloadNoWhether to download the generated files locally. Default true. When false, only Replicate URLs are returned (URLs expire after ~24h).
timeout_msNoMax ms to wait for the prediction. If exceeded, returns the prediction ID so you can poll via replicate_get_prediction. Default: 300000 (5min).
extra_inputNoAdditional model-specific inputs.
duration_secondsNoDuration in seconds. Model-dependent.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.3.1
    • addedInput schema / properties / extra_input / propertyNames
      Added value: +{
      +  "type": "string"
      +}
  2. First observedv3.2.3

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only declare the mutation/open-world profile; the description adds genuinely new behavior: the mandatory display requirement with `[Audio](URL)`, the ~24h URL expiry, per-model runtime estimates (~3-4 min for ace-step), timeout semantics with a poll-for-prediction recovery path, and default local download. These are operational traits an agent cannot infer from annotations or schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and the display requirement are front-loaded, and the Models/Args/Examples sections are scannable. There is some duplication — the curated model list and the lyria "no duration" caveat appear in both the Models and Args blocks — which costs a bit of tightness in an otherwise well-structured definition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, yet the description states the return shape ("PredictionResult. local_paths contain audio files") and explains URL expiry and download behavior. With six parameters including a free-form nested `extra_input` and six model variants, the description supplies everything needed to select a model and invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline would be 3, but the description goes well beyond it by mapping `prompt` to different backend fields per model ("tags" for ace-step, "prompt_a" for riffusion, inline lyrics/structure for lyria) and by flagging that `duration_seconds` is supported by musicgen/ace-step but ignored for riffusion and lyria. Concrete `extra_input` examples ({temperature, top_k}, {lyrics}) add further meaning the bare object schema lacks.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb + resource + scope ("Generate music, ambient audio, or full songs from a text prompt") and the Models section makes clear how it differs from siblings like replicate_generate_speech and replicate_generate_image. An agent can tell instantly that this is the text-to-music path, not narration or sound effects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The Models table functions as explicit when-to-use-which guidance: ace-step for lyrics, riffusion for looping ambient, lyria-3-pro for sung vocals up to 3min, and it names the polling fallback (replicate_get_prediction) on timeout. It stops short of explicit exclusions or routing away to sibling tools (e.g. speech narration), so it is clear context without full when-not coverage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.