Skip to main content

Inference

Using these endpoints, you can create an inference request, and then check the status of the request, and finally download the output of the request once it is done processing.

Create Inference Request

Creates an inference request. This will send a request to the model to generate audio for the texts, using the other fields specified in the request body to influence the audio generation. The request will return a requestId, which can be used in future requests to track the status of this inference and eventually download the audio output.

Method: POST

Endpoint: https://api.revoiceit.com/inference

Request:

{
//Required Parameters:

"texts": array<string>,
"styles": array<string>,
"model": string,
"languageId": string,
"voice": string,


//Optional Parameters:

"glossaryIds": array<string>,
"externalRequestId": string,
"advancedSettings":{
"seed": number,
"diversity": number,
"expressivity": number,
"audioQuality": {
"outputBitrate": number,
"outputSamplingRate": number
}
}
}

Request Fields:

FieldTypeDescriptionRequired
textsarray<string>An array of all of the lines of text for which audio should be generated. Each element of the array should be a single line of textRequired
stylesarray<string>An array of all of the styles that should be applied to each line. For a list of available styles use the Get Voice Styles endpointRequired
modelstringThe name of the model that should be used. For a list of models use the Get Models endpointRequired
languageIdstringThe id of the language that should be used for the inference. A list of languages can be obtained from the Get Languages endpointRequired
voicestringThe name of the voice that should be used for inference. A list of voices can be obtained from the Get Voices endpointRequired
glossaryIdsarray<string>The ids of glossaries that should be used for this request. Any glossaries listed will be used for every line in the request. A list of glossaries that belong to this workspace can be obtained from the Get Glossaries endpointOptional
externalRequestIdstringAn id parameter used to track inference requests on the platform’s usage page. Helpful for identifying and organizing usage by custom tags.Optional
seednumberA seed number can be used to enforce consistency across multiple requestsOptional
diversitynumberA decimal number between 0 and 1. Lower diversity results in more consistent pronunciation and prosody, while higher diversity increases variation but may produce less natural-sounding takes.Optional
expressivitynumberA decimal number between 0 and 1. Higher expressivity adds more emotion but can reduce stability, while lower expressivity creates a less emotional but more stable output.Optional
outputBitratenumberThe bitrate of the output. Default: 16.Optional
outputSamplingRatenumberThe sampling rate of the output. Default: 44100.Optional

Response:

{
"requestId": string
}

Returned HTTP Codes

Http CodeDescription
201Inference created successfully
400Invalid input
500Internal server error

Get Inference Request Status

Returns a status for the inference request specified by the requestId provided in the request url.

Method: GET

Endpoint: https://api.revoiceit.com/inference/{requestId}/status

Query Parameters:

FieldTypeDescriptionRequired
line_indexnumberCan be specified to view the status of a specific lineOptional
pagenumberCan be specified to get a specific page of paginated statuses (1-indexed). For example, with the limit set to 3, page:1 will return results for the first 3 lines and page:2 will return the results for the next 3Optional
limitnumberA number between 1 and 1000 to limit how many statuses should be returned. If left empty, this field will default to 50Optional

Response without query parameters:

{
"requestId": string,
"status": string,
"progress": string //Progress displayed as a percentage
}

Response with query parameter line_index:

{
"requestId": string,
"line": {
"index": number,
"status": string
}
}

Response with query parameters (paginated):

{
"requestId": string,
"page": number,
"limit": number,
"lines": [
{
"index": number,
"status": string
}
]
}

Returned HTTP Codes

Http CodeDescription
200Success
400Invalid input
404Request not found
500Internal server error

Download Inference Request Output

Returns a URL pointing to the audio output of the inference request. Each line in the original input will correspond to a separate file URL. The files are 0-indexed and maintain the order of lines as provided in the request.

Method: GET

Endpoint: https://api.revoiceit.com/inference/{requestId}/download

Query Parameters:

FieldTypeDescriptionRequired
line_indexnumberCan be specified to view the status of a specific lineOptional
pagenumberCan be specified to get a specific page of paginated statuses (1-indexed). For example, with the limit set to 3, page:1 will return results for the first 3 lines and page:2 will return the results for the next 3Optional
limitnumberA number between 1 and 1000 to limit how many statuses should be returned. If left empty, this field will default to 50Optional
return_typestringCan be specified as "url" or "audio". The "audio" option can only be used when a single line is specified, and returns the audio directly in the response. Conversely, the url option will return a url of the audio file.Optional

Response with query parameter line_index:

{
// a URL string or a Base64-encoded string,
// depending on the value of the return_type parameter.
}

Response with query parameters (paginated):

{
"page": number,
"limit": number,
"urls": array<string>
}

Returned HTTP Codes

Http CodeDescription
200Success
404Not found
500Internal server error

Analyse Audio Emotion

Analyses audio and returns emotion and confidence values.

Method: POST

Endpoint: https://api.revoiceit.com/emotion/analyse

Request:

{
// Required Parameters:

"languageId": string
"audio": string
}

Query Parameters:

FieldTypeDescriptionRequired
languageIdstringLanguage id for the audio to be analysed.Required
audiostringAudio in base64 format to be analysed.Required

Response:

{
"emotion": string,
"confidence": number
/* e.g.
{
"emotion": "NEUTRAL",
"confidence": 0.523
}
*/
}

Returned HTTP Codes

Http CodeDescription
200Success
400Invalid input
500Internal server error