Telegram 语音消息一键转文字
简介
将 Telegram 语音消息转录为文本的 OpenAI Whisper 工具,支持三种输入模式,需配置 API 密钥,适合异步语音处理场景。
原始描述
Transcribe Telegram voice messages and audio notes into text using the OpenAI Whisper API. Use when (1) a user sends a voice message or audio note via Telegr...
通过你的 Agent 添加
安装目录:telegram-voice-transcribe/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: telegram-voice-transcribe description: "Transcribe Telegram voice messages and audio notes into text using the OpenAI Whisper API. Use when (1) a user sends a voice message or audio note via Telegram and you need to read or understand its content, (2) you receive a message with a voice file_id in the Telegram message metadata, (3) the user explicitly asks you to transcribe an audio file. Produces the transcript as plain text so you can respond naturally. Requires OPENAI_API_KEY env var and optionally TELEGRAM_BOT_TOKEN for file_id mode. NOT for live audio streams, video transcription, or non-Telegram audio pipelines (though the script supports local files and URLs too)."
telegram-voice-transcribe
Transcribe Telegram voice notes into text via OpenAI Whisper (whisper-1).
Quick Workflow
- Detect a voice message: look for
voice.file_idoraudio.file_idin the inbound message metadata. - Run the transcription script:
python3 ~/openclaw/skills/telegram-voice-transcribe/scripts/transcribe.py \ --file-id <file_id> --language es - Read the JSON output —
transcriptfield contains the text. - Respond to the user based on the transcript content (treat it like typed text).
Script Modes
| Mode | Flag | When to use |
|---|---|---|
| Telegram file_id | --file-id <id> |
Standard case — voice message in Telegram |
| Local file | --file <path> |
Testing, or file already downloaded |
| URL | --url <https://...> |
Audio hosted externally |
Always pass --language es for Spanish speakers to improve speed and accuracy.
Output
{"transcript": "Hola, necesito que hagas un cambio en el juego", "language": "es", "duration_s": 4.2}
If error key is present, surface it to the user and check setup.
Environment Requirements
OPENAI_API_KEY— required (set viaopenclaw configure)TELEGRAM_BOT_TOKEN— required for--file-idmode
See references/setup.md for full setup, hooks integration, costs, and local Whisper alternative.
Error Handling
| Error | Fix |
|---|---|
OPENAI_API_KEY not set |
Configure key via openclaw configure --section env |
TELEGRAM_BOT_TOKEN required |
Add bot token to env |
openai package not installed |
pip install openai |
Telegram 400 Bad Request |
file_id expired — Telegram file_ids expire after ~48h |
| File too large | Whisper API limit is 25MB; split audio or use local Whisper |
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。