POST /v1/text-to-speech

Text to speech

Speak text in a predefined voice and return a download link for the audio.

POST https://api.pascalai.co/v1/text-to-speech
Content-Type: application/json

Authenticate with Authorization: Bearer and an API key. The call remains open for up to 4 minutes. When processing has finished inside that window, the body is the job. When status is queued or running, retrieve the same object with GET /v1/text-to-speech/{job_id}. Live speech is on Text to speech realtime.

FieldTypeDescription
modelRequiredstringCatalogue id of the text-to-speech model.
textRequiredstringThe words to speak. The length is priced before the request is queued.
paramsobjectFields for that model, including the predefined voice. Omit the object to use the defaults. The fields are on the model page.
namestringOptional label stored on the job and returned as name.

Response

200 with the job. A successful request is charged $0.05 plus the generated audio duration in minutes. result.artifacts contains the audio. url is the download link. Download the file within one day. The file is deleted after that. The job record remains.

Batch

POST /v1/text-to-speech/batch

Speak up to 50 texts in a single request. All texts use the same model and the same parameters. Send model, params, and items. Each item has text and an optional name.

The response contains the batch identifier. Retrieve progress with GET /v1/text-to-speech/batch/{batch_id}. An account may have two open batches. The length of every text is priced before anything is queued. A successful batch is charged $0.05 once. Each text is charged for the generated audio duration in minutes.

Example

curl https://api.pascalai.co/v1/text-to-speech \
  -H "Authorization: Bearer $PASCAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "model": "sarvam-bulbul",
  "text": "Keep walking toward the river.",
  "params": {
    "language": "en-IN",
    "speaker": "shubh",
    "output_format": "wav",
    "output_sample_rate": "source",
    "output_channels": "source"
  }
}'

curl https://api.pascalai.co/v1/text-to-speech/$JOB_ID \
  -H "Authorization: Bearer $PASCAL_API_KEY"

Models