Sarvam Transcription
Use scripts/transcribe.py for voice notes up to five minutes. It calls
Sarvam's saaras:v3 Speech-to-Text REST API and uses overlapping chunks for
audio longer than the synchronous endpoint's 30-second limit.
Workflow
- Confirm the requested files and preserve their chronological order.
- A request to transcribe with Sarvam authorizes uploading only those files
to Sarvam AI. Otherwise, tell the user that the audio will be sent to
Sarvam before running the script.
- Choose the output:
transcribe: normalized text in the original script (default).
translate: English translation.
verbatim: word-for-word native-script transcript.
translit: Roman-script transliteration.
codemix: Indic words in native script and English words in Latin script.
- Use a known BCP-47 language code when reliable, such as
hi-IN or ml-IN;
otherwise use unknown. Always specify the language for clips under three
seconds, where auto-detection may lack enough signal. For Hinglish, prefer
hi-IN --mode codemix.
- Run one billable pass by default:
python3 <skill-directory>/scripts/transcribe.py \
--language hi-IN --mode transcribe "/absolute/path/to/message.opus"
Multiple files are supported:
python3 <skill-directory>/scripts/transcribe.py \
--language unknown file1.opus file2.opus
- Return the transcript per file. Preserve names, numbers, and uncertainty.
Never repair unclear words by inventing details. Do not summarize unless
the user asks separately — and never via Sarvam LLM APIs; this skill is
speech-to-text only (
saaras:v3).
- When the user requests an English translation, make a second pass:
python3 <skill-directory>/scripts/transcribe.py \
--language hi-IN --mode translate "/absolute/path/to/message.opus"
- Compare names, numbers, and other identifiers across the native transcript
and English pass. Flag every discrepancy and ask the user to verify it from
the audio; never silently select or normalize one version. Each pass is
separately billable.
Authentication
The script reads SARVAM_API_KEY, then macOS Keychain service
sarvam-api-key. Never ask the user to paste the key into chat or commit it.
Never print or store the key.
If no key is configured, direct the user to create one at
https://dashboard.sarvam.ai/.
macOS Keychain (zsh):
read -s "SARVAM_API_KEY?Sarvam API key: "; echo
security add-generic-password -U -a "$USER" -s sarvam-api-key -w "$SARVAM_API_KEY"
unset SARVAM_API_KEY
Elsewhere:
export SARVAM_API_KEY="your-key"
Scope and limits
- Requires Python 3.9+,
ffmpeg, and ffprobe.
- The synchronous REST endpoint rejects audio over 30 seconds. This utility
keeps every overlapping request below that limit.
- Supported formats: WAV, MP3, AAC, AIFF, OGG, OPUS, FLAC, MP4/M4A, AMR, WMA,
and WebM. Not
.oga: WhatsApp exporters (including wacli media download)
often write voice notes as .oga; remux first
(ffmpeg -y -i msg.oga -c copy msg.ogg) then pass the .ogg to this script.
- This utility rejects audio longer than five minutes. For clips just over that
limit, split with ffmpeg into ≤4.5m chunks and run one pass per chunk (same
--language / --mode), then concatenate transcripts in order. Prefer this
over a Batch STT client unless the user needs diarization or timestamps.
Example: ffmpeg -y -i long.m4a -f segment -segment_time 270 -c copy /tmp/chunk_%02d.m4a
- Audio is uploaded to Sarvam and each pass may be billable. Automatic POST
retries are disabled so an ambiguous timeout cannot duplicate cost.
- Raw PCM requires an explicit codec and is intentionally outside this simple
utility's scope.
Sources
1---2name: sarvam-transcribe3description: Transcribes and translates Indian-language audio with Sarvam AI Saaras. Use for Hindi, Malayalam, Hinglish, and other Indic-language audio files—especially OPUS voice notes—when native-script text or English translation is needed. Does not summarize and does not call Sarvam LLMs.4license: MIT5---67# Sarvam Transcription89Use `scripts/transcribe.py` for voice notes up to five minutes. It calls10Sarvam's `saaras:v3` Speech-to-Text REST API and uses overlapping chunks for11audio longer than the synchronous endpoint's 30-second limit.1213## Workflow14151. Confirm the requested files and preserve their chronological order.162. A request to transcribe with Sarvam authorizes uploading only those files17 to Sarvam AI. Otherwise, tell the user that the audio will be sent to18 Sarvam before running the script.193. Choose the output:20 - `transcribe`: normalized text in the original script (default).21 - `translate`: English translation.22 - `verbatim`: word-for-word native-script transcript.23 - `translit`: Roman-script transliteration.24 - `codemix`: Indic words in native script and English words in Latin script.254. Use a known BCP-47 language code when reliable, such as `hi-IN` or `ml-IN`;26 otherwise use `unknown`. Always specify the language for clips under three27 seconds, where auto-detection may lack enough signal. For Hinglish, prefer28 `hi-IN --mode codemix`.295. Run one billable pass by default:3031```bash32python3 <skill-directory>/scripts/transcribe.py \33 --language hi-IN --mode transcribe "/absolute/path/to/message.opus"34```3536Multiple files are supported:3738```bash39python3 <skill-directory>/scripts/transcribe.py \40 --language unknown file1.opus file2.opus41```42436. Return the transcript per file. Preserve names, numbers, and uncertainty.44 Never repair unclear words by inventing details. Do not summarize unless45 the user asks separately — and never via Sarvam LLM APIs; this skill is46 speech-to-text only (`saaras:v3`).477. When the user requests an English translation, make a second pass:4849```bash50python3 <skill-directory>/scripts/transcribe.py \51 --language hi-IN --mode translate "/absolute/path/to/message.opus"52```53548. Compare names, numbers, and other identifiers across the native transcript55 and English pass. Flag every discrepancy and ask the user to verify it from56 the audio; never silently select or normalize one version. Each pass is57 separately billable.5859## Authentication6061The script reads `SARVAM_API_KEY`, then macOS Keychain service62`sarvam-api-key`. Never ask the user to paste the key into chat or commit it.63Never print or store the key.6465If no key is configured, direct the user to create one at66https://dashboard.sarvam.ai/.6768macOS Keychain (zsh):6970```bash71read -s "SARVAM_API_KEY?Sarvam API key: "; echo72security add-generic-password -U -a "$USER" -s sarvam-api-key -w "$SARVAM_API_KEY"73unset SARVAM_API_KEY74```7576Elsewhere:7778```bash79export SARVAM_API_KEY="your-key"80```8182## Scope and limits8384- Requires Python 3.9+, `ffmpeg`, and `ffprobe`.85- The synchronous REST endpoint rejects audio over 30 seconds. This utility86 keeps every overlapping request below that limit.87- Supported formats: WAV, MP3, AAC, AIFF, OGG, OPUS, FLAC, MP4/M4A, AMR, WMA,88 and WebM. **Not `.oga`:** WhatsApp exporters (including `wacli media download`)89 often write voice notes as `.oga`; remux first90 (`ffmpeg -y -i msg.oga -c copy msg.ogg`) then pass the `.ogg` to this script.91- This utility rejects audio longer than five minutes. For clips just over that92 limit, split with ffmpeg into ≤4.5m chunks and run one pass per chunk (same93 `--language` / `--mode`), then concatenate transcripts in order. Prefer this94 over a Batch STT client unless the user needs diarization or timestamps.95 Example: `ffmpeg -y -i long.m4a -f segment -segment_time 270 -c copy /tmp/chunk_%02d.m4a`96- Audio is uploaded to Sarvam and each pass may be billable. Automatic POST97 retries are disabled so an ambiguous timeout cannot duplicate cost.98- Raw PCM requires an explicit codec and is intentionally outside this simple99 utility's scope.100101## Sources102103- REST endpoint: https://docs.sarvam.ai/api-reference/speech-to-text/transcribe104- Quickstart: https://docs.sarvam.ai/api/getting-started/quickstart105- API selection: https://docs.sarvam.ai/api/api-guides-tutorials/speech-to-text/which-api-to-use