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.
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
mode | What you get | Labels it can return | Use it for |
|---|---|---|---|
twoStem | Vocals and instrumental | Vocals, Lead Vocals, Backing Vocals, Instrumental | Karaoke, 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 stem | Vocals, Bass, Drums, Guitars, Strings, Piano, Keys, Wind, Other | Remixes, 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.
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
twoStemto remove vocals and play back the instrumental track. - Acapella extraction and vocal isolation. Use
twoStemto extract the vocals as their own file for vocal study, mashups or sampling. - Remixes and DJ edits. Use
fourStemto 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
fourStemoutputs 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.
- Get a song id. Generate a song with
POST /v1/songsor a cover withPOST /v1/covers, or list your songs withGET /v1/songs. The song must have finished generating. - Start the split. Send
POST /v1/songs/{song_id}/stemswithmodeset totwoStemorfourStemand anIdempotency-Keyheader. It returns202and a job. - Collect the stems. Wait with
POST /v1/jobs/wait, or get a signed webhook when the job finishes. Each stem is an entry injob.outputswith alabeland aurl.
Stem separation API endpoint summary
| Property | Value |
|---|---|
| Base URL | https://api.mozartai.com |
| Start a split | POST /v1/songs/{song_id}/stems |
| Wait for the job | POST /v1/jobs/wait (up to 20 job_ids, wait_seconds up to 25) |
| Register a webhook | POST /v1/webhooks |
| Authentication | Authorization: Bearer <MOZART_API_KEY> |
| Required header | Idempotency-Key |
| Modes | twoStem, 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
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):
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
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)
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).
{
"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"
}| Field | Description |
|---|---|
id | Job id, used to wait for the job or to match a webhook |
status | Job state: queued, running, succeeded, failed or cancelled |
outputs[].label | Stem name, such as Vocals, Drums, Bass or Instrumental |
outputs[].url | Download link for the stem audio file |
outputs[].url_expires_at | When the download link stops working |
outputs[].content_type | MIME type of the stem file |
outputs[].duration_seconds | Length of the stem in seconds |
credits_refunded | true if the job failed and its credits were returned |
error | On 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_requiredand 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-Keyis 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/webhooksto get results when a job finishes, or callPOST /v1/jobs/waitwith up to 20job_ids,wait_secondsup to 25 anduntilset tocomplete. See the API reference for webhook schemas. - Expiring links. Each stem
urlworks until itsurl_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_idanderror.details, which holds what you need to act on, such asnext_step,retry_after_seconds,resets_atorcredits_required, depending on the error. Common ones when you start a split:
| Code | HTTP status | When | What to do |
|---|---|---|---|
PUBLIC_API_INPUT_INVALID | 400 | The song hasn't finished generating | Wait until the song has finished generating, then retry |
PUBLIC_API_RESOURCE_NOT_FOUND | 404 | The song_id isn't one of your songs | Check the id with GET /v1/songs |
INSUFFICIENT_CREDITS | 402 | Your balance is too low | Stop. error.details.credits_required is what the split needs; top up or change plan, then retry with a new key |
STEM_SEPARATION_TIER_REQUIRED | 403 | Your Mozart plan does not include stem splits | Ask the account owner to upgrade, at error.details.plans_url when it is set; retrying will not help |
PUBLIC_API_RATE_LIMITED | 429 | Too many requests | Wait details.retry_after_seconds, then repeat with the same key |
PUBLIC_API_DAILY_LIMIT_REACHED | 429 | The daily cap is used up | Try 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.
| Option | What it splits | Route or setup | What you run |
|---|---|---|---|
| Mozart stem separation API (hosted) | Songs you generate or cover with Mozart | POST /v1/songs/{song_id}/stems with twoStem or fourStem | Nothing: same key and credits as your songs |
| ElevenLabs stem separation (hosted) | A file you upload | POST /v1/music/stem-separation with a multipart file; returns a ZIP of stems | Nothing |
| StemSplit (hosted) | An upload or a sourceUrl | Developer API with outputType: "FOUR_STEMS" | Nothing |
| StemConsole (hosted) | A URL or an upload | Models vocals (2 stems), fast (4 stems) and full (6 stems) | Nothing |
| Demucs (self-hosted) | Any file | MIT-licensed code on GitHub; the original repository is archived and the author's fork takes only important bug fixes | The model and the compute |
| Spleeter (self-hosted) | Any file | MIT-licensed code, installed with pip | The 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.
Related APIs and guides
- Music API: songs with vocals, lyrics and cover art, from $0.071 a song, 2 songs per request.
- Audio to MIDI API: turn a song, or a file you upload, into MIDI notes.
- Mastering API: bring a finished song up to release loudness.
- ElevenLabs stem separation and music API compared: ElevenLabs Music API pricing and endpoints, including stem separation, next to a per-song music API.
- API reference: request and response schemas for every endpoint.
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.
Related pages
ElevenLabs Music API pricing compared
Per-minute pricing against a per-song music API.
Read the guideDoes Suno have an API?
What Suno offers developers today, and the alternatives.
Read the guideAudio to MIDI API
Turn a song or a recording into a .mid file.
Read the guideMastering API
Bring a generated song up to streaming loudness.
Read the guideGenerate a song with Python
A short Python script that makes two songs and saves both MP3 files.
Read the guide
Split your first Mozart song into stems
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.