Speech-to-Text
Accurate transcription built for Indian accents, dialects, and real-world audio with speaker diarisation.
Text-to-Speech
Natural, expressive voices in 10 Indian languages and English, for conversational agents, dubbing, and accessibility.
Language model
Multilingual model with support for Indian languages, for text generation and reasoning.
Translation
High-quality translation across 12+ Indian languages, optimised for conversational and enterprise content.
Install the provider
Add sarvam-ai-sdk and pin the matching AI SDK major version with ai@7.
Add your API key
Set SARVAM_API_KEY in a .env file with a key from indus.sarvam.ai. The provider reads it automatically.
Call the standard AI SDK functions
Import sarvam from sarvam-ai-sdk and pass it to generateText, generateSpeech, or transcribe.
npm install sarvam-ai-sdk ai@7
import { sarvam } from "sarvam-ai-sdk"; import { generateText } from "ai"; const { text } = await generateText({ model: sarvam("sarvam-105b"), prompt: "Translate this to malayalam: 'Keep cooking, guys'", }); console.log(text); // പാചകം തുടരൂ, സുഹൃത്തുക്കളേ
Pin the ai major version
sarvam-ai-sdk 0.4.x tracks AI SDK 7. Installing ai@latest can pull in an incompatible major version and cause type and runtime errors.
Raise maxOutputTokens for long answers
Output length is capped by default. Check that finishReason is not "length" to catch responses that stop mid-sentence.
Use Output.object for structured output
Prefer generateText with Output.object. generateObject still works but is deprecated in the AI SDK.
Send text through the right field
Translation, transliteration, and language identification act only on prompt and user messages. System and assistant messages pass through unchanged.
Full-stack
Full-stack apps
Add chat, text to speech, and speech to text to Next.js and other TypeScript apps without switching SDKs.
Tool-calling
Tool-calling agents
Build agents with function calling and structured output through the standard AI SDK interfaces.
Multilingual
Multilingual voice features
Combine speech to text, translation, and text to speech behind one provider for products in Indian languages.
Ready to build? Follow the Vercel AI SDK guide in the Sarvam docs.
Ready to build?
Follow the Vercel AI SDK guide in the Sarvam docs.