1. HTTP synthesis
MyVocal AI语音大模型API文档
English
  • 中文
  • English
  • 文字转语音大模型
    • API reference
      • Voice management
        • List voices
        • Create a voice
        • Delete a voice
      • HTTP synthesis
        • Streaming HTTP synthesis
          POST
        • Non-streaming HTTP synthesis
          POST
      • WebSocket synthesis
        • Standard TTS · Single connection
        • Standard TTS · Multiple contexts
        • Dialogue · Multiple contexts
      • Usage and request history
        • Get master key usage
        • Look up a request by ID
        • Get usage by voice
      • Sub-key management
        • Create a sub-key
        • List sub-keys
        • Get sub-key details
        • Update a sub-key
        • Get sub-key usage
    • Overview and quickstart
      • Models
      • Choose a model and endpoint
      • Supported languages
      • Audio formats and playback
      • FAQ
      • SDKs and examples
  • 金融行业定制TTS模型
    • Skyblight text to speech
      • Streaming text to speech
      • Non-streaming text to speech
      • List voices
      • Delete a voice
      • Create a voice
      • Get usage
    • Full-duplex communication
      • WebSocket integration guide
      • V2 bidirectional streaming synthesis (WebSocket)
  • 语音转文字ASR
    • Overview and quickstarts
      • Realtime transcription quickstart
      • File transcription quickstart
      • Models and capabilities
      • Changelog
    • API reference
      • Realtime transcription over WebSocket
      • Create a file transcription
      • Get ASR usage
  • 企业客户声音定制服务
    • Your custom brand voice
  1. HTTP synthesis

Streaming HTTP synthesis

POST
https://api.voicelibrary.co/enterprise/v1/tts/{voice_id}/stream
Submit text once and receive audio chunks in order for playback during generation.

Supported models#

Choose myvocal_v4, myvocal_v3_turbo, myvocal_v3 or multilingual_v2. Omit model_id for the default Turbo model. See Models.

Example request#

Replace YOUR_API_KEY and YOUR_VOICE_ID with your enterprise key and an existing voice ID. V4 and V3 Turbo use the same endpoint. To try Turbo, replace myvocal_v4 with myvocal_v3_turbo.
Process audio chunks in arrival order through the end of the response. The example writes them to a file. For live playback, feed the same stream to a decoder as chunks arrive. Check the HTTP status and Content-Type first. An error response containing JSON cannot be played as MP3.

Key parameters#

ParameterUsage
textText to synthesize
model_idSelects the model. Omit to use the default.
voice_settingsVoice settings supported by the selected model
language_codeOptional language code in the JSON request body
prioritySelects the concurrency pool

Stability and similarity#

Set stability and similarity_boost in voice_settings, with values in 0..1. Start with 0.5 and 0.75, respectively, and adjust one setting at a time. For myvocal_v3, stability accepts only 0, 0.5 or 1.

Other generation controls#

V4 and V3 Turbo do not use style, speed or use_speaker_boost. Other models’ controls are described below. A fixed seed can improve consistency for the same input. Byte-identical audio is not guaranteed.

Concurrency#

auto: use dedicated capacity first and switch to shared capacity if it fills up.
dedicated_concurrency: use dedicated capacity.
shared_concurrency: use shared capacity. Requests may queue.

Output languages#

V4 and V3 Turbo support 94 languages, including Mandarin zh and Cantonese yue. Omit language_code for language selection based on the text. When setting it explicitly, supply text in that language. Full list.

Audio and completion#

Check the HTTP status and content type before playing the audio. A JSON error cannot be played as MP3. The HTTP request completes at the end of the response body. For PCM direct and format options, see Audio formats and playback.

Endpoint#

The default host is https://api.voicelibrary.co. See Regional servers to select a region.

FAQ#

If audio is missing or the service reports a model or format error, check the response status, model_id, voice_id and format. See the FAQ.

请求参数

Path 参数

Query 参数

Header 参数

Body 参数application/json

示例

返回响应

🟢200Success
application/json
Bodyapplication/json

请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location 'https://api.voicelibrary.co/enterprise/v1/tts//stream?format=mp3_44100_64&quality=0&direct=1&compress=false' \
--header 'api-key;' \
--header 'Content-Type: application/json' \
--data '{
    "text": "string",
    "voice_settings": {
        "stability": 0.7,
        "similarity_boost": 0.7,
        "speed": 0.7,
        "style": 0.3,
        "use_speaker_boost": true
    },
    "model_id": "multilingual_v2",
    "language_code": "en",
    "priority": "auto",
    "text_normalization": "on",
    "seed": 12345
}'
响应示例响应示例
{}
上一页
HTTP synthesis
下一页
Non-streaming HTTP synthesis
Built with