{ "model": "tts-1", "input": "你好,喜欢我的声音吗?", "voice": "alloy" }
curl --location --request POST 'https://chatplusapi.cn/v1/audio/speech' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "model": "tts-1", "input": "你好,喜欢我的声音吗?", "voice": "alloy" }'
成功返回转换后语音MP3的二进制文件内容,使用python requests请求后保存文件代码如下: # file_path为要保存的文件路径,response.content为二进制文件内容 with open(file_path, 'wb') as file: file.write(response.content)