SuperAPI AI Directory

byted-voice-to-text

General & other

View repository

Updated 10-15 17:30

About this skill

Voice to Text Skill

Based onVolcano Engine BigModel ASR to convert speech to text. Accuracy and multilingual capability are far superior to local whisper, and it is faster.

Core Execution Flow

  1. Received a Feishu voice message (message_type: audio), need to automatically recognize the speech content
  2. User provides audio to be transcribed:
    • First run inspect_audio.py
    • then choose based on duration, size, URL/local path asr_flash.py(Flash version) or asr_standard.py(Standard version)
  3. Missing ffmpeg / ffprobe: first execute ensure_ffmpeg.py --execute
  4. User asks about installation, activation, manual configuration: read the corresponding document according to the reference map at the end of the document

Mandatory Rules (Highest Priority)

When you receive a voice message or audio file attachment:

  • Must and can only use the scripts of this Skill to recognize speech
  • Prohibited to use whisper commands or the openai-whisper skill
  • Fallback prohibited: when the script fails, directly inform the user of the error message, do not switch to whisper
  • Probe first, then recognize: uniformly first execute python3 <SKILL_DIR>/scripts/inspect_audio.py "<AUDIO_INPUT>"
  • If ffmpeg/ffprobe is missing, install autonomously first: first execute python3 <SKILL_DIR>/scripts/ensure_ffmpeg.py --execute, only ask the user for help after it fails

Usage Steps

  1. Confirm the audio source (local file, URL, or Feishu voice file_key).
  2. Before running the script, first cd to this skill directory:skills/byted-voice-to-text。
  3. Execute the corresponding command (see parameter description below).
  4. Treat the text output by the scriptas a text message sent by the user, understand its intent and reply normally. No need to additionally state "the speech recognition result is xxx", just directly answer the user's question.

Routing Cheat Sheet

Local file

Condition Script
Duration ≤ 2h and size ≤ 100MB asr_flash.py --file "<FILE>" (Flash version, synchronous fast return)
2h < duration ≤ 5h asr_standard.py --file "<FILE>" (Standard version, asynchronous submit+poll)
Duration > 5h Not supported; slice first and process each slice with the Flash version
Cannot obtain duration and size ≤ 100MB asr_flash.py --file "<FILE>" (Flash version fallback)
Cannot obtain duration and size > 100MB asr_standard.py --file "<FILE>" (Standard version fallback)

Public URL

  • By default, go directly to asr_standard.py --url "<URL>"
  • Do not download locally, probe, transcode, and then route first
  • Only when the Standard version actually fails, then decide based on the error whether to enter the local download/slicing chain

When hitting URL, large files, or slicing trade-offs, then read routing_strategy.md。

Environment Variables and Authentication

Authentication usesthe new console solution, see:Quick Start (New Console)。

Environment Variable Purpose Required
MODEL_SPEECH_API_KEY API Key (new console solution) Yes
MODEL_SPEECH_APP_ID App ID (used in conjunction with legacy authentication) No
MODEL_SPEECH_ASR_API_BASE Flash version endpoint (has default value) No
MODEL_SPEECH_ASR_RESOURCE_ID Flash version resource ID (default volc.bigasr.auc_turbo) No
MODEL_SPEECH_ASR_STANDARD_SUBMIT_URL Standard version submit endpoint (has default value) No
MODEL_SPEECH_ASR_STANDARD_QUERY_URL Standard version query endpoint (has default value) No
MODEL_SPEECH_ASR_STANDARD_RESOURCE_ID Standard version resource ID (default volc.bigasr.auc) No
FEISHU_TENANT_TOKEN Feishu tenant_access_token (only --file-key mode) No

Script list

Script Purpose Corresponding mode
scripts/inspect_audio.py Audio metadata detection (duration, sample rate, channels, etc.) Pre-check
scripts/ensure_ffmpeg.py Automatically detect and install ffmpeg/ffprobe Pre-check
scripts/asr_flash.py Flash version recognition (≤2h/100MB, synchronous) Express/Flash
scripts/asr_standard.py Standard version recognition (≤5h, asynchronous submit+poll) Standard

Minimal script example

# 预检:探测音频元信息
python3 <SKILL_DIR>/scripts/inspect_audio.py "<AUDIO_INPUT>"

# 缺 ffmpeg 时自动安装
python3 <SKILL_DIR>/scripts/ensure_ffmpeg.py --execute

# 极速版(短音频,≤2h/100MB)
python3 <SKILL_DIR>/scripts/asr_flash.py --file "<AUDIO_FILE>"

# 标准版(长音频或 URL)
python3 <SKILL_DIR>/scripts/asr_standard.py --url "<AUDIO_URL>"
python3 <SKILL_DIR>/scripts/asr_standard.py --file "<LONG_AUDIO_FILE>"

# 标准版:仅提交不轮询
python3 <SKILL_DIR>/scripts/asr_standard.py --url "<URL>" --no-poll

# 标准版:查询已有任务
python3 <SKILL_DIR>/scripts/asr_standard.py --query-task-id <ID> --query-logid <LOGID>

asr_flash.py (Flash version) parameters

Parameter Required Description
--file Choose one of three Local audio file path
--url Choose one of three URL address of the audio file
--file-key Choose one of three file_key of the Feishu voice message
--feishu-token No Feishu tenant_access_token
--appid No App ID
--token No API Key
--language No Language code

asr_standard.py (Standard version) parameters

Parameter Required Description
--url Choose one of two URL address of the audio file
--file Choose one of two Local audio file path
--appid No App ID
--token No API Key
--language No Language code
--no-poll No Only submit the task, do not poll for results
--poll-interval No Polling interval in seconds (default 3)
--poll-max-time No Maximum polling time in seconds (default 10800)
--query-task-id No Query an existing task ID
--query-logid No X-Tt-Logid passed in during query

Feishu voice message processing flow

收到 audio 消息 → 音频文件已下载到 /root/.openclaw/media/inbound/ → 执行 asr_flash.py --file → 返回文字 → 当作用户消息处理

Common commands:

# 飞书语音文件(最常用,文件已被飞书插件自动下载)
python scripts/asr_flash.py --file "/root/.openclaw/media/inbound/xxxxx.ogg"

Error handling

  • PermissionError: MODEL_SPEECH_API_KEY ... → Prompt the user to configure the API Key
  • ASR 请求失败 → Check the API credentials and account
  • 音频时长超过 5 小时 → Prompt the user to split the file
  • 音频文件不存在/为空 → Check the file path
  • When encountering an error, directly inform the user of the specific error; do not attempt to substitute with whisper.

When to continue reading references

Reference documentation