Skip to main content
meta avatar

Demucs API

meta/demucs

Split a song into the instrumental and the isolated vocal in a single call, priced by compute time rather than per minute of audio.

segmentation
A100
0.0184565

Model Input

Input

URL of the audio file to separate. This is built for a full-band music mix with the lead vocal present - a solo vocal, or a track that is already instrumental, has nothing to split. Decoding is ffmpeg-backed, so wav, mp3, flac and ogg/vorbis all work. There is no length limit: both runtime and price grow with the duration of the track, because this endpoint bills by second of compute.

Additional Settings

Customize your input with more control.

Which separation network runs. htdemucs (the default) is the first Hybrid Transformer Demucs, trained on MusDB plus 800 songs. htdemucs_ft is its fine-tuned version: separation will take 4 times more time but might be a bit better, and because this endpoint bills compute time it costs roughly four times as much too. htdemucs_6s adds guitar and piano as internal sources, but the result here is still the same vocal/instrumental pair. hdemucs_mmi is the earlier Hybrid Demucs v3, retrained on the same data. mdx_q and mdx_extra_q are quantized versions of the older models - a smaller download, and quality can be slightly worse. Every value supports the vocal split, so the choice only trades quality against time and cost.

Container the two returned files are encoded in. mp3 (the default) is the smallest; flac is lossless and compressed; wav is lossless and uncompressed. Both files always come back in the same format.

Min: 64 - Max: 320

Bitrate in kbps for MP3 output. Higher means better quality and a larger file. Has no effect unless output_format is mp3.

Min: 1 - Max: 2

How many random-shift passes to average. Each extra shift re-runs the whole separation on a shifted copy of the input and averages the results, which can steady a split that sounds unstable - and multiplies both the runtime and, because this endpoint bills compute time, the price. 1 (a single pass) is the default and is right for almost every track; 2 is the highest value accepted here.

What to do when a separated track goes past full scale. rescale (the default) scales the whole signal down so nothing clips; clamp allows hard clipping; none leaves the samples untouched.

You need to be logged in to run this model and view results.
Log in

Model Output

Output

Unsupported file type

Unsupported file type

Generated in 21.466 seconds
Logs (1 lines)

Model Example Requests

Examples

Example output 1Example output 2

Demucs API

Demucs is a audio-to-audio AI model by meta. On ModelRunner it runs through a REST API or via MCP from any AI assistant, at about $0.0184565 per audio clip.

POST https://queue.modelrunner.run/meta/demucs

cURL

# Submit a request to the queue. Input fields go at the top level of the
# body. The optional reserved "metadata" object holds your own flat string
# tags — stored on the request, never sent to the model; filter later with
# GET https://queue.modelrunner.run/requests?metadata=<url-encoded JSON>.
curl -X POST https://queue.modelrunner.run/meta/demucs \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "audio": "https://media.modelrunner.ai/PaQdzfOxdsluPtzQcXZDm.wav",
    "model": "htdemucs",
    "shifts": 1,
    "clip_mode": "rescale",
    "mp3_bitrate": 320,
    "output_format": "mp3",
    "metadata": {
      "project": "my-project"
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/meta/demucs/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/meta/demucs/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("meta/demucs", {
  input: {
    "audio": "https://media.modelrunner.ai/PaQdzfOxdsluPtzQcXZDm.wav",
    "model": "htdemucs",
    "shifts": 1,
    "clip_mode": "rescale",
    "mp3_bitrate": 320,
    "output_format": "mp3"
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/meta/demucs",
    headers=headers,
    json={
      "audio": "https://media.modelrunner.ai/PaQdzfOxdsluPtzQcXZDm.wav",
      "model": "htdemucs",
      "shifts": 1,
      "clip_mode": "rescale",
      "mp3_bitrate": 320,
      "output_format": "mp3"
    },
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

Input parameters of Demucs
NameTypeRequiredDescription
audiostring (uri)yesURL of the audio file to separate. This is built for a full-band music mix with the lead vocal present - a solo vocal, or a track that is already instrumental, has nothing to split. Decoding is ffmpeg-backed, so wav, mp3, flac and ogg/vorbis all work. There is no length limit: both runtime and price grow with the duration of the track, because this endpoint bills by second of compute.
modelenumnoWhich separation network runs. htdemucs (the default) is the first Hybrid Transformer Demucs, trained on MusDB plus 800 songs. htdemucs_ft is its fine-tuned version: separation will take 4 times more time but might be a bit better, and because this endpoint bills compute time it costs roughly four times as much too. htdemucs_6s adds guitar and piano as internal sources, but the result here is still the same vocal/instrumental pair. hdemucs_mmi is the earlier Hybrid Demucs v3, retrained on the same data. mdx_q and mdx_extra_q are quantized versions of the older models - a smaller download, and quality can be slightly worse. Every value supports the vocal split, so the choice only trades quality against time and cost. One of: htdemucs, htdemucs_ft, htdemucs_6s, hdemucs_mmi, mdx_q, mdx_extra_q. Default: "htdemucs".
output_formatenumnoContainer the two returned files are encoded in. mp3 (the default) is the smallest; flac is lossless and compressed; wav is lossless and uncompressed. Both files always come back in the same format. One of: mp3, flac, wav. Default: "mp3".
mp3_bitrateintegernoBitrate in kbps for MP3 output. Higher means better quality and a larger file. Has no effect unless output_format is mp3. Default: 320.
shiftsintegernoHow many random-shift passes to average. Each extra shift re-runs the whole separation on a shifted copy of the input and averages the results, which can steady a split that sounds unstable - and multiplies both the runtime and, because this endpoint bills compute time, the price. 1 (a single pass) is the default and is right for almost every track; 2 is the highest value accepted here. Default: 1.
clip_modeenumnoWhat to do when a separated track goes past full scale. rescale (the default) scales the whole signal down so nothing clips; clamp allows hard clipping; none leaves the samples untouched. One of: rescale, clamp, none. Default: "rescale".

Machine-readable: OpenAPI schema · llms.txt

Use Demucs from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and Demucs becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint meta/demucs.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run meta/demucs on ModelRunner to generate audio”. MCP setup guide.

Model Details

Model Details

Demucs splits a mixed music recording into two finished audio files: the instrumental with the vocal removed, and the isolated vocal itself. Send one audio file; both come back full length at 44.1 kHz, and decoding is ffmpeg-backed so wav, mp3, flac and ogg all work. It runs Hybrid Transformer Demucs (`htdemucs`), trained on MusDB plus 800 songs specifically for music source separation. There is no prompt: the split is fixed, which makes it predictable across a whole catalogue.

## Best for - Removing the lead vocal from a song to make a karaoke or backing track - Pulling an a cappella vocal out of a finished mix to remix or sample - Preparing vocal and instrumental stems for a mashup, cover or DJ edit - Batch-processing a music library into vocal/instrumental pairs - Getting a clean vocal for transcription or lyric alignment

## Choose another model when - You want one named instrument, or any sound you can describe in words — `meta/sam-audio/separate` takes a text prompt and isolates what you name. - You want to clean up a speech recording rather than split music — `rikorose/deepfilternet3` and `elevenlabs/audio-isolation` remove noise instead. - You need drums, bass and the rest as separate files — this endpoint returns only the vocal plus everything else.

## Tips - The output is an array of two URLs, always in the same order: index 0 is the instrumental, index 1 is the isolated vocal. - Give it a full-band mix with the vocal reasonably present — a solo vocal or an instrumental has nothing to separate. - Billed per second of compute time, which grows with the length of the track: a 30-second clip took about 4.5 seconds. - Leave `model` on `htdemucs` unless a result disappoints: `htdemucs_ft` "might be a bit better" but takes four times as long, and costs about four times as much. - Raise `shifts` only if a split sounds unstable: each extra shift re-runs the separation and averages the passes, multiplying time and price.

## Advanced Configuration - `model` picks the separation network; every value returns the same vocal/instrumental pair, so it only trades quality against time and cost. - `clip_mode` handles a track that exceeds full scale: `rescale` (the default) scales the whole signal down, `clamp` hard-clips, `none` leaves it alone.

To run via the ModelRunner JavaScript client: ```js import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("meta/demucs", { input: { audio: "https://media.modelrunner.ai/PlbJ07n9klVvKGysT4qdy.wav", model: "htdemucs", output_format: "mp3", }, }); // result.output[0] -> instrumental, result.output[1] -> isolated vocal ```