Text-to-Speech (TTS)

Text-to-Speech (TTS) converts written text into natural-sounding audio. The API returns a URL to the generated audio file and a task ID to monitor processing progress.

post

Endpoint for requesting text2audio inference

Authorizations
Header parameters
Acceptstring · enumRequiredPossible values:
Body
textstringRequired

Text to be converted to speech

Example: A beautiful sunset over mountains
modelstringRequired

The model to use for generation

Example: kokoro
voicestringRequired

Name of the voice to be used during audio generation

Example: af_sky
langstringRequired

Language to be used during audio generation

Example: en-us
speednumberRequired

Generated audio speech speed

Example: 1
formatstringRequired

Audio output format

Example: flac
sample_ratenumberRequired

Sample rate of generated audio

Example: 24000
Responses
200

ID of the inference request.

application/json
post
POST /api/v1/client/txt2audio HTTP/1.1
Host: api.deapi.ai
Authorization: Bearer JWT
Accept: application/json
Content-Type: application/json
Content-Length: 139

{
  "text": "A beautiful sunset over mountains",
  "model": "kokoro",
  "voice": "af_sky",
  "lang": "en-us",
  "speed": 1,
  "format": "flac",
  "sample_rate": 24000
}
{
  "data": {
    "request_id": 1
  }
}
post

Endpoint for calculating price for text2audio inference

Authorizations
Header parameters
Acceptstring · enumRequiredPossible values:
Body
textstringRequired

Text to be converted to speech

Example: A beautiful sunset over mountains
modelstringRequired

The model to use for generation

Example: kokoro
voicestringRequired

Name of the voice to be used during audio generation

Example: af_sky
langstringRequired

Language to be used during audio generation

Example: en-us
speednumberRequired

Generated audio speech speed

Example: 1
formatstringRequired

Audio output format

Example: flac
sample_ratenumberRequired

Sample rate of generated audio

Example: 24000
Responses
200

Calculated price for text2img inference.

application/json
post
POST /api/v1/client/txt2audio/price-calculation HTTP/1.1
Host: api.deapi.ai
Authorization: Bearer JWT
Accept: application/json
Content-Type: application/json
Content-Length: 139

{
  "text": "A beautiful sunset over mountains",
  "model": "kokoro",
  "voice": "af_sky",
  "lang": "en-us",
  "speed": 1,
  "format": "flac",
  "sample_rate": 24000
}
{
  "data": {
    "price": 0.25
  }
}

Last updated