Search...
Menu

Text-to-Speech (OpenAI)

Convert text into audio for narration, announcements, and voiceovers.

Request

Item Description
Method POST
Path /v1/audio/speech
Gateway URL https://ailink.nativex.com
Authentication Authorization: Bearer sk-xxxx; replace the placeholder with your API Key
Request format application/json

Replace MODEL_ID with a model from the Model Marketplace that supports this endpoint. Available models, parameters, and permissions depend on your account.

Parameters

Parameter Location Type Required Description
model Body string Yes A model that supports speech synthesis
input Body string Yes Text to read aloud. Legacy TTS endpoints accept up to 4096 characters; other models have their own limits.
voice Body string Yes Voice. Legacy TTS voices include alloy, echo, fable, onyx, nova, and shimmer; other models may differ.
response_format Body string No mp3, opus, aac, flac, wav, or pcm. Legacy endpoints default to mp3.
speed Body number No Speech speed. The legacy range is 0.25–4, with a default of 1. Support depends on the model.

Example

curl -X POST 'https://ailink.nativex.com/v1/audio/speech' \
  -H 'Authorization: Bearer sk-xxxx' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "MODEL_ID",
  "input": "Welcome to AiLink.",
  "voice": "alloy",
  "response_format": "mp3"
}' \
  --output 'speech.mp3'

Response

On success, the response contains binary file data. The --output option above saves the result to a local file. Do not parse it as JSON.

Field or result Description
Audio file Save in the format specified by response_format

Error handling

For unsuccessful responses, check the HTTP status and error body first. Verify the API Key, model name, account balance, and parameters. If rate limited, reduce concurrency and retry later.

Last modified: 2026-11-17