Skip to main content
meta avatar

SAM Audio — Separate API

meta/sam-audio/separate

Isolate any sound from an audio mixture by describing it in plain language.

segmentation
0.001667 per second of output video

Model Input

Input

URL of the audio file to process (WAV, MP3, FLAC supported).

Text prompt describing the sound to isolate.

Additional Settings

Customize your input with more control.

Automatically predict temporal spans where the target sound occurs.

Min: 1 - Max: 7

Number of candidates to generate and rank. Values above 1 incur an additional charge per extra candidate.

The acceleration level to use, trading speed against quality.

Min: 10 - Max: 60

Maximum audio duration (seconds) to process in a single pass.

Min: 0 - Max: 30

Overlap duration (seconds) between chunks for crossfade blending.

Output audio format.

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

Model Output

Output

Loading
Generated in 5.706 seconds
Logs (1 lines)

Model Example Requests

Examples

SAM Audio — Separate API

SAM Audio — Separate 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 $0.001667 per second of audio.

POST https://queue.modelrunner.run/meta/sam-audio/separate

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/sam-audio/separate \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "dog barking",
    "audio_url": "https://media.modelrunner.ai/JbyO9TzNupSFoqNrlmaWe.mp3",
    "acceleration": "balanced",
    "chunk_overlap": 5,
    "output_format": "wav",
    "predict_spans": false,
    "max_chunk_duration": 60,
    "reranking_candidates": 1,
    "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/sam-audio/separate/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/meta/sam-audio/separate/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

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

const result = await modelrunner.subscribe("meta/sam-audio/separate", {
  input: {
    "prompt": "dog barking",
    "audio_url": "https://media.modelrunner.ai/JbyO9TzNupSFoqNrlmaWe.mp3",
    "acceleration": "balanced",
    "chunk_overlap": 5,
    "output_format": "wav",
    "predict_spans": false,
    "max_chunk_duration": 60,
    "reranking_candidates": 1
  },
});
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/sam-audio/separate",
    headers=headers,
    json={
      "prompt": "dog barking",
      "audio_url": "https://media.modelrunner.ai/JbyO9TzNupSFoqNrlmaWe.mp3",
      "acceleration": "balanced",
      "chunk_overlap": 5,
      "output_format": "wav",
      "predict_spans": false,
      "max_chunk_duration": 60,
      "reranking_candidates": 1
    },
).json()

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

Input parameters

NameTypeRequiredDescription
audio_urlstring (uri)yesURL of the audio file to process (WAV, MP3, FLAC supported).
promptstringyesText prompt describing the sound to isolate.
predict_spansbooleannoAutomatically predict temporal spans where the target sound occurs. Default: false.
reranking_candidatesintegernoNumber of candidates to generate and rank. Values above 1 incur an additional charge per extra candidate. Default: 1.
accelerationenumnoThe acceleration level to use, trading speed against quality. Default: "balanced".
max_chunk_durationnumbernoMaximum audio duration (seconds) to process in a single pass. Default: 60.
chunk_overlapnumbernoOverlap duration (seconds) between chunks for crossfade blending. Default: 5.
output_formatenumnoOutput audio format. Default: "wav".

Machine-readable: OpenAPI schema · llms.txt

Use SAM Audio — Separate from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and SAM Audio — Separate 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/sam-audio/separate.

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/sam-audio/separate on ModelRunner to generate audio”. MCP setup guide.

Model Details

Model Details

SAM Audio (Separate) performs text-guided audio source separation: give it a mixed recording and a short natural-language description of the sound you want, and it isolates that sound into its own track. Describe the target however you'd say it — "dog barking", "lead vocals", "speech", "rain", "electric guitar" — and it returns the isolated target as a hosted audio file. Its strength is open-vocabulary targeting: you are not limited to a fixed set of stems, so it works for voices, instruments, environmental sounds, and effects alike. The model also computes a residual (everything except the target), but this endpoint returns the isolated target track as its result.

## Best for - Pulling a single voice, instrument, or sound effect out of a noisy or layered mixture - Isolating an arbitrary sound described in words rather than a preset stem (e.g. "a barking dog", "crowd applause") - Cleaning up field recordings, podcasts, and interviews by extracting just the sound you care about - Prepping audio for editing, sampling, or accessibility work where you need one element on its own

## Choose another model when - You only need to strip background noise/music to recover clean speech — a dedicated voice-isolation model is simpler - You want a fixed multi-stem split (vocals/drums/bass/other) returned all at once rather than one described target - You need to generate or transform audio rather than separate an existing recording — use a text-to-audio or audio-to-audio synthesis model

## Tips - Keep the `prompt` short and concrete; name the sound the way you'd describe it out loud - Supply `audio_url` as a WAV, MP3, or FLAC file - `acceleration` trades speed for quality (`fast`, `balanced`, `quality`); the default `balanced` is a good starting point - `reranking_candidates` generates and ranks multiple separations to improve quality — note that values above 1 incur an additional charge per extra candidate - For long files, `max_chunk_duration` and `chunk_overlap` control how the audio is split and crossfaded across passes

## Limitations - Heavily overlapping or spectrally similar sounds can bleed between the target and residual - The endpoint returns the isolated target only; the residual is computed but not returned as the result

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

const result = await modelrunner.subscribe("meta/sam-audio/separate", { input: { audio_url: "https://media.modelrunner.ai/JbyO9TzNupSFoqNrlmaWe.mp3", prompt: "dog barking", acceleration: "balanced", }, }); ```