curl https://api.snapgen.org/v1/audio/isolation \
-H "Authorization: Bearer $SNAPGEN_API_KEY" \
-F model=eleven-voice-isolator \
-F file=@noisy-vlog.mp3 \
--output voice.mp3
curl https://api.snapgen.org/v1/audio/isolation \
-H "Authorization: Bearer $SNAPGEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "eleven-voice-isolator",
"audio_url": "https://example.com/noisy-vlog.mp3"
}' \
--output voice.mp3
import os
import requests
with open("noisy-vlog.mp3", "rb") as audio:
response = requests.post(
"https://api.snapgen.org/v1/audio/isolation",
headers={"Authorization": f"Bearer {os.environ['SNAPGEN_API_KEY']}"},
data={"model": "eleven-voice-isolator"},
files={"file": ("noisy-vlog.mp3", audio, "audio/mpeg")},
timeout=600,
)
response.raise_for_status()
with open("voice.mp3", "wb") as output:
output.write(response.content)
import { openAsBlob } from "node:fs";
import { writeFile } from "node:fs/promises";
const form = new FormData();
form.append("model", "eleven-voice-isolator");
form.append("file", await openAsBlob("noisy-vlog.mp3"), "noisy-vlog.mp3");
const response = await fetch("https://api.snapgen.org/v1/audio/isolation", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.SNAPGEN_API_KEY}` },
body: form,
});
if (!response.ok) throw new Error(await response.text());
await writeFile("voice.mp3", Buffer.from(await response.arrayBuffer()));
HTTP/1.1 200 OK
content-type: audio/mpeg
cache-control: no-store
x-gateway-execution-id: 5b1e9f3a-2c4d-4e6f-8a7b-9c0d1e2f3a4b
<binary MP3 audio>
{
"error": {
"message": "The audio must be at least 4.6 seconds long",
"type": "invalid_request_error",
"param": null,
"code": "audio_too_short"
}
}
Endpoint Reference
Voice isolation
Remove background noise and music from a recording and receive the isolated voice as MP3.
POST
/
v1
/
audio
/
isolation
curl https://api.snapgen.org/v1/audio/isolation \
-H "Authorization: Bearer $SNAPGEN_API_KEY" \
-F model=eleven-voice-isolator \
-F file=@noisy-vlog.mp3 \
--output voice.mp3
curl https://api.snapgen.org/v1/audio/isolation \
-H "Authorization: Bearer $SNAPGEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "eleven-voice-isolator",
"audio_url": "https://example.com/noisy-vlog.mp3"
}' \
--output voice.mp3
import os
import requests
with open("noisy-vlog.mp3", "rb") as audio:
response = requests.post(
"https://api.snapgen.org/v1/audio/isolation",
headers={"Authorization": f"Bearer {os.environ['SNAPGEN_API_KEY']}"},
data={"model": "eleven-voice-isolator"},
files={"file": ("noisy-vlog.mp3", audio, "audio/mpeg")},
timeout=600,
)
response.raise_for_status()
with open("voice.mp3", "wb") as output:
output.write(response.content)
import { openAsBlob } from "node:fs";
import { writeFile } from "node:fs/promises";
const form = new FormData();
form.append("model", "eleven-voice-isolator");
form.append("file", await openAsBlob("noisy-vlog.mp3"), "noisy-vlog.mp3");
const response = await fetch("https://api.snapgen.org/v1/audio/isolation", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.SNAPGEN_API_KEY}` },
body: form,
});
if (!response.ok) throw new Error(await response.text());
await writeFile("voice.mp3", Buffer.from(await response.arrayBuffer()));
HTTP/1.1 200 OK
content-type: audio/mpeg
cache-control: no-store
x-gateway-execution-id: 5b1e9f3a-2c4d-4e6f-8a7b-9c0d1e2f3a4b
<binary MP3 audio>
{
"error": {
"message": "The audio must be at least 4.6 seconds long",
"type": "invalid_request_error",
"param": null,
"code": "audio_too_short"
}
}
POST /v1/audio/isolation removes background noise, music, and ambience from a recording and returns the isolated voice as an MP3 file in the response body. The recording must be at least 4.6 seconds long.
| Model | Input | Price |
|---|---|---|
eleven-voice-isolator | 4.6 to 3,600 seconds, up to 50 MB | $0.003 per second ($0.18 per minute) |
string
required
Set to
eleven-voice-isolator.file
The recording, in a multipart field named
file, up to 50 MB. Send file
or audio_url, not both.string
Public
http or https URL of the recording. The gateway downloads it, up
to 50 MB. Send audio_url or file, not both.model
field and one file in file. The gateway accepts WAV, AIFF, MP3, AAC, MP4,
M4A, MOV, FLAC, Ogg, and WebM files whose length can be read.
The provider rejects recordings shorter than 4.6 seconds, so the gateway
returns
audio_too_short for them before any balance is reserved.Response
A successful request returns HTTP200 with MP3 audio as the body
(Content-Type: audio/mpeg). The response carries x-gateway-execution-id.
Billing
The gateway bills the measured length of the input at $0.003 per second, rounded up to whole seconds after a 0.1-second allowance. A 10-second clip costs $0.03; a one-hour recording costs $10.80. Failed requests aren’t charged. This endpoint rejectsIdempotency-Key; if a request times out, check
your Console request logs before you retry.
Errors
| Status | error.code | Cause |
|---|---|---|
| 400 | audio_input_required | Neither file nor audio_url was sent. |
| 400 | audio_too_short | The recording is shorter than 4.6 seconds. |
| 400 | audio_too_long | The recording is longer than 3,600 seconds. |
| 400 | invalid_request | A field other than audio_url was sent, or both file and audio_url were sent. |
| 400 | invalid_multipart | The form has no model field, more than one file, a repeated field, or the file isn’t in the file field. |
| 400 | unsupported_audio_format | The format isn’t supported, or its length can’t be read. |
| 400 | audio_download_failed | The gateway couldn’t download audio_url. |
| 402 | insufficient_funds | Your balance can’t cover the request. |
| 413 | audio_too_large, request_too_large | The downloaded file or the upload is larger than 50 MB. |
curl https://api.snapgen.org/v1/audio/isolation \
-H "Authorization: Bearer $SNAPGEN_API_KEY" \
-F model=eleven-voice-isolator \
-F file=@noisy-vlog.mp3 \
--output voice.mp3
curl https://api.snapgen.org/v1/audio/isolation \
-H "Authorization: Bearer $SNAPGEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "eleven-voice-isolator",
"audio_url": "https://example.com/noisy-vlog.mp3"
}' \
--output voice.mp3
import os
import requests
with open("noisy-vlog.mp3", "rb") as audio:
response = requests.post(
"https://api.snapgen.org/v1/audio/isolation",
headers={"Authorization": f"Bearer {os.environ['SNAPGEN_API_KEY']}"},
data={"model": "eleven-voice-isolator"},
files={"file": ("noisy-vlog.mp3", audio, "audio/mpeg")},
timeout=600,
)
response.raise_for_status()
with open("voice.mp3", "wb") as output:
output.write(response.content)
import { openAsBlob } from "node:fs";
import { writeFile } from "node:fs/promises";
const form = new FormData();
form.append("model", "eleven-voice-isolator");
form.append("file", await openAsBlob("noisy-vlog.mp3"), "noisy-vlog.mp3");
const response = await fetch("https://api.snapgen.org/v1/audio/isolation", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.SNAPGEN_API_KEY}` },
body: form,
});
if (!response.ok) throw new Error(await response.text());
await writeFile("voice.mp3", Buffer.from(await response.arrayBuffer()));
HTTP/1.1 200 OK
content-type: audio/mpeg
cache-control: no-store
x-gateway-execution-id: 5b1e9f3a-2c4d-4e6f-8a7b-9c0d1e2f3a4b
<binary MP3 audio>
{
"error": {
"message": "The audio must be at least 4.6 seconds long",
"type": "invalid_request_error",
"param": null,
"code": "audio_too_short"
}
}