Generate audio from text
POST/api/v2/Audio/generate
Generates speech audio from the provided text using a text-to-speech model and returns a public URL to the generated audio file. The model can be selected by model id or by model code + vendor. The voice is optional; when not provided a default voice is used. A raw vendor voice id can be sent instead, to use a voice available in the tenant's own vendor account.
Request
Query Parameters
Use this param to override the culture of the response. Options: - en (default) - es
- application/json
- text/json
- application/*+json
Body
The audio generation request containing the text, the model selection, and an optional voice, voice id and speed.
Possible values: non-empty and <= 4000 characters
The text to convert into speech.
Optional voice to use. When not provided, the vendor's default voice is used.
Possible values: <= 128 characters
Optional raw vendor voice id, to use a voice available in the tenant's own vendor account.
Takes precedence over voice.
Optional speed of the generated audio. Ignored by the models that don't accept a speed; otherwise defaults to 1 when not provided and is clamped to the model's accepted range.
Possible values: <= 256 characters
Optional user identifier for tracking and cost management purposes.
Possible values: <= 64 characters
The channel used in the execution.
The unique identifier of the AI model to use. Used instead of Vendor and ModelCode.
The model code to use. Used together with Vendor when AIModelId is not provided.
The vendor of the model to use. Used together with ModelCode when AIModelId is not provided.
Body
The audio generation request containing the text, the model selection, and an optional voice, voice id and speed.
Possible values: non-empty and <= 4000 characters
The text to convert into speech.
Optional voice to use. When not provided, the vendor's default voice is used.
Possible values: <= 128 characters
Optional raw vendor voice id, to use a voice available in the tenant's own vendor account.
Takes precedence over voice.
Optional speed of the generated audio. Ignored by the models that don't accept a speed; otherwise defaults to 1 when not provided and is clamped to the model's accepted range.
Possible values: <= 256 characters
Optional user identifier for tracking and cost management purposes.
Possible values: <= 64 characters
The channel used in the execution.
The unique identifier of the AI model to use. Used instead of Vendor and ModelCode.
The model code to use. Used together with Vendor when AIModelId is not provided.
The vendor of the model to use. Used together with ModelCode when AIModelId is not provided.
Body
The audio generation request containing the text, the model selection, and an optional voice, voice id and speed.
Possible values: non-empty and <= 4000 characters
The text to convert into speech.
Optional voice to use. When not provided, the vendor's default voice is used.
Possible values: <= 128 characters
Optional raw vendor voice id, to use a voice available in the tenant's own vendor account.
Takes precedence over voice.
Optional speed of the generated audio. Ignored by the models that don't accept a speed; otherwise defaults to 1 when not provided and is clamped to the model's accepted range.
Possible values: <= 256 characters
Optional user identifier for tracking and cost management purposes.
Possible values: <= 64 characters
The channel used in the execution.
The unique identifier of the AI model to use. Used instead of Vendor and ModelCode.
The model code to use. Used together with Vendor when AIModelId is not provided.
The vendor of the model to use. Used together with ModelCode when AIModelId is not provided.
Responses
- 200
- 400
- 401
- 403
- 404
- 500
Returns the audio generation result including the public audio URL.
- text/plain
- application/json
- text/json
- Schema
- Example (from schema)
Schema
cost
object
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"audioUrl": "string",
"cost": {
"amount": 0,
"currency": "string"
}
}
- Schema
- Example (from schema)
Schema
cost
object
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"audioUrl": "string",
"cost": {
"amount": 0,
"currency": "string"
}
}
- Schema
- Example (from schema)
Schema
cost
object
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"audioUrl": "string",
"cost": {
"amount": 0,
"currency": "string"
}
}
If the request validation fails or there are invalid parameter combinations.
The user is unauthorized or the session expired
The user does not have permission
If the specified model is not found or does not support text to speech.
There was an unexpected error