> For clean Markdown of any page, append `.md` to the page URL. > For a complete documentation index, see https://docs.sarvam.ai/llms.txt. > For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server. # FAQs > Frequently asked questions about Sarvam AI speech-to-text services. Get answers about models, pricing, language support, audio formats, and implementation best practices. # Frequently Asked Questions Find answers to common questions about our speech-to-text services ## General Questions #### What audio formats are supported? **REST and Batch APIs** support a wide range of audio formats including: * WAV * MP3 * M4A * AAC * OGG * FLAC * WebM * PCM (pcm\_s16le, pcm\_l16, pcm\_raw) **WebSocket/Streaming APIs** only support: * WAV * Raw PCM (pcm\_s16le, pcm\_l16, pcm\_raw) For optimal results, we recommend: * Sample rate: 16kHz or higher * Bit depth: 16-bit * Channels: Mono or Stereo #### What languages are supported? Our models support English and multiple Indian languages: ### Indian Languages * Hindi * English (Indian) * Bengali * Tamil * Telugu * Kannada * Malayalam * Marathi * Gujarati * Punjabi * Odia `saaras:v3` extends coverage to 23 languages total (22 Indian languages + English), adding Assamese, Urdu, Nepali, Konkani, Kashmiri, Sindhi, Sanskrit, Santali, Manipuri, Bodo, Maithili, and Dogri. Check our [models page](/api/getting-started/models) for the complete list and specific model capabilities. #### What is the maximum duration? The limits vary by API endpoint: ### REST API * Maximum duration: 30 seconds per request ### Batch API * Maximum duration: 2 hours per file * Maximum files per job: 20 ### WebSocket API (Streaming) * Continuous streaming with chunked audio, no duration limit * Concurrency limits apply per plan (see [Rate Limits](/api/getting-started/ratelimits)) For audio longer than 30 seconds, use the [Batch API](/api/api-guides-tutorials/speech-to-text/batch-api). For files longer than 2 hours, we recommend: 1. Splitting into smaller segments 2. Contacting support for custom solutions #### How accurate is the transcription? Accuracy varies based on several factors: ### Typical Accuracy Rates * Clear speech, minimal background noise: 95-98% * Multiple speakers, moderate noise: 90-95% * Heavy accent or background noise: 85-90% Factors affecting accuracy: * Audio quality * Background noise * Speaker accent * Speaking speed * Domain-specific terminology Use our [interactive API reference](/api-reference/speech-to-text/transcribe) to test with your specific audio. ## Technical Questions #### How does speaker diarization work? Speaker diarization identifies and labels different speakers in the audio: 1. **Process**: * Voice activity detection * Speaker segmentation * Speaker clustering * Speaker labeling 2. **Usage** (via Batch API): ```python from sarvamai import SarvamAI client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY") # Speaker diarization is available through the Batch API # See: https://docs.sarvam.ai/api/speech-to-text/batch job = client.speech_to_text_job.create_job( model="saaras:v4", mode="transcribe", with_diarization=True, ) job.upload_files(file_paths=["audio.mp3"]) job.start() job.wait_until_complete() job.download_outputs(output_dir="./output") ``` 3. **Output**: ```json { "segments": [ { "speaker": "Speaker 1", "text": "Hello, how are you?", "start": 0.0, "end": 1.5 }, { "speaker": "Speaker 2", "text": "I'm doing well, thanks!", "start": 1.8, "end": 3.2 } ] } ``` #### What are the rate limits? Rate limits are applied per account based on your subscription plan and vary by endpoint. For the real-time REST API: | Plan | Rate Limit | | -------------- | ------------------ | | **Starter** | 60 requests/min | | **Pro** | 100 requests/min | | **Business** | 4,000 requests/min | | **Enterprise** | Custom limits | Batch and WebSocket Streaming have their own, different limits. See the per-endpoint tables on the [Credits & Rate Limits](/api/getting-started/ratelimits) page. ### Duration Limits * **REST API**: Max 30 seconds of audio per request * **Batch API**: Up to 2 hours per file, 20 files per job * **Streaming API**: Continuous (chunked) streaming; concurrency limits per plan For batch endpoints, avoid tight polling loops, poll no faster than your plan's rate limit allows (e.g. every 3 seconds on Starter's 20 req/min). The SDK's `wait_until_complete()` already polls at a safe 5-second interval by default. View the full [Credits & Rate Limits](/api/getting-started/ratelimits) page for details on HTTP headers, error handling, and upgrade paths. #### How do I handle errors? Common errors and solutions: ### 1. Authentication Errors (403) ```json { "error": { "code": "invalid_api_key_error", "message": "API key is invalid or expired" } } ``` Solution: Check API key validity and proper configuration. **Note:** Sarvam returns HTTP `403` (not `401`) for invalid/missing API keys. See the [Authentication](/api-reference/authentication) page. ### 2. Rate Limit / Quota Errors (429) ```json { "error": { "code": "insufficient_quota_error", "message": "API quota exceeded" } } ``` Solution: Implement exponential backoff or upgrade plan. A `429` with `rate_limit_exceeded_error` means too many requests; `insufficient_quota_error` means credits are exhausted. See [Errors & Troubleshooting](/api/getting-started/errors-troubleshooting). ### 3. Invalid Input (400) ```json { "error": { "code": "invalid_request_error", "message": "Unsupported audio format" } } ``` Solution: Check supported formats and requirements ### 4. Failed to read the file (400) ```json { "error": { "message": "Failed to read the file, please check the audio format.", "code": "invalid_request_error" } } ``` This almost always means the uploaded bytes are not a readable audio file, not that the format is unsupported. Common causes: * **Empty or zero-length file**: the upload contains no bytes, or a buffer of all zeros * **Empty WebM blob from a browser recorder**: `MediaRecorder` produced a header with no audio frames (see "How do I record audio in the browser?" below) * **Junk or placeholder bytes**: the payload isn't a real audio container * **Truncated or incomplete container**: the file was cut off during recording, download, or copy * **Passing a filename string instead of a file object**: use `file=open("audio.wav", "rb")` in Python, not `file="audio.wav"` Solution: before uploading, verify the file exists, its size is greater than 0, and you're passing a file handle/stream (not a path string). See our [error handling guide](/api/getting-started/errors-troubleshooting) for more details. #### How do I record audio in the browser and transcribe it? All the Node.js examples in these docs read audio with `fs.createReadStream(...)`, which doesn't exist in the browser. To transcribe microphone audio from a web page, record with `MediaRecorder` and upload the resulting blob. The most common mistake is uploading an **empty WebM blob** (a container header with no audio frames), which the API rejects with `"Failed to read the file, please check the audio format."` The recipe below avoids that by stopping the recorder cleanly, waiting for the final `dataavailable` event, and checking `blob.size > 0` before uploading: ```javascript async function recordAndTranscribe(durationMs = 5000) { // 1. Capture the microphone const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); // 2. Pick a supported mimeType (WebM/Opus is widely supported and accepted by the API) const mimeType = MediaRecorder.isTypeSupported("audio/webm;codecs=opus") ? "audio/webm;codecs=opus" : "audio/webm"; const recorder = new MediaRecorder(stream, { mimeType }); const chunks = []; recorder.ondataavailable = (event) => { if (event.data.size > 0) chunks.push(event.data); }; // 3. Stop cleanly: the final dataavailable fires before "stop" resolves const stopped = new Promise((resolve) => (recorder.onstop = resolve)); recorder.start(); setTimeout(() => recorder.stop(), durationMs); await stopped; stream.getTracks().forEach((track) => track.stop()); // 4. Never upload an empty recording const blob = new Blob(chunks, { type: mimeType }); if (blob.size === 0) { throw new Error("Recording is empty, no audio frames were captured."); } // 5. Upload to the Speech-to-Text API const formData = new FormData(); formData.append("file", blob, "recording.webm"); formData.append("model", "saaras:v4"); formData.append("mode", "transcribe"); const response = await fetch("https://api.sarvam.ai/speech-to-text", { method: "POST", headers: { "api-subscription-key": SARVAM_API_KEY }, body: formData, }); return await response.json(); } ``` Pre-flight checklist before any upload: * The recording/file exists and `size > 0` * You're sending the blob/file object, not a path or filename string * Audio longer than 30 seconds goes to the [Batch API](/api/api-guides-tutorials/speech-to-text/batch-api) instead of the sync REST endpoint > **Warning** > > Don't ship your API key in client-side code. In production, upload the recording to your own backend and call the Sarvam API from there. #### How do I optimize for real-time transcription? Tips for optimal real-time performance: 1. **Audio Settings** ```javascript const config = { sampleRate: 16000, encoding: 'LINEAR16', channels: 1 } ``` 2. **Chunk Size** * Optimal: 100ms - 500ms chunks * Balance between latency and accuracy 3. **WebSocket Connection** ```javascript const ws = new WebSocket('wss://api.sarvam.ai/v1/stt/stream') ws.binaryType = 'arraybuffer' ``` 4. **Error Handling** ```javascript ws.onerror = (error) => { console.error('WebSocket Error:', error) // Implement reconnection logic } ``` View our [real-time streaming guide](/api/api-guides-tutorials/speech-to-text/streaming-api) for detailed examples. ## Billing & Support #### How is usage calculated? Usage is calculated based on: 1. **Audio Duration** * Rounded up to the nearest second * Minimum charge: 1 second 2. **Features Used** * Base transcription * Speaker diarization (+20%) * Language detection (+10%) * Chunk-level timestamps (included; **word-level timestamps are not supported**) Example calculation: ``` 5 minutes audio × Base rate + Speaker diarization (20%) = Total cost ``` #### How do I check my credit usage? You can check your credit usage directly on the [Billing page](https://indus.sarvam.ai/billing) in your Sarvam dashboard. It shows your total credits, how much has been consumed, and the remaining balance. #### How do I get support? Multiple support channels available: 1. **Documentation** * [API Reference](/api-reference/speech-to-text/transcribe) * [Guides](/api/getting-started/quickstart) * [Examples](https://github.com/sarvamai/sarvam-ai-cookbook) 2. **Direct Support** * Email: [support@sarvam.ai](mailto:support@sarvam.ai) * Enterprise: Dedicated support manager 3. **Builder Community** * [Join our Discord](https://discord.com/invite/5rAsykttcs) for early access to new releases, biweekly challenges, office hours with the team, and India's AI builder community. ## Still Have Questions? ### Can't find what you're looking for? Our team is here to help! Reach out via email, or join our Discord to connect with the builder community. Email Support Join Discord > Frequently asked questions about Sarvam AI speech-to-text services. Get answers about models, pricing, language support, audio formats, and implementation best practices.