Generate audio
curl --request POST \
--url https://hub.oxen.ai/api/ai/audio/generate \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"audio_urls": [
"<string>"
],
"image_url": "<string>",
"output_format": "<string>",
"pitch": 123,
"response_format": "<string>",
"sample_rate": 123,
"save_to_workbench": true,
"speed": 123,
"voice": "<string>",
"volume": 123
}
'import requests
url = "https://hub.oxen.ai/api/ai/audio/generate"
payload = {
"model": "<string>",
"prompt": "<string>",
"audio_urls": ["<string>"],
"image_url": "<string>",
"output_format": "<string>",
"pitch": 123,
"response_format": "<string>",
"sample_rate": 123,
"save_to_workbench": True,
"speed": 123,
"voice": "<string>",
"volume": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
audio_urls: ['<string>'],
image_url: '<string>',
output_format: '<string>',
pitch: 123,
response_format: '<string>',
sample_rate: 123,
save_to_workbench: true,
speed: 123,
voice: '<string>',
volume: 123
})
};
fetch('https://hub.oxen.ai/api/ai/audio/generate', 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://hub.oxen.ai/api/ai/audio/generate",
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>',
'prompt' => '<string>',
'audio_urls' => [
'<string>'
],
'image_url' => '<string>',
'output_format' => '<string>',
'pitch' => 123,
'response_format' => '<string>',
'sample_rate' => 123,
'save_to_workbench' => true,
'speed' => 123,
'voice' => '<string>',
'volume' => 123
]),
CURLOPT_HTTPHEADER => [
"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://hub.oxen.ai/api/ai/audio/generate"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"audio_urls\": [\n \"<string>\"\n ],\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"pitch\": 123,\n \"response_format\": \"<string>\",\n \"sample_rate\": 123,\n \"save_to_workbench\": true,\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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://hub.oxen.ai/api/ai/audio/generate")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"audio_urls\": [\n \"<string>\"\n ],\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"pitch\": 123,\n \"response_format\": \"<string>\",\n \"sample_rate\": 123,\n \"save_to_workbench\": true,\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.oxen.ai/api/ai/audio/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"audio_urls\": [\n \"<string>\"\n ],\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"pitch\": 123,\n \"response_format\": \"<string>\",\n \"sample_rate\": 123,\n \"save_to_workbench\": true,\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123\n}"
response = http.request(request)
puts response.read_body{
"audios": [
{
"url": "<string>"
}
],
"created": 123,
"model": "<string>"
}{}API Reference
Generate audio
Creates audio (e.g. speech) from a text prompt.
POST
/
api
/
ai
/
audio
/
generate
Generate audio
curl --request POST \
--url https://hub.oxen.ai/api/ai/audio/generate \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"audio_urls": [
"<string>"
],
"image_url": "<string>",
"output_format": "<string>",
"pitch": 123,
"response_format": "<string>",
"sample_rate": 123,
"save_to_workbench": true,
"speed": 123,
"voice": "<string>",
"volume": 123
}
'import requests
url = "https://hub.oxen.ai/api/ai/audio/generate"
payload = {
"model": "<string>",
"prompt": "<string>",
"audio_urls": ["<string>"],
"image_url": "<string>",
"output_format": "<string>",
"pitch": 123,
"response_format": "<string>",
"sample_rate": 123,
"save_to_workbench": True,
"speed": 123,
"voice": "<string>",
"volume": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
audio_urls: ['<string>'],
image_url: '<string>',
output_format: '<string>',
pitch: 123,
response_format: '<string>',
sample_rate: 123,
save_to_workbench: true,
speed: 123,
voice: '<string>',
volume: 123
})
};
fetch('https://hub.oxen.ai/api/ai/audio/generate', 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://hub.oxen.ai/api/ai/audio/generate",
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>',
'prompt' => '<string>',
'audio_urls' => [
'<string>'
],
'image_url' => '<string>',
'output_format' => '<string>',
'pitch' => 123,
'response_format' => '<string>',
'sample_rate' => 123,
'save_to_workbench' => true,
'speed' => 123,
'voice' => '<string>',
'volume' => 123
]),
CURLOPT_HTTPHEADER => [
"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://hub.oxen.ai/api/ai/audio/generate"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"audio_urls\": [\n \"<string>\"\n ],\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"pitch\": 123,\n \"response_format\": \"<string>\",\n \"sample_rate\": 123,\n \"save_to_workbench\": true,\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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://hub.oxen.ai/api/ai/audio/generate")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"audio_urls\": [\n \"<string>\"\n ],\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"pitch\": 123,\n \"response_format\": \"<string>\",\n \"sample_rate\": 123,\n \"save_to_workbench\": true,\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.oxen.ai/api/ai/audio/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"audio_urls\": [\n \"<string>\"\n ],\n \"image_url\": \"<string>\",\n \"output_format\": \"<string>\",\n \"pitch\": 123,\n \"response_format\": \"<string>\",\n \"sample_rate\": 123,\n \"save_to_workbench\": true,\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123\n}"
response = http.request(request)
puts response.read_body{
"audios": [
{
"url": "<string>"
}
],
"created": 123,
"model": "<string>"
}{}Body
application/json
Audio generation request
Text prompt or text to synthesize
Reference audio URLs for voice cloning
Reference image URL
wav, mp3, pcm, or ogg_opus
url (default) or b64_json
Output sample rate in Hz
Persist the generated audio to the workbench (default true)
Preset voice name or cloned voice ID
⌘I