Openai Audio Speech
curl --request POST \
--url https://api.deepinfra.com/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"model": "deepinfra/tts",
"input": "I'm beginnin' to feel like a Rap God, Rap God\nAll my people from the front to the back nod, back nod\nNow, who thinks their arms are long enough to slap box, slap box?\nThey said I rap like a robot, so call me Rap-bot",
"fail_fast": false,
"voice": "<string>",
"response_format": "mp3",
"speed": 1,
"extra_body": {}
}
EOFimport requests
url = "https://api.deepinfra.com/v1/audio/speech"
payload = {
"model": "deepinfra/tts",
"input": "I'm beginnin' to feel like a Rap God, Rap God
All my people from the front to the back nod, back nod
Now, who thinks their arms are long enough to slap box, slap box?
They said I rap like a robot, so call me Rap-bot",
"fail_fast": False,
"voice": "<string>",
"response_format": "mp3",
"speed": 1,
"extra_body": {}
}
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: 'deepinfra/tts',
input: 'I\'m beginnin\' to feel like a Rap God, Rap God\nAll my people from the front to the back nod, back nod\nNow, who thinks their arms are long enough to slap box, slap box?\nThey said I rap like a robot, so call me Rap-bot',
fail_fast: false,
voice: '<string>',
response_format: 'mp3',
speed: 1,
extra_body: {}
})
};
fetch('https://api.deepinfra.com/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.deepinfra.com/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([
'model' => 'deepinfra/tts',
'input' => 'I\'m beginnin\' to feel like a Rap God, Rap God
All my people from the front to the back nod, back nod
Now, who thinks their arms are long enough to slap box, slap box?
They said I rap like a robot, so call me Rap-bot',
'fail_fast' => false,
'voice' => '<string>',
'response_format' => 'mp3',
'speed' => 1,
'extra_body' => [
]
]),
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.deepinfra.com/v1/audio/speech"
payload := strings.NewReader("{\n \"model\": \"deepinfra/tts\",\n \"input\": \"I'm beginnin' to feel like a Rap God, Rap God\\nAll my people from the front to the back nod, back nod\\nNow, who thinks their arms are long enough to slap box, slap box?\\nThey said I rap like a robot, so call me Rap-bot\",\n \"fail_fast\": false,\n \"voice\": \"<string>\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"extra_body\": {}\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.deepinfra.com/v1/audio/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"deepinfra/tts\",\n \"input\": \"I'm beginnin' to feel like a Rap God, Rap God\\nAll my people from the front to the back nod, back nod\\nNow, who thinks their arms are long enough to slap box, slap box?\\nThey said I rap like a robot, so call me Rap-bot\",\n \"fail_fast\": false,\n \"voice\": \"<string>\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"extra_body\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepinfra.com/v1/audio/speech")
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\": \"deepinfra/tts\",\n \"input\": \"I'm beginnin' to feel like a Rap God, Rap God\\nAll my people from the front to the back nod, back nod\\nNow, who thinks their arms are long enough to slap box, slap box?\\nThey said I rap like a robot, so call me Rap-bot\",\n \"fail_fast\": false,\n \"voice\": \"<string>\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"extra_body\": {}\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Audio
Openai Audio Speech
POST
/
v1
/
audio
/
speech
Openai Audio Speech
curl --request POST \
--url https://api.deepinfra.com/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"model": "deepinfra/tts",
"input": "I'm beginnin' to feel like a Rap God, Rap God\nAll my people from the front to the back nod, back nod\nNow, who thinks their arms are long enough to slap box, slap box?\nThey said I rap like a robot, so call me Rap-bot",
"fail_fast": false,
"voice": "<string>",
"response_format": "mp3",
"speed": 1,
"extra_body": {}
}
EOFimport requests
url = "https://api.deepinfra.com/v1/audio/speech"
payload = {
"model": "deepinfra/tts",
"input": "I'm beginnin' to feel like a Rap God, Rap God
All my people from the front to the back nod, back nod
Now, who thinks their arms are long enough to slap box, slap box?
They said I rap like a robot, so call me Rap-bot",
"fail_fast": False,
"voice": "<string>",
"response_format": "mp3",
"speed": 1,
"extra_body": {}
}
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: 'deepinfra/tts',
input: 'I\'m beginnin\' to feel like a Rap God, Rap God\nAll my people from the front to the back nod, back nod\nNow, who thinks their arms are long enough to slap box, slap box?\nThey said I rap like a robot, so call me Rap-bot',
fail_fast: false,
voice: '<string>',
response_format: 'mp3',
speed: 1,
extra_body: {}
})
};
fetch('https://api.deepinfra.com/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.deepinfra.com/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([
'model' => 'deepinfra/tts',
'input' => 'I\'m beginnin\' to feel like a Rap God, Rap God
All my people from the front to the back nod, back nod
Now, who thinks their arms are long enough to slap box, slap box?
They said I rap like a robot, so call me Rap-bot',
'fail_fast' => false,
'voice' => '<string>',
'response_format' => 'mp3',
'speed' => 1,
'extra_body' => [
]
]),
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.deepinfra.com/v1/audio/speech"
payload := strings.NewReader("{\n \"model\": \"deepinfra/tts\",\n \"input\": \"I'm beginnin' to feel like a Rap God, Rap God\\nAll my people from the front to the back nod, back nod\\nNow, who thinks their arms are long enough to slap box, slap box?\\nThey said I rap like a robot, so call me Rap-bot\",\n \"fail_fast\": false,\n \"voice\": \"<string>\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"extra_body\": {}\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.deepinfra.com/v1/audio/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"deepinfra/tts\",\n \"input\": \"I'm beginnin' to feel like a Rap God, Rap God\\nAll my people from the front to the back nod, back nod\\nNow, who thinks their arms are long enough to slap box, slap box?\\nThey said I rap like a robot, so call me Rap-bot\",\n \"fail_fast\": false,\n \"voice\": \"<string>\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"extra_body\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepinfra.com/v1/audio/speech")
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\": \"deepinfra/tts\",\n \"input\": \"I'm beginnin' to feel like a Rap God, Rap God\\nAll my people from the front to the back nod, back nod\\nNow, who thinks their arms are long enough to slap box, slap box?\\nThey said I rap like a robot, so call me Rap-bot\",\n \"fail_fast\": false,\n \"voice\": \"<string>\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"extra_body\": {}\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}When called with an API key, or a scoped JWT made from one, the key needs the
inference scope (about scopes).Authorizations
Body
application/json
The service tier used for processing the request. 'priority' processes the request with higher priority (premium rate); 'flex' processes it at lower priority for a discount, served only when spare capacity exists and may be retried/timed out under load. Both apply only to models that support the respective tier. For compatibility, 'auto' is treated as 'priority' and 'standard_only' as 'default'.
Available options:
default, priority, flex Response
Successful Response