minimax-speech-2.8-hd

This is a text-to-speech model, suitable for dubbing that requires high sound performance and details. You can specify the timbre, speaking speed, emotion, pronunciation method and audio format. You can also create and use your own cloned timbre on the speech generation page after logging in.

Basic information

Item Content
Site model name minimax-speech-2.8-hd
Model type Speech generation (text to speech)
Request interface POST /v1/audio/speech
Enter a piece of text
output audio binary file

request parameters

Call using this site’s address and this site’s token. input must be text, do not use the object writing method of other speech models. After the request is successful, the response body is audio, not JSON.

Parameter Type Required Description
model The text is and fixedly filled in minimax-speech-2.8-hd.
input Text is The content to be read; the voice page of this site is limited to 1~9999 words.
voice Text No Tone number. Single timbre request must fill in this item or metadata.voice_setting.voice_id; the interface will not automatically fill in the timbre. The default page of this site is male-qn-qingse.
response_format Text No mp3, wav, flac, pcm, opus, pcmu_raw or pcmu_wav; when omitted, it is mp3.
speed Number No Speech speed, 0.5 ~ 2, default 1; The larger the value, the faster the speaking speed.
metadata Object No Place the advanced voice settings in the following table. Fill in each setting only once; do not set the same value in both the top level and metadata.
stream_format Text No Please omit. This model returns complete audio through this interface, does not support streaming requests, and cannot fill in audio.

metadata Advanced settings

The following are the fields available in metadata. For fields not listed, please contact the site customer service for confirmation.

Field Type Description
voice_setting.voice_id Text Tone number, as an alternative to the top layer voice; choose one of the two places to fill in.
voice_setting.speed Number Speech speed, 0.5 ~ 2, default 1; as top level Alternative writing of speed.
voice_setting.vol Digital volume magnification, greater than 0 and not greater than 10; default 1 .
voice_setting.pitch Integer tone, -12 ~ 12; 0 means no adjustment.
voice_setting.emotion Text Optional happy, sad, angry, fearful, disgusted, surprised, calm. When omitted, it is processed by the model based on the text.
voice_setting.text_normalization true / false Old version of digital reading settings; it is recommended to use text_normalization_mode instead.
voice_setting.latex_read true / false Whether to read LaTeX formulas aloud. Chinese only; when turned on, it will be processed in Chinese, and the formula is wrapped in $$.
audio_setting.format text output format, as an alternative writing method for top-level response_format; choose one of the two places to fill in.
audio_setting.sample_rate Integer Sampling rate: 8000, 16000, 22050, 24000, 32000 or 44100 Hz, default 32000. Telephone codes pcmu_raw and pcmu_wav must use 8000.
audio_setting.bitrate integer 32000, 64000, 128000 or 256000 bit/s, default 128000; only for MP3.
audio_setting.channel Integer Number of channels: 1 mono or 2 dual channels, default 1.
language_boost Text Language or dialect prompt, such as Chinese, Chinese,Yue, English , Japanese or auto.
text_normalization_mode Text Number reading processing: basic or quality.
pronunciation_dict.tone Text array Custom pronunciation; each item is written as 原文/读法. Chinese pronunciation can use pinyin with tonal numbers, such as 你好/(ni3)(hao3).
timbre_weights Object array Mixed timbre; up to 4 types, each containing different voice_id and weight ( 1 ~ 100), the weights do not need to total 100. When set, the single timbre number can be omitted; this function generates a mixed timbre.
voice_modify Object Sound effect settings; only available for MP3, WAV, FLAC. pitch, intensity, timbre are each -100 ~ 100; sound_effects is optional spacious_echo, auditorium_echo, lofi_telephone, robotic.
aigc_watermark true / false Whether to add audio generation identification.

The sound effects of pitch range from deep to bright, intensity range from strong to soft, and timbre range from deep to crisp, respectively corresponding to -100 to 100; 0 For no adjustment. The four sound_effects values ​​are, in order, wide echo, auditorium echo, telephone tone, and robot tone.

Request Example

First press Voice Interface General Instructions to set SHANHAI_BASE_URL and SHANHAI_API_KEY. The following example uses the site root address and the site token and saves the audio as a WAV file:

curl --fail-with-body "$SHANHAI_BASE_URL/v1/audio/speech" \
  -H "Authorization: Bearer $SHANHAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "minimax-speech-2.8-hd",
  "input": "你好,欢迎使用ShangHai Do语音服务。",
  "voice": "male-qn-qingse",
  "response_format": "wav",
  "speed": 1
}' \
  -o minimax-speech-hd.wav

The following Python example is also available for Windows; requests must be installed before running, and environment variables must be set according to the general instructions above. The program will first check whether the request is successful and then save the audio:

import os
from pathlib import Path

import requests

response = requests.post(
    os.environ["SHANHAI_BASE_URL"].rstrip("/") + "/v1/audio/speech",
    headers={"Authorization": "Bearer " + os.environ["SHANHAI_API_KEY"]},
    json={
        "model": "minimax-speech-2.8-hd",
        "input": "你好,欢迎使用ShangHai Do语音服务。",
        "voice": "male-qn-qingse",
        "response_format": "wav",
        "speed": 1,
    },
    timeout=120,
    allow_redirects=False,
)
if response.status_code != 200:
    raise RuntimeError(f"语音请求失败(HTTP {response.status_code}):{response.text[:500]}")
Path("minimax-speech-hd.wav").write_bytes(response.content)

When you need to control emotion, sampling rate or pronunciation, you can add metadata in the same request. The following is an example of a JSON request body:

{
  "model": "minimax-speech-2.8-hd",
  "input": "欢迎使用ShangHai Do语音服务。",
  "metadata": {
    "voice_setting": {
      "voice_id": "male-qn-qingse",
      "speed": 1,
      "emotion": "calm",
      "vol": 1,
      "pitch": 0
    },
    "audio_setting": {
      "format": "wav",
      "sample_rate": 32000,
      "channel": 1
    },
    "language_boost": "Chinese",
    "pronunciation_dict": {
      "tone": ["你好/(ni3)(hao3)"]
    }
  }
}

On the speech generation page after logging in, you can also choose to generate sentence-level or word-level subtitles and download the subtitles JSON or SRT file. This subtitle download function belongs to the page history; a successful response from the public token interface only returns the audio binary.

Clone sounds on the voice page

Voice cloning is not a public token API. Sign in to ShangHai Do, open Speech generation page, and select this model or minimax-speech-2.8-turbo. Choose “Clone my voice”, upload a recording, enter a voice name and preview text, and confirm that you own the voice or have the speaker’s permission before creating it. The created voice is selected automatically. Enter your narration and generate it. You can later select the voice from its history for the Turbo or HD model.

To create a clone, you must use the voice page after login. The public token interface does not allow the creation and management of clones. It is recommended to select from the page history to continue using the cloned tone; when you need to call the exclusive tone through the program, please contact the site customer service to confirm the available number. If the timbre is successfully created but the preview download fails, please check the timbre in the history first to avoid repeated creation.

Return results

On success the response body is an audio binary file in the selected format, not JSON. Please save with the file extension corresponding to response_format. opus uses the Ogg container; pcm and pcmu_raw are original audio data, and the audio player may need to support the corresponding encoding and sampling rate when playing.

The response will contain error information when the request fails. Please check the HTTP status before saving or playing the file.

encountered a problem

If you encounter problems with calling or configuration, please contact the site customer service and provide the model name, error time and error information to facilitate troubleshooting.