OpenClaw 支持对入站音频/语音消息进行自动转录,并将转录结果注入回复流水线。

工作流程

  1. 定位第一个音频附件(本地路径或 URL),必要时下载
  2. 按 maxBytes 限制过滤,超限则跳过该模型条目
  3. 按顺序尝试第一个可用模型(provider 或 CLI)
  4. 失败或跳过时,尝试下一个条目
  5. 成功后:Body 替换为 [Audio] 块,设置 {{Transcript}}

自动检测顺序(未配置 models 时)

  1. 当前回复模型(若 provider 支持音频)
  2. 本地 CLI:sherpa-onnx-offline → whisper-cli → whisper
  3. Gemini CLI(read_many_files)
  4. Provider 认证(OpenAI → Groq → xAI → Deepgram → Google → SenseAudio → ElevenLabs → Mistral)

禁用自动检测:tools.media.audio.enabled: false

配置示例

{
  tools: {
    media: {
      audio: {
        enabled: true,
        maxBytes: 20971520,
        models: [
          { provider: "openai", model: "gpt-4o-mini-transcribe" },
          { type: "cli", command: "whisper", args: ["--model", "base", "{{MediaPath}}"] }
        ],
        echoTranscript: true,
        echoFormat: '📝 "{transcript}"'
      }
    }
  }
}

关键限制

  • 默认大小上限:20MB(tools.media.audio.maxBytes)
  • 小于 1024 字节的音频文件直接跳过
  • 默认 maxChars 未设置(完整转录)
  • CLI stdout 上限 5MB

群组 mention 检测

当群组设置 requireMention: true 时,OpenClaw 会在检查 mention 前先转录音频:

  1. 对无文本的语音消息执行”预检”转录
  2. 检查转录结果中是否包含 mention 模式
  3. 找到 mention 则进入完整回复流水线

禁用特定群组的预检:channels.telegram.groups.<chatId>.disableAudioPreflight: true

相关页面