360 Secure SkillHub
360 安全技能中心

Coze Asr

这是借助Coze API实现的语音转文本工具,需先配置API密钥使用。支持MP3、WAV、OGG(含opus编码)等音频格式,可指定转录语言(默认中文)。通过bash脚本传入音频文件路径(必填)和可选语言参数调用,输出含转录文本的JSON格式结果,适用于录音、会议音频等场景。

franklu0819-lang
franklu0819-lang
热度 55.20
最近更新 2026-05-11 17:36:03
分类:效率依赖:代码执行 / 第三方 API / 读写文件应用场景:文件转换

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add coze-asr
Metadata
name
coze-asr
description
Automatic Speech Recognition (ASR) using Coze API. Use when you need to transcribe audio files to text. Supports Chinese audio transcription via Coze's speech-to-text API.
metadata
{"openclaw":{"requires":{"bins":["jq"],"env":["COZE_API_KEY"]}}}

Coze Automatic Speech Recognition (ASR)

Transcribe audio files to text using Coze API.

Setup

1. Get your API Key: Get a key from Coze Platform

2. Set it in your environment:

export COZE_API_KEY="your-key-here"

Supported Audio Formats

  • MP3 - Recommended
  • WAV - Supported
  • OGG - Supported (包括 opus 编码)

Note: Coze API 原生支持 mp3、wav、ogg 格式,无需转换。

Usage

Basic Transcription

Transcribe an audio file:

bash scripts/speech_to_text.sh recording.mp3

Full Options

bash scripts/speech_to_text.sh <audio_file> [language]

Parameters:

  • audio_file (required): Path to audio file
  • language (optional): Language code (default: zh)

Output Format

The script outputs JSON with transcribed text.

Example output:

{
  "text": "你好,这是转录的文本内容"
}

Troubleshooting

File Size Issues:

  • Check Coze API documentation for file size limits
  • Reduce sample rate or bit depth if needed

Poor Accuracy:

  • Improve audio quality
  • Ensure clear speech and minimal noise
  • Use appropriate language code

Format Issues:

  • Ensure file is not corrupted
  • Verify audio can be played by standard players