音频视频转录服务

通过Groq托管的Whisper模型提供音频/视频转录服务,支持单词级时间戳、自动缓存和成本估算。

  • by bis-code
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 bis-code/groq-whisper-mcp

使用说明

格罗克轻声细语

MCP服务器,用于通过Groq托管的Whisper进行音频/视频转录。字级时间戳、自动缓存、成本估算。

比OpenAI Whisper便宜9倍 -相同的型号,不同的API。

提供商 型号 成本/小时
Groq 耳语-arge-v3-turbo 0.04美元
Groq 耳语-arge-v3 0.111美元
Groq 提炼耳语 0.02美元
OpenAI 耳语-1 0.36美元

先决条件

安装

git clone https://github.com/bis-code/groq-whisper-mcp.git
cd groq-whisper-mcp
python3 -m venv venv
venv/bin/pip install mcp openai

Claude代码配置

添加到您的项目 .mcp.json:

{
  "mcpServers": {
    "whisper": {
      "command": "/path/to/groq-whisper-mcp/venv/bin/python",
      "args": ["-m", "server"],
      "cwd": "/path/to/groq-whisper-mcp/src",
      "env": {
        "GROQ_API_KEY": "your-groq-api-key"
      }
    }
  }
}

工具

transcribe_video

转录带有字级时间戳的视频文件。

参数 类型 必填 说明
video_path string yes 视频文件路径
model string no Whisper模型(默认值: whisper-large-v3-turbo)
force_retranscribe boolean no 绕过缓存(默认值: false)

返回全文、单词级时间戳 [{word, start, end}]和持续时间。每个项目都会缓存结果。

estimate_transcription_cost

转录前估算成本。

参数 类型 必填 说明
video_path string yes 视频文件路径
model string no Whisper模型(默认值: whisper-large-v3-turbo)

返回持续时间、估计成本以及与OpenAI定价的比较。

运作原理

  1. 通过ffmpeg从视频中提取音频(128kbps MP3,如果>25MB,则回落到64kbps)
  2. 发送到Groq的OpenAI兼容API(相同 openai SDK,不同 base_url)
  3. 返回精度约为0.1秒的字级时间戳
  4. 将结果缓存为 whisper_words.json 视频旁边

运行测试

PYTHONPATH=src venv/bin/pytest tests/ -v

许可证

麻省理工学院