Mozart Developers

Stem separation API for songs you make with Mozart

A stem separation API, also called a music source separation API, splits a mixed song into its parts, such as vocals, drums, bass and other instruments, and returns each part as its own audio file.

The Mozart stem separation API splits songs you generate with the Mozart music API into vocals and instrumental (twoStem) or into up to nine labelled stems (fourStem). It does not take uploaded audio: generate a song or a cover first, then call POST /v1/songs/{song_id}/stems. The stems come from the same API, key and credits as your songs, with no separation models to host.

twoStem works as a vocal remover API and fourStem as a full stem splitter API; each stem comes back as a download link in job.outputs.

Read the API referenceGet API key

The REST API needs an API plan (Starter, Build, Scale or Growth), from $20 a month, or prepaid API credits, and spends API credits. Stem splits also need a Mozart plan that includes them; see errors.

Updated November 27, 2026

On this page

Stem splitter API modes: twoStem and fourStem

modeWhat you getLabels it can returnUse it for
twoStemVocals and instrumentalVocals, Lead Vocals, Backing Vocals, InstrumentalKaraoke, acapella extraction, vocal isolation, sing-along and practice tracks for songs you made
fourStem (default)Vocals, drums, bass and up to six more instruments (guitars, strings, piano, keys, wind, other), each as its own labelled stemVocals, Bass, Drums, Guitars, Strings, Piano, Keys, Wind, OtherRemixes, DJ edits, practice by instrument, video soundtracks

In 2 stems and 4 stems terms: twoStem is the 2 stems split (vocals and instrumental); the vocals can come back as Lead Vocals and Backing Vocals, so it returns 1 to 3 files. fourStem returns the 4 stems split (Vocals, Drums, Bass and Other) plus Guitars, Strings, Piano, Keys and Wind when the song has them, up to nine files.

Read the label on each output rather than expecting a fixed count. Silent stems are left out of outputs, so an instrumental song returns no vocal stem, and a song with no piano returns no Piano stem.

Vocal remover API: separate vocals with twoStem

Use twoStem as a vocal remover API or separate vocals API: send POST /v1/songs/{song_id}/stems with "mode": "twoStem" and it returns the vocals and the instrumental as separate files, for karaoke, acapella or practice tracks. Use fourStem when you need each instrument.

Terminal
curl https://api.mozartai.com/v1/songs/5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14/stems \
  -H "Authorization: Bearer $MOZART_API_KEY" \
  -H "Idempotency-Key: stems-5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14-2" \
  -H "Content-Type: application/json" \
  -d '{"mode":"twoStem"}'

Audio stem separation and vocal removal use cases

Developers use a stem separation API to extract vocals, remove vocals or isolate instruments without hosting separation models:

  • Karaoke and sing-along apps. Use twoStem to remove vocals and play back the instrumental track.
  • Acapella extraction and vocal isolation. Use twoStem to extract the vocals as their own file for vocal study, mashups or sampling.
  • Remixes and DJ edits. Use fourStem to isolate Vocals, Drums, Bass and other instruments, so users can rearrange or rebalance a mix.
  • Practice tracks and video soundtracks. Mute or solo Guitars, Piano, Keys, Strings or Wind from fourStem outputs for instrument practice or background music.

What stem separation can and can't do

A separation model estimates each part from the finished mix. Stems from dense passages can carry faint bleed from other instruments or small artifacts, so check a stem by ear before you release it on its own.

How the stem separation API works

Stem separation runs as an asynchronous job: you start a split with one POST request, then collect the stem download links with long polling or a webhook.

  1. Get a song id. Generate a song with POST /v1/songs or a cover with POST /v1/covers, or list your songs with GET /v1/songs. The song must have finished generating.
  2. Start the split. Send POST /v1/songs/{song_id}/stems with mode set to twoStem or fourStem and an Idempotency-Key header. It returns 202 and a job.
  3. Collect the stems. Wait with POST /v1/jobs/wait, or get a signed webhook when the job finishes. Each stem is an entry in job.outputs with a label and a url.

Stem separation API endpoint summary

PropertyValue
Base URLhttps://api.mozartai.com
Start a splitPOST /v1/songs/{song_id}/stems
Wait for the jobPOST /v1/jobs/wait (up to 20 job_ids, wait_seconds up to 25)
Register a webhookPOST /v1/webhooks
AuthenticationAuthorization: Bearer <MOZART_API_KEY>
Required headerIdempotency-Key
ModestwoStem, fourStem (default)
Price check"dry_run": true or POST /v1/estimates

Stem separation API in curl, Python and JavaScript

Requests go to https://api.mozartai.com with your key as a bearer token. Requests and responses are JSON.

curl

Terminal
curl https://api.mozartai.com/v1/songs/5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14/stems \
  -H "Authorization: Bearer $MOZART_API_KEY" \
  -H "Idempotency-Key: stems-5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14-4" \
  -H "Content-Type: application/json" \
  -d '{"mode":"fourStem"}'

Then wait for the job (up to 25 seconds per call):

Terminal
curl https://api.mozartai.com/v1/jobs/wait \
  -H "Authorization: Bearer $MOZART_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"job_ids":["<job.id>"],"wait_seconds":25,"until":"complete"}'

Python

Python
import os
import requests

EXTENSIONS = {"audio/wav": ".wav", "audio/mpeg": ".mp3", "audio/flac": ".flac"}

API = "https://api.mozartai.com"
AUTH = {"Authorization": f"Bearer {os.environ['MOZART_API_KEY']}"}
SONG_ID = "5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14"

# 1. Price the split.
# dry_run still needs an Idempotency-Key; it charges nothing and starts no job.
preview = requests.post(
    f"{API}/v1/songs/{SONG_ID}/stems",
    headers={**AUTH, "Idempotency-Key": f"stems-{SONG_ID}-preview"},
    json={"mode": "fourStem", "dry_run": True},
    timeout=30,
)
preview.raise_for_status()
print("credits:", preview.json()["estimate"]["credits_required"])

# 2. Start the split. Reusing this key returns the same job.
start = requests.post(
    f"{API}/v1/songs/{SONG_ID}/stems",
    headers={**AUTH, "Idempotency-Key": f"stems-{SONG_ID}-4"},
    json={"mode": "fourStem"},
    timeout=30,
)
start.raise_for_status()
job_id = start.json()["job"]["id"]

# 3. Wait until it settles. Each call holds for up to 25 seconds.
for _ in range(12):  # up to 5 minutes
    res = requests.post(
        f"{API}/v1/jobs/wait",
        headers=AUTH,
        json={"job_ids": [job_id], "wait_seconds": 25, "until": "complete"},
        timeout=40,
    )
    res.raise_for_status()
    body = res.json()
    if body["all_settled"]:
        job = body["jobs"][0]
        break
else:
    raise TimeoutError(f"job {job_id} has not settled; check it again later")

if job["status"] == "succeeded":
    # 4. Download each stem before its link expires (url_expires_at).
    for stem in job["outputs"]:
        ext = EXTENSIONS.get(stem["content_type"], ".audio")
        path = f"{SONG_ID}-{stem['label'].lower().replace(' ', '-')}{ext}"
        audio = requests.get(stem["url"], timeout=120)
        audio.raise_for_status()
        with open(path, "wb") as f:
            f.write(audio.content)
        print("saved", stem["label"], "to", path)
else:
    print(job["status"], job["error"])

JavaScript (Node 18 or later)

JavaScript
const API = "https://api.mozartai.com";
const headers = {
  Authorization: `Bearer ${process.env.MOZART_API_KEY}`,
  "Content-Type": "application/json",
};
const songId = "5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14";

// Start the split. Reusing this key returns the same job.
const start = await fetch(`${API}/v1/songs/${songId}/stems`, {
  method: "POST",
  headers: { ...headers, "Idempotency-Key": `stems-${songId}-4` },
  body: JSON.stringify({ mode: "fourStem" }),
});
if (start.ok === false) throw new Error(`start failed: ${start.status}`);
const { job } = await start.json();

// Wait until it settles. Each call holds for up to 25 seconds.
let settled;
for (let i = 0; i < 12 && settled === undefined; i++) {
  const res = await fetch(`${API}/v1/jobs/wait`, {
    method: "POST",
    headers,
    body: JSON.stringify({ job_ids: [job.id], wait_seconds: 25, until: "complete" }),
  });
  const body = await res.json();
  if (body.all_settled) settled = body.jobs[0];
}

if (settled?.status === "succeeded") {
  for (const stem of settled.outputs) console.log(stem.label, stem.url);
} else {
  console.log(settled?.status ?? "not settled yet", settled?.error);
}

Stem separation API response format

Each completed job returns individual stem download URLs in job.outputs, with each entry's label, content_type, duration_seconds and url_expires_at (selected fields from the API schema; ids, labels and values are illustrative).

JSON
{
  "id": "2c009308-099e-4f3a-8b71-5d6e2a9c4f10",
  "object": "job",
  "kind": "stems",
  "status": "succeeded",
  "playable": true,
  "project_id": "3b7a9c21-5e4f-4d08-a6b2-9f1e7c3d5a80",
  "song_ids": ["5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14"],
  "outputs": [
    {
      "type": "stem",
      "song_id": "5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14",
      "label": "Vocals",
      "url": "https://...",
      "url_expires_at": "2026-11-28T10:15:00Z",
      "content_type": "audio/wav",
      "duration_seconds": 184.2
    }
  ],
  "credits_refunded": false,
  "error": null,
  "poll_after_seconds": null,
  "created_at": "2026-11-27T10:12:04Z",
  "completed_at": "2026-11-27T10:13:31Z"
}
FieldDescription
idJob id, used to wait for the job or to match a webhook
statusJob state: queued, running, succeeded, failed or cancelled
outputs[].labelStem name, such as Vocals, Drums, Bass or Instrumental
outputs[].urlDownload link for the stem audio file
outputs[].url_expires_atWhen the download link stops working
outputs[].content_typeMIME type of the stem file
outputs[].duration_secondsLength of the stem in seconds
credits_refundedtrue if the job failed and its credits were returned
errorOn a failed job, code, message and next_step

Stem separation API pricing

Stem separation is priced per started minute of audio: 23 credits a minute, so splitting a 3-minute song is 69 credits. See API plans and pricing.

Check the price of any split before you run it: send "dry_run": true to the stems endpoint, or call POST /v1/estimates with the song's length in duration_seconds. For a 184-second song, send {"operation":"stems.create","stem_mode":"twoStem","duration_seconds":184}: that is 4 started minutes, so credits_required is 92. The dry run returns estimate.credits_required and /v1/estimates returns credits_required; neither starts a job or spends credits.

  • Reads, job status and estimates never use credits.
  • A test key prices a split but does not run it: it returns estimate.credits_required and no stems. To get stems, use a live key.
  • A job that fails gives its credits back (credits_refunded: true).
  • REST keys spend the credits of your API plan. The REST API needs an API plan (Starter, Build, Scale or Growth), from $20 a month, or prepaid API credits, and spends API credits.
  • Stem splits also need a Mozart plan that includes them. If yours does not, the API answers STEM_SEPARATION_TIER_REQUIRED (see errors).

Retries, webhooks, limits and errors

  • Safe retries. Idempotency-Key is required. Repeat a request with the same key and you get the first job back, with nothing spent: a key is bound to its first request for 90 days; its response is replayed for 24 hours; use a new key for a new request.
  • Webhooks or long polling. Register a signed callback with POST /v1/webhooks to get results when a job finishes, or call POST /v1/jobs/wait with up to 20 job_ids, wait_seconds up to 25 and until set to complete. See the API reference for webhook schemas.
  • Expiring links. Each stem url works until its url_expires_at. Download the files you want to keep.
  • Daily caps. Stem splits have a daily cap per plan, counted across your whole account, and it resets daily. See rate limits and daily caps.
  • Errors you can act on. A request that can't start answers with an HTTP error: error.type, error.code, error.message, error.request_id and error.details, which holds what you need to act on, such as next_step, retry_after_seconds, resets_at or credits_required, depending on the error. Common ones when you start a split:
CodeHTTP statusWhenWhat to do
PUBLIC_API_INPUT_INVALID400The song hasn't finished generatingWait until the song has finished generating, then retry
PUBLIC_API_RESOURCE_NOT_FOUND404The song_id isn't one of your songsCheck the id with GET /v1/songs
INSUFFICIENT_CREDITS402Your balance is too lowStop. error.details.credits_required is what the split needs; top up or change plan, then retry with a new key
STEM_SEPARATION_TIER_REQUIRED403Your Mozart plan does not include stem splitsAsk the account owner to upgrade, at error.details.plans_url when it is set; retrying will not help
PUBLIC_API_RATE_LIMITED429Too many requestsWait details.retry_after_seconds, then repeat with the same key
PUBLIC_API_DAILY_LIMIT_REACHED429The daily cap is used upTry again after details.resets_at

A job that fails after it starts has status: "failed" and job.error with code, message and next_step, and its credits are refunded. Full list: API error reference.

Hosted stem separation API vs self-hosting Demucs or Spleeter

You can call a hosted stem separation API, which runs the separation model for you, or self-host an open-source separator such as Demucs or Spleeter and run the model on your own machines. The Mozart API is hosted, but it only splits songs in your Mozart library.

OptionWhat it splitsRoute or setupWhat you run
Mozart stem separation API (hosted)Songs you generate or cover with MozartPOST /v1/songs/{song_id}/stems with twoStem or fourStemNothing: same key and credits as your songs
ElevenLabs stem separation (hosted)A file you uploadPOST /v1/music/stem-separation with a multipart file; returns a ZIP of stemsNothing
StemSplit (hosted)An upload or a sourceUrlDeveloper API with outputType: "FOUR_STEMS"Nothing
StemConsole (hosted)A URL or an uploadModels vocals (2 stems), fast (4 stems) and full (6 stems)Nothing
Demucs (self-hosted)Any fileMIT-licensed code on GitHub; the original repository is archived and the author's fork takes only important bug fixesThe model and the compute
Spleeter (self-hosted)Any fileMIT-licensed code, installed with pipThe model and the compute

Vendor routes are from each vendor's developer page, checked 27 Nov 2026. Use a hosted API that accepts uploads to split files you didn't make with Mozart, self-host Demucs or Spleeter when you would rather run the model than pay per split, and use the Mozart API when the song already comes from the Mozart music API.

Frequently asked questions

What is a stem separation API?

A stem separation API, also called a music source separation API, takes a mixed song and returns its parts as separate audio files: vocals and instrumental, or vocals, drums, bass and other instruments. Developers use it for karaoke, remixes, practice tracks and DJ edits without running separation models themselves. The Mozart stem separation API does this for songs in your Mozart library.

Is there an API for splitting songs into stems?

Yes. The Mozart stem splitting API is one REST call: POST /v1/songs/{song_id}/stems with mode set to twoStem or fourStem. It works on songs in your Mozart library and returns each stem as a download link.

Can I split my own audio files?

No. The stems endpoint splits songs in your Mozart library: songs you generate with POST /v1/songs and covers made with POST /v1/covers. A cover of an uploaded file is a new song in a new style, not the original recording. To split any file, use a hosted API that accepts uploads, or run an open-source tool such as Demucs yourself.

Which stems do I get?

twoStem returns up to two stems: vocals and instrumental. fourStem returns up to nine: Vocals, Bass, Drums, Guitars, Strings, Piano, Keys, Wind and Other. Silent stems are left out, so read the label on each output. Each output has a label, a url, url_expires_at, content_type and duration_seconds.

Is twoStem a 2 stems split and fourStem a 4 stems split?

Close. twoStem is the 2 stems split, vocals and instrumental, so it returns up to two files. fourStem covers the 4 stems split (Vocals, Drums, Bass and Other) and also returns Guitars, Strings, Piano, Keys and Wind when the song has them, up to nine files.

How do I separate vocals from a song with an API?

Use the vocal remover mode, a vocal separation API call: send POST /v1/songs/{song_id}/stems with mode set to twoStem. The job returns the vocals and the instrumental as separate stems, each with a download url, for songs in your Mozart library.

Can I download the stems?

Yes. Each stem comes back as its own download url in job.outputs, with its label, content_type (the MIME type of the file) and duration_seconds. Download it before url_expires_at, when the link stops working.

How much does a stem split cost?

Stem separation is 23 credits per minute of audio, so a 3-minute song is 69 credits. Send dry_run: true or call POST /v1/estimates with stem_mode and the song's duration_seconds to see credits_required for free before you spend anything. A failed split gives its credits back. Stem splits also need a Mozart plan that includes them; otherwise the API answers STEM_SEPARATION_TIER_REQUIRED. See pricing.

Is there a free stem separation API?

On Mozart, estimates, test keys and job status are free, and running a split spends credits. To split your own files with no API fee, self-host an open-source separator such as Demucs or Spleeter from GitHub; Hugging Face also hosts community uploads of Demucs models.

Should I use a hosted stem separation API or self-host Demucs?

Use a hosted API when you don't want to run separation models yourself, and self-host Demucs or Spleeter when you want no per-split fee and can run the model on your own machines. The Mozart API is hosted and splits songs in your Mozart library; to split files you upload, use a hosted API that accepts uploads or a self-hosted model.

Can I use the stem separation API from Python or JavaScript?

Yes. The API is plain REST with JSON, so Python (requests), JavaScript (fetch in Node 18 or later) or any HTTP client works. Working Python and JavaScript samples are on this page.

Can I use the stem separation API from an Android or iOS app?

Yes. It is plain REST, so call it from your own backend and pass the stem links to the app. Keep MOZART_API_KEY on the server, not in the app.

What happens if a split fails or I retry?

A failed job gives its credits back. If your request times out and you repeat it with the same Idempotency-Key, you get the first job back and nothing is charged twice.

Can I split a batch of songs at once?

Yes. Start one split per song, each with its own Idempotency-Key, then wait for up to 20 of them in one call with POST /v1/jobs/wait and a list of job_ids. Daily caps apply across your account.

Does the stem separation API support webhooks?

Yes. Register a webhook with POST /v1/webhooks to get a signed callback when a stem separation job finishes, or use long polling with POST /v1/jobs/wait for up to 25 seconds per request.

Split your first Mozart song into stems

Read the API referenceGet API key

Generate a song, then split it with one more call. The REST API needs an API plan (Starter, Build, Scale or Growth), from $20 a month, or prepaid API credits, and spends API credits.