speech-recognition
通用语音识别 Skill。支持多种音频格式(ogg/mp3/wav/m4a),使用硅基流动 SenseVoice API 进行语音转文字。当用户发送语音消息、音频文件,或需要转录音频时触发。
通用语音识别 Skill。支持多种音频格式(ogg/mp3/wav/m4a),使用硅基流动 SenseVoice API 进行语音转文字。当用户发送语音消息、音频文件,或需要转录音频时触发。
Real data. Real impact.
Emerging
Developers
Per week
Open source
Skills give you superpowers. Install in 30 seconds.
使用硅基流动 SenseVoice API 进行语音识别,支持多种音频格式。
| 触发场景 | 说明 |
|---|---|
| 用户发送语音消息 | / / / 文件 |
| 用户要求转录音频 | "转录这个音频"、"语音转文字" |
| 音频文件处理 | 需要提取音频中的文字内容 |
在
~/.openclaw/openclaw.json 中配置:
{ "providers": { "siliconflow": { "apiKey": "sk-xxx" } } }
POST https://api.siliconflow.cn/v1/audio/transcriptions
| 模型 | 说明 |
|---|---|
| 默认,中文效果好 |
import requestsapi_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": f"Bearer {api_key}"}, files={"file": ("audio.mp3", audio_data, "audio/mpeg")}, data={"model": "FunAudioLLM/SenseVoiceSmall"}, timeout=60 )
print(response.json().get("text", ""))
当用户发送
.ogg 语音消息时:
# 1. 转换格式(如果是 ogg) ffmpeg -i /path/to/audio.ogg -ar 16000 -ac 1 /tmp/audio.mp3 -y2. 调用硅基流动 API(API Key 从环境变量读取)
python3 -c " import requests import os
api_key = os.environ.get('SILICONFLOW_API_KEY') if not api_key: raise ValueError('请设置 SILICONFLOW_API_KEY 环境变量')
with open('/tmp/audio.mp3', 'rb') as f: audio_data = f.read()
response = requests.post( 'https://api.siliconflow.cn/v1/audio/transcriptions', headers={'Authorization': f'Bearer {api_key}'}, files={'file': ('audio.mp3', audio_data, 'audio/mpeg')}, data={'model': 'FunAudioLLM/SenseVoiceSmall'}, timeout=60 ) print(response.json().get('text', '')) "
| 格式 | 扩展名 | 说明 |
|---|---|---|
| MP3 | | 推荐,兼容性好 |
| OGG | | Telegram/Signal 语音格式,需转换 |
| WAV | | 无压缩,文件大 |
| M4A | | iOS 录音格式 |
| FLAC | | 无损压缩 |
如果音频不是 MP3 格式,用 FFmpeg 转换:
# OGG → MP3 ffmpeg -i input.ogg -ar 16000 -ac 1 output.mp3 -yWAV → MP3
ffmpeg -i input.wav -ar 16000 -ac 1 output.mp3 -y
M4A → MP3
ffmpeg -i input.m4a -ar 16000 -ac 1 output.mp3 -y
参数说明:
-ar 16000: 采样率 16kHz(语音识别推荐)-ac 1: 单声道(减少文件大小)-y: 覆盖已存在的文件| 错误 | 原因 | 解决 |
|---|---|---|
| API Key 无效 | 检查配置 |
| 文件太大 | 压缩或分割音频 |
| 网络超时 | 重试或检查网络 |
| 格式不支持 | 用 FFmpeg 转换 |
| Skill | 说明 |
|---|---|
| 抖音视频语音提取 |
| 文字转语音 |
版本:1.0.0 创建于:2026-02-26
No automatic installation available. Please visit the source repository for installation instructions.
View Installation Instructions1,500+ AI skills, agents & workflows. Install in 30 seconds. Part of the Torly.ai family.
© 2026 Torly.ai. All rights reserved.