What does doubao-asr do?
Agent Skill: Transcribe audio files via ByteDance Volcengine Seed-ASR 2.0 (豆包录音文件识别模型2.0). Best-in-class Chinese speech recognition with step-by-step setup guide.
Overview
This skill provides transcription of audio files using ByteDance Volcengine's Seed-ASR 2.0 model. It is optimized for Chinese speech recognition and supports asynchronous processing of audio files.
Prerequisites
- A Volcengine account with access to the Seed-ASR API
- API access credentials (AK and SK)
- Python 3.8+ environment
Setup
- Install required dependencies:
pip install volcengine-python-sdk
- Configure environment variables:
export VOLC_ACCESSKEY="your_access_key"
export VOLC_SECRETKEY="your_secret_key"
- Create a client instance in your code:
from volcengine.asr import AsrService
asr_service = AsrService()
asr_service.set_ak("your_access_key")
asr_service.set_sk("your_secret_key")
Usage
Submit an audio file for transcription:
def transcribe_audio(audio_url: str, app_id: str = "your_app_id") -> dict:
"""
Transcribe an audio file using Seed-ASR 2.0.
Args:
audio_url: URL or path to the audio file
app_id: Application ID from Volcengine
Returns:
Dictionary with transcription results
"""
request = {
"appid": app_id,
"language": "zh",
"audio_url": audio_url,
"model_type": "seed_asr_v2"
}
response = asr_service.submit_task(request)
return response
Check transcription status:
def check_status(task_id: str) -> dict:
response = asr_service.get_task_result(task_id)
return response
Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
appid | Application ID | string | Yes |
language | Language code (e.g., zh for Chinese) | string | Yes |
audio_url | Public URL of the audio file | string | Yes |
model_type | Model type, use seed_asr_v2 | string | Yes |
callback_url | Optional callback URL for async notifications | string | No |
Supported Audio Formats
- MP3
- WAV
- FLAC
- AAC
- M4A
Error Handling
try:
result = transcribe_audio("https://example.com/audio.mp3")
print(result)
except Exception as e:
print(f"Transcription failed: {e}")
Notes
- The API operates asynchronously; poll for results after submission
- Audio file size should not exceed 500MB
- For longer recordings, consider splitting into chunks
- Refer to Volcengine documentation for detailed API reference