名称: openrouter-transcribe
描述: 通过 OpenRouter 使用支持音频的模型(Gemini、GPT-4o-audio 等)转录音频文件。
主页: https://openrouter.ai/docs
元数据: {"clawdbot":{"emoji":"🎙️","requires":{"bins":["curl","ffmpeg","base64","jq"],"env":["OPENROUTER_API_KEY"]},"primaryEnv":"OPENROUTER_API_KEY"}}
使用 OpenRouter 的聊天补全 API 和 input_audio 内容类型来转录音频文件。适用于任何支持音频输入的模型。
{baseDir}/scripts/transcribe.sh /path/to/audio.m4a
输出将显示在标准输出(stdout)中。
# 指定模型(默认:google/gemini-2.5-flash)
{baseDir}/scripts/transcribe.sh audio.ogg --model openai/gpt-4o-audio-preview
# 自定义指令
{baseDir}/scripts/transcribe.sh audio.m4a --prompt "转录时标注说话人"
# 保存到文件
{baseDir}/scripts/transcribe.sh audio.m4a --out /tmp/transcript.txt
# 自定义调用方标识(用于 OpenRouter 仪表盘)
{baseDir}/scripts/transcribe.sh audio.m4a --title "MyApp"
input_audio 内容类型发送至 OpenRouter 聊天补全 API设置 OPENROUTER_API_KEY 环境变量,或在 ~/.clawdbot/clawdbot.json 中配置:
{
skills: {
"openrouter-transcribe": {
apiKey: "YOUR_OPENROUTER_KEY"
}
}
}
脚本会向 OpenRouter 发送标识头信息:
- X-Title: 调用方名称(默认:"Peanut/Clawdbot")
- HTTP-Referer: 参考 URL(默认:"https://clawdbot.com")
这些信息会显示在您的 OpenRouter 仪表盘中,用于追踪调用来源。
ffmpeg 格式错误:脚本使用临时目录(而非 mktemp -t file.wav),因为 macOS 的 mktemp 会在扩展名后添加随机后缀,这会破坏格式检测。
参数列表过长:大音频文件会产生巨大的 base64 字符串,可能超出 shell 参数长度限制。脚本将数据写入临时文件(使用 --rawfile 传递给 jq,使用 @file 传递给 curl),而不是作为参数传递。
空响应:如果收到“来自 API 的空响应”,脚本会输出原始响应以供调试。常见原因包括:
- API 密钥无效
- 模型不支持音频输入
- 音频文件过大或已损坏