用途:在需要低延迟、交互式语音合成的场景下,调用阿里云百炼(Model Studio)Qwen TTS Realtime 系列模型,实现流式语音输出。
主要能力:支持一组指定的实时 TTS 模型字符串,包括 qwen3-tts-flash-realtime、qwen3-tts-instruct-flash-realtime、qwen3-tts-instruct-flash-realtime-2026-01-22、qwen3-tts-vd-realtime-2026-01-15、qwen3-tts-vc-realtime-2026-01-15。提供归一化接口 tts.realtime:请求参数为 text(必填)、voice(必填)、instruction(可选)、sample_rate(可选);响应包含 audio_base64_pcm_chunks 数组、sample_rate 和 finish_reason。
使用方式:先在虚拟环境安装 SDK:python3 -m venv .venv;. .venv/bin/activate;python -m pip install dashscope。设置环境变量 DASHSCOPE_API_KEY,或在 ~/.alibabacloud/credentials 中添加 dashscope_api_key。实时模式使用 websocket 或流式端点。可用探针脚本验证兼容性,示例:.venv/bin/python skills/ai/audio/aliyun-qwen-tts-realtime/scripts/realtime_tts_demo.py --text "This is a realtime speech demo." --fallback --output output/ai-audio-tts-realtime/audio/fallback-demo.wav;严格模式:--text "realtime health check" --strict。
限制:需保持每个语句简短以降低延迟;instruction 模型应保持指令明确简洁;某些 SDK/运行时组合可能在使用 MultiModalConversation 调用实时模型时被拒绝,需用探针脚本验证兼容性。默认输出目录为 output/ai-audio-tts-realtime/audio/,可用 OUTPUT_DIR 覆盖。缺少定价、平台和效果的官方说明。