Text transcribing
Text-to-speech API is used to convert text to audio, suitable for voice broadcast, voice-collation, content reading and voice-to-peer output.
API Path
| Methodology | Path | Returns by |
|---|---|---|
POST | /v1/audio/speech | synchronous returns audio content or audio response. |
Example request
bash
curl https://moonnexai.com/v1/audio/speech \
-H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "Welcome to MoonNexAI.",
"voice": "alloy",
"response_format": "mp3"
}'Common field
| field | Annotations |
|---|---|
model | Voice model names, for example, tts-1. |
input | Text that needs to be read. |
voice | Voice name. |
response_format | Output format, e.g. mp3. |
speed | Speed Settings, as API Reference. |
response Processing
| scene | Treatment |
|---|---|
| Play directly | Writes response audio to a player or temporary file. |
| Reuse Audio | Saves audio files, original text, voice and model names. |
| Long Text | Multiple audio clips by natural segment, then combined on the side of the operation. |
Access Recommendations
- It is recommended that, when playing for users, the audio file address and corresponding text be saved to facilitate reuse.
- Long text please untrace the natural section and avoid a single request load of excess content.
- If subtitles synchronous are required, save the correspondence between the text and audio clips on the side of the operation.