Create Audio Speech
curl --request POST \
--url https://api.mor.org/api/v1/audio/speech \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "<string>",
"model": "<string>",
"voice": "<string>",
"response_format": "<string>",
"speed": 123,
"session_id": "<string>"
}
'import requests
url = "https://api.mor.org/api/v1/audio/speech"
payload = {
"input": "<string>",
"model": "<string>",
"voice": "<string>",
"response_format": "<string>",
"speed": 123,
"session_id": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: '<string>',
model: '<string>',
voice: '<string>',
response_format: '<string>',
speed: 123,
session_id: '<string>'
})
};
fetch('https://api.mor.org/api/v1/audio/speech', 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.mor.org/api/v1/audio/speech",
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([
'input' => '<string>',
'model' => '<string>',
'voice' => '<string>',
'response_format' => '<string>',
'speed' => 123,
'session_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.mor.org/api/v1/audio/speech"
payload := strings.NewReader("{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"voice\": \"<string>\",\n \"response_format\": \"<string>\",\n \"speed\": 123,\n \"session_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.mor.org/api/v1/audio/speech")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"voice\": \"<string>\",\n \"response_format\": \"<string>\",\n \"speed\": 123,\n \"session_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mor.org/api/v1/audio/speech")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"voice\": \"<string>\",\n \"response_format\": \"<string>\",\n \"speed\": 123,\n \"session_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"Content-Type": "<string>",
"Body": {}
}Audio
Create Audio Speech
Generate audio speech from text using text-to-speech models
POST
/
api
/
v1
/
audio
/
speech
Create Audio Speech
curl --request POST \
--url https://api.mor.org/api/v1/audio/speech \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "<string>",
"model": "<string>",
"voice": "<string>",
"response_format": "<string>",
"speed": 123,
"session_id": "<string>"
}
'import requests
url = "https://api.mor.org/api/v1/audio/speech"
payload = {
"input": "<string>",
"model": "<string>",
"voice": "<string>",
"response_format": "<string>",
"speed": 123,
"session_id": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: '<string>',
model: '<string>',
voice: '<string>',
response_format: '<string>',
speed: 123,
session_id: '<string>'
})
};
fetch('https://api.mor.org/api/v1/audio/speech', 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.mor.org/api/v1/audio/speech",
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([
'input' => '<string>',
'model' => '<string>',
'voice' => '<string>',
'response_format' => '<string>',
'speed' => 123,
'session_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.mor.org/api/v1/audio/speech"
payload := strings.NewReader("{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"voice\": \"<string>\",\n \"response_format\": \"<string>\",\n \"speed\": 123,\n \"session_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.mor.org/api/v1/audio/speech")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"voice\": \"<string>\",\n \"response_format\": \"<string>\",\n \"speed\": 123,\n \"session_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mor.org/api/v1/audio/speech")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"voice\": \"<string>\",\n \"response_format\": \"<string>\",\n \"speed\": 123,\n \"session_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"Content-Type": "<string>",
"Body": {}
}Generate audio speech from text.
This endpoint converts text to speech using the Morpheus Network providers. It automatically manages sessions and routes requests to the appropriate TTS model.
Returns binary audio data in the specified format.
Swagger UI may not be able to play the audio directly. To test, click “Download” and play the file in your media player, or use curl to save the audio file.
Headers
string
required
API key in format:
Bearer sk-xxxxxxBody
string
required
Text to convert to speech.Example:
"input": "Hello, this is a test of the text-to-speech system."
string
Model ID to use for speech generation (blockchain hex address or name).
Use the List Models endpoint to see available TTS models.
string
default:"af_alloy"
Voice to use for speech generation. Available voices depend on the selected model.
string
default:"mp3"
Audio format for the response. Options:
mp3, opus, aac, flac, wav, pcmmp3 is the most widely supported format. Use wav or pcm for uncompressed audio.number
default:"1"
Speech speed multiplier. Range typically 0.25 to 4.0, where 1.0 is normal speed.
string
Optional session ID to use for this request. If not provided, the system will automatically create or use the session associated with the API key.
Response
The endpoint returns binary audio data in the requested format. The content type will match theresponse_format parameter (e.g., audio/mpeg for mp3, audio/wav for wav).
string
Audio MIME type matching the requested format:
audio/mpegfor mp3audio/opusfor opusaudio/aacfor aacaudio/flacfor flacaudio/wavfor wavaudio/pcmfor pcm
binary
Binary audio file data
Example Request
import openai
client = openai.OpenAI(
api_key="sk-xxxxxx",
base_url="https://api.mor.org/api/v1"
)
response = client.audio.speech.create(
model="tts-model",
input="Hello, this is a test of the text-to-speech system.",
voice="af_alloy",
response_format="mp3"
)
# Save the audio file
with open("output.mp3", "wb") as f:
f.write(response.content)
import OpenAI from 'openai';
import fs from 'fs';
const client = new OpenAI({
apiKey: 'sk-xxxxxx',
baseURL: 'https://api.mor.org/api/v1'
});
const response = await client.audio.speech.create({
model: 'tts-model',
input: 'Hello, this is a test of the text-to-speech system.',
voice: 'af_alloy',
response_format: 'mp3'
});
// Save the audio file
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync('output.mp3', buffer);
curl -X POST https://api.mor.org/api/v1/audio/speech \
-H "Authorization: Bearer sk-xxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-model",
"input": "Hello, this is a test of the text-to-speech system.",
"voice": "af_alloy",
"response_format": "mp3"
}' \
--output output.mp3
Use Cases
Accessibility
Convert text content to audio for visually impaired users
Content Creation
Generate voiceovers for videos, podcasts, and multimedia content
Interactive Applications
Add voice responses to chatbots and virtual assistants
Language Learning
Create pronunciation guides and language learning materials
The API is fully compatible with the OpenAI SDK. Simply change the
base_url to point to the Morpheus Gateway.Large text inputs may result in longer processing times. Consider breaking very long texts into smaller segments for better performance.

