| 1234567891011121314 |
- import requests
- headers = {'Authorization': 'Bearer sk-c25679401ba24c749f53be86b0c9a7a6', 'Content-Type': 'application/json'}
- url = 'https://dashscope.aliyuncs.com/api/v1/services/audio/tts/SpeechSynthesizer'
- # 测试 v3.5-flash 用系统音色
- for model in ['cosyvoice-v3.5-flash', 'cosyvoice-v3.5-plus']:
- r = requests.post(url, headers=headers, json={
- 'model': model,
- 'input': {'text': '测试', 'voice': 'longanyang', 'format': 'mp3', 'sample_rate': 24000}
- })
- d = r.json()
- ok = '✅' if r.status_code == 200 else '❌'
- print(f'{ok} {model} + longanyang: HTTP {r.status_code} - {d.get("message","")}')
|