Function
Tool identifierspeech_to_text.
speech_to_text calls the Volcengine recording-file speech recognition service to transcribe speech in an audio file into text. The spoken language is detected automatically, and the result contains the full text, duration, and timestamped utterances. The audio can be a local file path or a publicly accessible http(s) URL.
The tool is an async function (async def). Its credentials are independent of the agent reasoning model and do not require MODEL_AGENT_API_KEY.
Import path: from veadk.tools.builtin_tools.speech_to_text import speech_to_text
Prerequisites
Environment variables:TOOL_SPEECH_TO_TEXT_API_KEY: speech recognition API key, highest priorityTOOL_VESPEECH_API_KEY: VeSpeech service API key, used as a fallbacktool.vespeech.api_keyin the configuration file: used when neither environment variable is set
Usage
examples/tools/speech_to_text/agent.py
Parameters
Success returns
{"text", "duration_ms", "utterances", "log_id"}:
text: full transcript; the output includes punctuation and normalizes spoken numbers.duration_ms: audio duration in milliseconds.utterances: list of timestamped segments, each{"start_time", "end_time", "text"}, at most 200 items.log_id: server-side request identifier for troubleshooting.
error field; some failure results also include log_id.
Notes
- Local audio is Base64-encoded into the request, so larger files make the request bigger; check the network and timeout for long recordings.
- Remote URLs pass an SSRF check first, blocking private and loopback addresses, and are then fetched by the recognition service over the public network, so the link must be reachable from that service.
- The language is detected automatically and needs no configuration; unlike
text_to_speech, this tool needs only the speech service API key—no App ID or model API key.