curl --request POST \
--url https://api.moda.app/v1/media/generate-audio \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"mode": "<string>",
"prompt": "<string>",
"voice": "<string>",
"duration_seconds": 123,
"num_samples": 123,
"model_params": {},
"idempotency_key": "<string>",
"wait": true,
"quote": false,
"source_audio": "<string>",
"context": {
"previous_text": "<string>",
"next_text": "<string>",
"previous_task_ids": [
"<string>"
],
"next_task_ids": [
"<string>"
]
},
"pronunciation_dictionaries": [
{
"id": "<string>",
"revision": 2
}
],
"quote_source_seconds": 123,
"max_estimated_credits": 123,
"voices": [
"<string>"
]
}
'import requests
url = "https://api.moda.app/v1/media/generate-audio"
payload = {
"model": "<string>",
"mode": "<string>",
"prompt": "<string>",
"voice": "<string>",
"duration_seconds": 123,
"num_samples": 123,
"model_params": {},
"idempotency_key": "<string>",
"wait": True,
"quote": False,
"source_audio": "<string>",
"context": {
"previous_text": "<string>",
"next_text": "<string>",
"previous_task_ids": ["<string>"],
"next_task_ids": ["<string>"]
},
"pronunciation_dictionaries": [
{
"id": "<string>",
"revision": 2
}
],
"quote_source_seconds": 123,
"max_estimated_credits": 123,
"voices": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
mode: '<string>',
prompt: '<string>',
voice: '<string>',
duration_seconds: 123,
num_samples: 123,
model_params: {},
idempotency_key: '<string>',
wait: true,
quote: false,
source_audio: '<string>',
context: {
previous_text: '<string>',
next_text: '<string>',
previous_task_ids: ['<string>'],
next_task_ids: ['<string>']
},
pronunciation_dictionaries: [{id: '<string>', revision: 2}],
quote_source_seconds: 123,
max_estimated_credits: 123,
voices: ['<string>']
})
};
fetch('https://api.moda.app/v1/media/generate-audio', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moda.app/v1/media/generate-audio",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'mode' => '<string>',
'prompt' => '<string>',
'voice' => '<string>',
'duration_seconds' => 123,
'num_samples' => 123,
'model_params' => [
],
'idempotency_key' => '<string>',
'wait' => true,
'quote' => false,
'source_audio' => '<string>',
'context' => [
'previous_text' => '<string>',
'next_text' => '<string>',
'previous_task_ids' => [
'<string>'
],
'next_task_ids' => [
'<string>'
]
],
'pronunciation_dictionaries' => [
[
'id' => '<string>',
'revision' => 2
]
],
'quote_source_seconds' => 123,
'max_estimated_credits' => 123,
'voices' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.moda.app/v1/media/generate-audio"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"voice\": \"<string>\",\n \"duration_seconds\": 123,\n \"num_samples\": 123,\n \"model_params\": {},\n \"idempotency_key\": \"<string>\",\n \"wait\": true,\n \"quote\": false,\n \"source_audio\": \"<string>\",\n \"context\": {\n \"previous_text\": \"<string>\",\n \"next_text\": \"<string>\",\n \"previous_task_ids\": [\n \"<string>\"\n ],\n \"next_task_ids\": [\n \"<string>\"\n ]\n },\n \"pronunciation_dictionaries\": [\n {\n \"id\": \"<string>\",\n \"revision\": 2\n }\n ],\n \"quote_source_seconds\": 123,\n \"max_estimated_credits\": 123,\n \"voices\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.moda.app/v1/media/generate-audio")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"voice\": \"<string>\",\n \"duration_seconds\": 123,\n \"num_samples\": 123,\n \"model_params\": {},\n \"idempotency_key\": \"<string>\",\n \"wait\": true,\n \"quote\": false,\n \"source_audio\": \"<string>\",\n \"context\": {\n \"previous_text\": \"<string>\",\n \"next_text\": \"<string>\",\n \"previous_task_ids\": [\n \"<string>\"\n ],\n \"next_task_ids\": [\n \"<string>\"\n ]\n },\n \"pronunciation_dictionaries\": [\n {\n \"id\": \"<string>\",\n \"revision\": 2\n }\n ],\n \"quote_source_seconds\": 123,\n \"max_estimated_credits\": 123,\n \"voices\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moda.app/v1/media/generate-audio")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"voice\": \"<string>\",\n \"duration_seconds\": 123,\n \"num_samples\": 123,\n \"model_params\": {},\n \"idempotency_key\": \"<string>\",\n \"wait\": true,\n \"quote\": false,\n \"source_audio\": \"<string>\",\n \"context\": {\n \"previous_text\": \"<string>\",\n \"next_text\": \"<string>\",\n \"previous_task_ids\": [\n \"<string>\"\n ],\n \"next_task_ids\": [\n \"<string>\"\n ]\n },\n \"pronunciation_dictionaries\": [\n {\n \"id\": \"<string>\",\n \"revision\": 2\n }\n ],\n \"quote_source_seconds\": 123,\n \"max_estimated_credits\": 123,\n \"voices\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}Generate Audio
Generate speech, music, or a sound effect from text (metered).
Pick mode first: text_to_speech (a voice saying your exact words —
prompt IS the script), text_to_music, or text_to_sfx. The model card on
GET /v1/media/models says which modes each model serves.
Managed voice models (elevenlabs-native-*, listed by
GET /v1/voices/capabilities) are a durable task lane instead: the answer is
an audio_generation task envelope (or, with quote: true, an
audio_generation_quote that starts nothing). wait: false returns it
queued; poll GET /v1/media/generate-audio/{task_id} no sooner than its
retry_after_ms, and stop it with POST /v1/media/generate-audio/{task_id}/cancel.
voice is a vox_ id, speech_to_speech converts a source_audio upload,
and an idempotency_key makes the call safe to repeat: the same key and
input return the same task (replayed: true), whatever its state. Everything
below this paragraph describes the other models.
Synchronous: the render runs inside this call and there is no wait: false
task lane. Speech returns in seconds. Music and sound effects can be asked
for at up to 600 seconds of output and may take correspondingly longer; a
render that outruns this call’s wait is asked to cancel and reported as a
retryable 503. Repeat that call with the same idempotency_key: it adopts
the existing provider job, so it returns the audio if the render finished
anyway and reports it cancelled if it did not — and it can never pay for a
second render. Only once it reports cancelled is a new request worth making
— and that one needs a NEW idempotency_key as well as a shorter duration or
fewer samples, since a changed payload under the old key is a 409
idempotency_conflict.
Direct elevenlabs-eleven-v4-turbo speech also returns ElevenLabs character
alignment and normalized_alignment in each result when available, so captions
can use the generated narration’s timings without a transcription call.
results carries one entry per delivered take (num_samples), applied
reports the knobs that actually ran, and adjustments names every field
that differed from the ask, with a reason — read them before describing the
output to a user. A take that came back more than half a second longer than
duration_seconds is trimmed to it with a short fade-out; the full take is
results[].untrimmed, and an adjustments entry says so. A take that missed
by more than max(2 s, 10%) and was not trimmed is reported there too.
In a Voyager-billed workspace, the direct models (ElevenLabs speech, music
and sound effects, and Fish Audio) are billed to Voyager credits, and the
receipt says so (usage.billing_product: "voyager", usage.estimated_credits
in Voyager credits). Every other audio model, the hosted ElevenLabs copies
included, is refused with 403 not_available_on_voyager_billing, whose
details.use_instead.models lists the ones that can be billed.
curl --request POST \
--url https://api.moda.app/v1/media/generate-audio \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"mode": "<string>",
"prompt": "<string>",
"voice": "<string>",
"duration_seconds": 123,
"num_samples": 123,
"model_params": {},
"idempotency_key": "<string>",
"wait": true,
"quote": false,
"source_audio": "<string>",
"context": {
"previous_text": "<string>",
"next_text": "<string>",
"previous_task_ids": [
"<string>"
],
"next_task_ids": [
"<string>"
]
},
"pronunciation_dictionaries": [
{
"id": "<string>",
"revision": 2
}
],
"quote_source_seconds": 123,
"max_estimated_credits": 123,
"voices": [
"<string>"
]
}
'import requests
url = "https://api.moda.app/v1/media/generate-audio"
payload = {
"model": "<string>",
"mode": "<string>",
"prompt": "<string>",
"voice": "<string>",
"duration_seconds": 123,
"num_samples": 123,
"model_params": {},
"idempotency_key": "<string>",
"wait": True,
"quote": False,
"source_audio": "<string>",
"context": {
"previous_text": "<string>",
"next_text": "<string>",
"previous_task_ids": ["<string>"],
"next_task_ids": ["<string>"]
},
"pronunciation_dictionaries": [
{
"id": "<string>",
"revision": 2
}
],
"quote_source_seconds": 123,
"max_estimated_credits": 123,
"voices": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
mode: '<string>',
prompt: '<string>',
voice: '<string>',
duration_seconds: 123,
num_samples: 123,
model_params: {},
idempotency_key: '<string>',
wait: true,
quote: false,
source_audio: '<string>',
context: {
previous_text: '<string>',
next_text: '<string>',
previous_task_ids: ['<string>'],
next_task_ids: ['<string>']
},
pronunciation_dictionaries: [{id: '<string>', revision: 2}],
quote_source_seconds: 123,
max_estimated_credits: 123,
voices: ['<string>']
})
};
fetch('https://api.moda.app/v1/media/generate-audio', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moda.app/v1/media/generate-audio",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'mode' => '<string>',
'prompt' => '<string>',
'voice' => '<string>',
'duration_seconds' => 123,
'num_samples' => 123,
'model_params' => [
],
'idempotency_key' => '<string>',
'wait' => true,
'quote' => false,
'source_audio' => '<string>',
'context' => [
'previous_text' => '<string>',
'next_text' => '<string>',
'previous_task_ids' => [
'<string>'
],
'next_task_ids' => [
'<string>'
]
],
'pronunciation_dictionaries' => [
[
'id' => '<string>',
'revision' => 2
]
],
'quote_source_seconds' => 123,
'max_estimated_credits' => 123,
'voices' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.moda.app/v1/media/generate-audio"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"voice\": \"<string>\",\n \"duration_seconds\": 123,\n \"num_samples\": 123,\n \"model_params\": {},\n \"idempotency_key\": \"<string>\",\n \"wait\": true,\n \"quote\": false,\n \"source_audio\": \"<string>\",\n \"context\": {\n \"previous_text\": \"<string>\",\n \"next_text\": \"<string>\",\n \"previous_task_ids\": [\n \"<string>\"\n ],\n \"next_task_ids\": [\n \"<string>\"\n ]\n },\n \"pronunciation_dictionaries\": [\n {\n \"id\": \"<string>\",\n \"revision\": 2\n }\n ],\n \"quote_source_seconds\": 123,\n \"max_estimated_credits\": 123,\n \"voices\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.moda.app/v1/media/generate-audio")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"voice\": \"<string>\",\n \"duration_seconds\": 123,\n \"num_samples\": 123,\n \"model_params\": {},\n \"idempotency_key\": \"<string>\",\n \"wait\": true,\n \"quote\": false,\n \"source_audio\": \"<string>\",\n \"context\": {\n \"previous_text\": \"<string>\",\n \"next_text\": \"<string>\",\n \"previous_task_ids\": [\n \"<string>\"\n ],\n \"next_task_ids\": [\n \"<string>\"\n ]\n },\n \"pronunciation_dictionaries\": [\n {\n \"id\": \"<string>\",\n \"revision\": 2\n }\n ],\n \"quote_source_seconds\": 123,\n \"max_estimated_credits\": 123,\n \"voices\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moda.app/v1/media/generate-audio")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"mode\": \"<string>\",\n \"prompt\": \"<string>\",\n \"voice\": \"<string>\",\n \"duration_seconds\": 123,\n \"num_samples\": 123,\n \"model_params\": {},\n \"idempotency_key\": \"<string>\",\n \"wait\": true,\n \"quote\": false,\n \"source_audio\": \"<string>\",\n \"context\": {\n \"previous_text\": \"<string>\",\n \"next_text\": \"<string>\",\n \"previous_task_ids\": [\n \"<string>\"\n ],\n \"next_task_ids\": [\n \"<string>\"\n ]\n },\n \"pronunciation_dictionaries\": [\n {\n \"id\": \"<string>\",\n \"revision\": 2\n }\n ],\n \"quote_source_seconds\": 123,\n \"max_estimated_credits\": 123,\n \"voices\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}{
"type": "invalid_request",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"request_id": "<string>",
"causes": [
"<unknown>"
],
"details": {},
"retry_after_ms": 123,
"retryable": true
}Headers
Calendar-dated API version pin. New integrations should pin 2026-05-01 to opt into the newest response shapes. For back-compat the server also accepts requests with no header and resolves them to the current default (today: 2026-04-12); that default advances on each sunset date. Any unsupported value returns 400 unsupported_version.
2026-04-12, 2026-05-01 "2026-05-01"
Body
text_to_speech, text_to_music, or text_to_sfx. Stated rather than derived — every mode takes exactly text, so there is no input role to derive it from. The model card on GET /v1/media/models says which modes each model serves. Managed voice models also take speech_to_speech (aliases sts, voice_conversion) and require mode to equal the model's operation.
Speech only. Normally a preset name from the mode's voices on GET /v1/media/models; on a mode whose card sets voice_is_free_form, voices is empty and this takes any provider voice name or cloned-voice id instead, checked for shape here and resolved by the provider. Omit for the mode's default. Managed voice models require a vox_ id from GET /v1/voices, of the model's own provider (a Fish Audio voice on a fishaudio-native-* model, an Inworld voice on an inworld-native-* model). The fishaudio-* models take a Fish voice model id or a Fish vox_ id.
Keys the provider-job checkpoint: a retried call with the same key resumes the existing render instead of paying for a duplicate. On a managed voice model it keys the durable execution: the same key and input return the same task (replayed: true), a different input is 409 idempotency_conflict, and keys never expire.
200Managed voice models whose capabilities set multi_speaker.supported (the Fish Audio models) only: every vox_ id of a scene rendered in one take, in speaker order, with voices[0] equal to voice. Start each turn of the prompt with <|speaker:N|>, N indexing voices.
16Response
Successful Response
The response is of type Response Mediagenerateaudio · object.