通用语音识别 Skill。支持多种音频格式(ogg/mp3/wav/m4a),使用硅基流动 SenseVoice API 进行语音转文字。当用户发送语音消息、音频文件,或需要转录音频时触发。
使用硅基流动 SenseVoice API 进行语音识别,支持多种音频格式。
| 触发场景 | 说明 |
|---|---|
| 用户发送语音消息 | .ogg / .mp3 / .wav / .m4a 文件 |
| 用户要求转录音频 |
在 ~/.openclaw/openclaw.json 中配置:
json
{
providers: {
siliconflow: {
apiKey: sk-xxx
}
}
}
POST https://api.siliconflow.cn/v1/audio/transcriptions
| 模型 | 说明 |
|---|---|
| FunAudioLLM/SenseVoiceSmall | 默认,中文效果好 |
python
import requests
api_key = sk-xxx
with open(/path/to/audio.mp3, rb) as f:
audio_data = f.read()
response = requests.post(
https://api.siliconflow.cn/v1/audio/transcriptions,
headers={Authorization: fBearer {api_key}},
files={file: (audio.mp3, audio_data, audio/mpeg)},
data={model: FunAudioLLM/SenseVoiceSmall},
timeout=60
)
print(response.json().get(text, ))
当用户发送 .ogg 语音消息时:
bash
apikey = os.environ.get(SILICONFLOWAPI_KEY)
if not api_key:
raise ValueError(请设置 SILICONFLOWAPIKEY 环境变量)
with open(/tmp/audio.mp3, rb) as f:
audio_data = f.read()
response = requests.post(
https://api.siliconflow.cn/v1/audio/transcriptions,
headers={Authorization: fBearer {api_key}},
files={file: (audio.mp3, audio_data, audio/mpeg)},
data={model: FunAudioLLM/SenseVoiceSmall},
timeout=60
)
print(response.json().get(text, ))
| 格式 | 扩展名 | 说明 |
|---|---|---|
| MP3 | .mp3 | 推荐,兼容性好 |
| OGG |
如果音频不是 MP3 格式,用 FFmpeg 转换:
bash
参数说明:
| 错误 | 原因 | 解决 |
|---|---|---|
| 401 Unauthorized | API Key 无效 | 检查配置 |
| 413 Payload Too Large |
| Skill | 说明 |
|---|---|
| douyin-video | 抖音视频语音提取 |
| cosyvoice-tts |
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 speech-recognition-1776292201 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 speech-recognition-1776292201 技能
skillhub install speech-recognition-1776292201
文件大小: 2.94 KB | 发布时间: 2026-4-17 16:13