Skip to main content
POST
/
voice
/
text_to_audio
Generate audio from text with voice cloning
curl --request POST \
  --url https://modelslab.com/api/v6/voice/text_to_audio \
  --header 'Content-Type: application/json' \
  --data '
{
  "key": "<string>",
  "prompt": "<string>",
  "init_audio": "<string>",
  "voice_id": "<string>",
  "language": "english",
  "speed": 1,
  "base64": false,
  "temp": false,
  "webhook": "<string>",
  "track_id": 123
}
'
{
  "generationTime": 123,
  "id": 123,
  "output": [
    "<string>"
  ],
  "proxy_links": [
    "<string>"
  ],
  "future_links": [
    "<string>"
  ],
  "links": [
    "<string>"
  ],
  "meta": {},
  "eta": 123,
  "message": "<string>",
  "tip": "<string>",
  "fetch_result": "<string>",
  "audio_time": 123
}

Request

Make a POST request to below endpoint and pass the required parameters as a request body.
init_audio is required for voice cloning. You can also pass voice_id to select a voice from the available voice list.
curl
--request POST 'https://modelslab.com/api/v6/voice/text_to_audio' \

Body

json
{
  "key": "your_api_key", 
  "prompt":"Narrative voices capable of pronouncing terminologies & acronyms in training and ai learning materials.", 
  "init_audio":"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/tom_hanks_1.wav", 
  "voice_id": "your_voice_id",
  "language":"english", 
  "webhook": null, 
  "track_id": null
}

Body

application/json
key
string
required

API key for authentication

prompt
string
required

Text prompt describing audio to be generated

init_audio
string<uri>
required

Valid URL pointing to audio file for voice cloning (4-30 seconds)

voice_id
string

ID of voice from available list Find Voice IDs Here

language
enum<string>
default:english

Language for the voice

Available options:
arabic,
assamese,
bengali,
brazilian portuguese,
chinese,
czech,
danish,
dutch,
english,
finnish,
french,
german,
greek,
gujarati,
hebrew,
hindi,
hungarian,
indonesian,
italian,
japanese,
kannada,
korean,
maithili,
malay,
malayalam,
marathi,
min nan chinese,
nepali,
odia,
persian,
polish,
punjabi,
russian,
sindhi,
sinhala,
slovak,
spanish,
swahili,
swedish,
tamil,
telugu,
thai,
turkish,
ukrainian,
urdu,
vietnamese,
welsh,
yue chinese
speed
number
default:1

Playback speed of generated audio

base64
boolean
default:false

Whether input audio is in base64 format

temp
boolean
default:false

Use temporary links valid for 24 hours

webhook
string<uri>

URL to receive POST notification upon completion

track_id
integer

ID for webhook identification

Response

Text to audio response

status
enum<string>

Status of the voice generation

Available options:
success,
processing,
error
generationTime
number

Time taken to generate the audio in seconds

id
integer

Unique identifier for the voice generation

output
string<uri>[]

Array of generated audio URLs

Array of proxy audio URLs

Array of future audio URLs for queued requests

Array of audio URLs (voice cover response)

meta
object

Metadata about the audio generation including all parameters used

eta
integer

Estimated time for completion in seconds (processing status)

message
string

Status message or additional information

tip
string

Additional information or tips for the user

fetch_result
string<uri>

URL to fetch the result when processing

audio_time
number

Duration of the generated audio in seconds