API Reference

Introduction

Explore the odio.ai APIs and discover how to programmatically access a range of powerful voiceover features.

Odio.ai's APIs equip developers with powerful tools to seamlessly integrate advanced voiceover technology into their applications.

This is where you show your users how to set it up. You can use code samples, like this

API Key

To use the HTTP API, an API key is required. You can generate one easily through your account dashboard. Get your api key.

Rate Limits

The maximum number of requests allowed per day is 1,000, with a rate limit of 40 requests per minute. Each request can generate up to 3,000 characters.

Custom Rate Limits

If you require higher rate limits or have specific usage needs, please contact us. We offer customisable plans tailored to your requirements, ensuring that you get the resources you need for optimal performance.

Getting Started with the API

Fetching voice list

Before generating text-to-speech, you'll need a voice_id. To see the voices available to your account, use the following example.

curl --location 'https://odio.ai/api/v1/voices' \
--header 'X-API-KEY: YOUR-API-KEY'
const myHeaders = new Headers();
myHeaders.append("X-API-KEY", "YOUR-API-KEY"); 

const formdata = new FormData();

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  body: formdata,
  redirect: "follow"
};

fetch("https://odio.ai/api/v1/voices", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://odio.ai/api/v1/voices',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'X-API-KEY: YOUR-API-KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

import requests

url = "https://odio.ai/api/v1/voices"

payload = {}
files={}
headers = {
  'X-API-KEY': 'YOUR-API-KEY'
}

response = requests.request("GET", url, headers=headers, data=payload, files=files)

print(response.text)

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://odio.ai/api/v1/voices',
  'headers': {
    'X-API-KEY': 'YOUR-API-KEY'
  },
  formData: {

  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Response


{
  "status": true,
  "message": "OK",
  "data": [
    {
      "voice_id": "8526acc8081fc79e",
      "name": "Bruce",
      "gender": "Male",
      "language_name": "English (US)",
      "emotion": [],
      "language_code": "en-US",
      "voice_type": "Premium"
    },
    {
      "voice_id": "73598de20059283d",
      "name": "Bruce",
      "gender": "Male",
      "language_name": "English (US)",
      "emotion": [],
      "language_code": "en-US",
      "voice_type": "Standard"
    }
  }


Generate Audio From Text

This endpoint is used to convert text to speech.

To generate speech using the TTS endpoint, you can use the following example. Make sure to replace "YOUR-API-KEY" with your actual API key and "voice_id_here" with the voice_id you obtained from the /voices endpoint.

curl --location 'https://odio.ai/api/v1/text-to-speech' \
--header 'X-API-KEY: YOUR-API-KEY' \
--form 'voice_id="voice_id_here"' \
--form 'text="Hello, nice to meet you!"'
const myHeaders = new Headers();
myHeaders.append("X-API-KEY", "YOUR-API-KEY");
myHeaders.append("", "");

const formdata = new FormData();
formdata.append("voice_id", "voice_id_here");
formdata.append("text", "Hello, nice to meet you!");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: formdata,
  redirect: "follow"
};

fetch("https://odio.ai/api/v1/text-to-speech", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://odio.ai/api/v1/text-to-speech',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('voice_id' => 'voice_id_here','text' => 'Hello, nice to meet you!'),
  CURLOPT_HTTPHEADER => array(
    'X-API-KEY: YOUR-API-KEY', 
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

import requests

url = "https://odio.ai/api/v1/text-to-speech"

payload = {'voice_id': 'voice_id_here',
'text': 'Hello, nice to meet you!'}
files=[

]
headers = {
  'X-API-KEY': 'YOUR-API-KEY'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://odio.ai/api/v1/text-to-speech',
  'headers': {
    'X-API-KEY': 'YOUR-API-KEY', 
  },
  formData: {
    'voice_id': 'voice_id_here',
    'text': 'Hello, nice to meet you!'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Response

Response code: 200 - audio/mpeg

The response is of type file.



Response code: 422


{
  "status": boolean,
  "error": 'string'
}