T2A Large 快速接入
1.获取鉴权信息


2.复制完整代码并执行
import requests
url = 'https://api.minimax.chat/v1/t2a_async?GroupId=${group_id}'
headers = {
'authorization': 'Bearer ${api_key}',
}
data = {
'model': 'speech-01',
'voice_id': 'female-tianmei',
'speed': '0.8',
"vol": '1',
"pitch": '1',
"audio_sample_rate": '32000',
"bitrate": '128000'
}
files = {
'text': open('/Users/minimax/Downloads/21622420008680404.zip', 'rb')
}
response = requests.post(url, headers=headers, data=data, files=files)
print(response.text)
3.构建请求头
url = 'https://api.minimax.chat/v1/t2a_async?GroupId=${group_id}'
headers = {
'authorization': 'Bearer ${api_key}',
}
4.构建请求内容
data = {
'model': 'speech-01',
'voice_id': 'female-tianmei',
'speed': '0.8',
"vol": '1',
"pitch": '1',
"audio_sample_rate": '32000',
"bitrate": '128000'
}
files = {
'text': open('/Users/minimax/Downloads/21622420008680404.zip', 'rb')
}
5.完成交互
response = requests.post(url, headers=headers, data=data, files=files)
print(response.text)
修改于 2024-01-04 06:40:21