Sota Voice
Tài liệu

Create speech

Xem dạng Markdown
POST
/v1/audio/speech

Synthesizes input and returns the audio. By default the whole file is returned with a Content-Type matching response_format. With "stream": true the response is raw PCM (signed 16-bit little-endian, mono, 44.1 kHz) sent as it is generated, typically starting within 100-250 ms. With "stream_format": "sse" the response is text/event-stream carrying speech.audio.delta events (base64 audio in audio) followed by one speech.audio.done.

Credit is debited up front (input characters). If the speech service fails before sending the first byte, the credit is returned. input is limited to a deployment-configured maximum (5,000 characters by default); use async jobs for longer text.

Authorization

bearerAuth
headerAuthorizationBearer <API key (sk_live_...)>

Your secret API key from the dashboard. Keep it on your server.

Request Body

application/json
  1. body
model?string

Model id. Only sota-voice-v1 exists; may be omitted.

Default"sota-voice-v1"
voice?string

A built-in voice name or the name of one of your cloned voices, in any profile_state. See GET /v1/audio/voices.

Default"default"
input*string

Text to synthesize. Characters are billed (NFC code points). At most 5,000 by default.

Length1 <= length
response_format?string

Audio container for file responses. Ignored for streaming.

Default"mp3"
Value in"mp3""wav""opus""aac""flac""pcm"
stream?boolean

When true, returns raw PCM (s16le, mono, 44.1 kHz) as it is generated.

Defaultfalse
stream_format?"sse"

Set to sse to receive text/event-stream events instead of raw audio.

Value in"sse"
split_granularity?string

How text is split for generation. sentence splits on sentence ends; clause also splits on commas (more robust, but uses more GPU and makes intonation less fluid); none disables splitting.

Default"sentence"
Value in"sentence""clause""none"
literal_punctuation?boolean

Read punctuation literally instead of treating it as prosody. Passed to the speech service.

Response Body

The generated audio.

response?BinaryAudio

Audio bytes.

Formatbinary
curl -X POST 'https://api.example.com/v1/audio/speech' \  -H 'Content-Type: application/json' \  -d '{  "model": "sota-voice-v1",  "voice": "zh_1",  "input": "你好,欢迎使用 Sota Voice。",  "response_format": "mp3"}'
Example Response
"<binary MP3 data>"