本帖最后由 小白龙 于 2024-11-24 09:12 编辑
最近发现海螺语音的效果不错, 用手机号注册后有100万的token免费使用, 就参考官方的CURL代码用GPT转成powershell来测试, 但是改了得有上百遍, 死活就是报错, 代码中也没有存成mp3的部分,这也让人头疼
base_resp
---------
@{status_code=1000; status_msg=amadeus resp audioInfo.URL is invalid}
求路过大佬指导, 多谢
官方链接:
https://platform.minimaxi.com/do ... 005a427f0c8a5701643
官方CURL代码- group_id="请填写您的group_id"
- api_key="请填写您的api_key"
- curl --location 'https://api.minimax.chat/v1/t2a_v2?GroupId=${group_id}' \
- --header 'Authorization: Bearer $MiniMax_API_KEY' \
- --header 'Content-Type: application/json' \
- --data '{
- "model": "speech-01-turbo",
- "text": "真正的危险不是计算机开始像人一样思考,而是人开始像计算机一样思考。计算机只是可以帮我们处理一些简单事务。",
- "stream": false,
- "voice_setting":{
- "voice_id": "male-qn-qingse",
- "speed": 1,
- "vol": 1,
- "pitch": 0
- "emotion": "happy"
- },
- "pronunciation_dict":{
- "tone": ["处理/(chu3)(li3)", "危险/dangerous"]
- },
- "audio_setting":{
- "sample_rate": 32000,
- "bitrate": 128000,
- "format": "mp3",
- "channel": 1
- }
- }'
复制代码 GPT写的powershell代码, 会报错- # 设置变量
- $group_id = "改自己的, 在 https://platform.minimaxi.com/user-center/basic-information?key=66719005a427f0c8a5701643&document=T2A+V2"
- $api_key = "改自己的, 在 https://platform.minimaxi.com/user-center/basic-information?key=66719005a427f0c8a5701643&document=T2A+V2"
-
- # 创建 JSON 数据
- $jsonData = @{
- model = "speech-01-turbo"
- text = "真正的危险不是计算机开始像人一样思考,而是人开始像计算机一样思考。计算机只是可以帮我们处理一些简单事务。"
- stream = $false
- voice_setting = @{
- voice_id = "male-qn-qingse"
- speed = 1
- vol = 1
- pitch = 0
- emotion = "happy"
- }
- pronunciation_dict = @{
- tone = @("处理/(chu3)(li3)", "危险/dangerous")
- }
- audio_setting = @{
- sample_rate = 32000
- bitrate = 128000
- format = "mp3"
- channel = 1
- }
- }
-
- # 转换为 JSON 格式字符串
- $jsonString = $jsonData | ConvertTo-Json -Depth 3 -Compress
-
- # 发送 POST 请求
- $response = Invoke-RestMethod -Uri "https://api.minimax.chat/v1/t2a_v2?GroupId=$group_id" `
- -Method Post `
- -Headers @{
- "Authorization" = "Bearer $api_key"
- "Content-Type" = "application/json"
- } `
- -Body $jsonString
-
- # 打印返回结果
- $response
复制代码
|