使用 OATDA 统一音频 API 将音频转录为文字。在用户需要语音转文字、会议转录、播客、语音笔记、字幕等时触发。
Transcribe audio files to text through OATDA's unified audio API.
All commands need the OATDA API key. Resolve it inline for each exec call:
bash
export OATDA_API_KEY="${OATDA_API_KEY:-$(cat ~/.oatda/credentials.json 2>/dev/null | jq -r '.profiles[.defaultProfile].apiKey' 2>/dev/null)}"
If the key is empty or null, tell the user to get one at https://oatda.com and configure it.
Security: Never print the full API key. Only verify existence or show first 8 chars.
User saysProviderModelwhisper, whisper-1, openai whisper (default)openaiwhisper-1transcription, speech to text, sttopenaiwhisper-1
Default: openai / whisper-1 if no model specified.
If the user provides provider/model format directly (for example openai/whisper-1), split on /.
⚠️ Models change over time. If a model ID fails, query
oatda-list-modelswith?type=audiofirst.
The transcription endpoint supports:
multipart/form-data with a local file uploadfilefile_base64 for providers that support direct base64 payloadsMaximum audio file size is 25MB.
For local files, prefer multipart upload because it is simpler and avoids large JSON bodies.
bash
export OATDA_API_KEY="${OATDA_API_KEY:-$(cat ~/.oatda/credentials.json 2>/dev/null | jq -r '.profiles[.defaultProfile].apiKey' 2>/dev/null)}" && \
curl -s -X GET "https://oatda.com/api/v1/llm/models?type=audio" \
-H "Authorization: Bearer $OATDA_API_KEY" | jq '.audio_models[] | {id, supported_params}'
Look for:
audio_modes containing transcriptionresponse_format valuesbash
export OATDA_API_KEY="${OATDA_API_KEY:-$(cat ~/.oatda/credentials.json 2>/dev/null | jq -r '.profiles[.defaultProfile].apiKey' 2>/dev/null)}" && \
curl -s -X POST "https://oatda.com/api/v1/llm/transcriptions" \
-H "Authorization: Bearer $OATDA_API_KEY" \
-F "provider=<PROVIDER>" \
-F "model=<MODEL>" \
-F "file=@<AUDIO_FILE>" \
-F "response_format=json"
bash
AUDIO_DATA_URL="data:audio/mpeg;base64,$(base64 -w 0 audio.mp3)"
export OATDA_API_KEY="${OATDA_API_KEY:-$(cat ~/.oatda/credentials.json 2>/dev/null | jq -r '.profiles[.defaultProfile].apiKey' 2>/dev/null)}" && \
curl -s -X POST "https://oatda.com/api/v1/llm/transcriptions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OATDA_API_KEY" \
-d "$(jq -n \
--arg provider \"<PROVIDER>\" \
--arg model \"<MODEL>\" \
--arg file \"$AUDIO_DATA_URL\" \
'{provider: $provider, model: $model, file: $file, response_format: \"json\"}')"
language: ISO-639-1 language code like en, de, frprompt: Context for names, acronyms, or domain-specific termsresponse_format: json, text, srt, verbose_json, vtt, or diarized_jsontemperature: 0 to 1timestamp_granularities: word and/or segmentchunking_strategy: autohotwords: Provider-specific keyword hintsstream: true if supported by the selected modelThe API returns JSON like:
json
{
"text": "The transcribed text...",
"language": "en",
"duration": 42.5,
"segments": [],
"words": [],
"costs": {
"inputCost": 0,
"outputCost": 0.0001,
"totalCost": 0.0001,
"currency": "USD"
}
}
Present the text field to the user. Include subtitles, segments, or words if the requested format includes them.
HTTP StatusMeaningAction401Invalid API keyTell user to check their key402Insufficient creditsTell user to check balance400Bad request / model not supportedCheck model or file format and query oatda-list-models with type=audio413File too largeKeep audio under 25MB or split it429Rate limited or monthly capWait briefly and retry once
bash
export OATDA_API_KEY="${OATDA_API_KEY:-$(cat ~/.oatda/credentials.json 2>/dev/null | jq -r '.profiles[.defaultProfile].apiKey' 2>/dev/null)}" && \
curl -s -X POST "https://oatda.com/api/v1/llm/transcriptions" \
-H "Authorization: Bearer $OATDA_API_KEY" \
-F "provider=openai" \
-F "model=whisper-1" \
-F "file=@meeting.mp3" \
-F "response_format=json"
/api/v1/llm/transcriptionsresponse_format=srt or vtt for subtitleslanguage to improve recognition when source language is knowntranscribe_audiooatda-generate-speech, oatda-translate-audio, oatda-list-models