For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
CommunityAPI StatusAPI PricingSign Up
DocumentationAPI ReferencesCookbookIntegrationDeveloper Tools
DocumentationAPI ReferencesCookbookIntegrationDeveloper Tools
  • Getting Started
    • Welcome
    • Quickstart
    • SDKs & Libraries
    • Building for Indian Languages
    • Models
    • Credits & Rate Limits
    • Errors & Troubleshooting
    • Talk to us
    • Pricing
    • Changelog
  • API Guides & Tutorials
LogoLogo
CommunityAPI StatusAPI PricingSign Up
On this page
  • Sarvam AI APIs
  • Next Steps
Getting Started

Developer Quickstart

||View as Markdown|
Was this page helpful?
Previous

Libraries & SDKs

Official Python and JavaScript clients for the Sarvam AI API — with async, retries, timeouts, streaming, and typed errors.

Next
Built with

Get started with Sarvam APIs in under a minute using just a few lines of code

To get started: (1) Create an API Key at dashboard.sarvam.ai, (2) Set Up Your Environment by exporting SARVAM_API_KEY, (3) Install the SDK via pip install -U sarvamai or npm install sarvamai@latest, and (4) Make Your First API Call using the SDK or REST API.

1

Create an API Key

Visit the Sarvam AI dashboard and create a new API key. Keep this key secure - you’ll need it to authenticate your requests.

2

Set Up Your Environment

Export your API key as an environment variable:

$export SARVAM_API_KEY="YOUR_SARVAM_API_KEY"
3

Install the SDK

Choose your preferred language and install our SDK:

$pip install -U sarvamai
4

Make Your First API Call

1from sarvamai import SarvamAI
2
3client = SarvamAI(
4 api_subscription_key="YOUR_SARVAM_API_KEY",
5)
6
7response = client.text.translate(
8 input="Hi, My Name is Vinayak.",
9 source_language_code="auto",
10 target_language_code="gu-IN",
11 speaker_gender="Male"
12)
13
14print(response)

Quick Tips: - Store your API key securely and never commit it to version control - Use environment variables or a secure configuration manager

Sarvam AI APIs

Speech to Text
Text to Speech
Text Translation
Chat Completion

Saaras v3 is our latest speech recognition model. It supports multiple output modes — transcribe (default, original language), translate (to English), verbatim (word-for-word), translit (romanization), and codemix (mixed script).

1from sarvamai import SarvamAI
2
3client = SarvamAI(
4 api_subscription_key="YOUR_SARVAM_API_KEY",
5)
6
7response = client.speech_to_text.transcribe(
8 file=open("audio.wav", "rb"),
9 model="saaras:v3",
10 mode="transcribe", # or "translate", "verbatim", "translit", "codemix"
11)
12
13print(response)

Use transcribe for same-language output, translate to convert audio to English text, or verbatim/translit/codemix for specialized formatting. mode defaults to transcribe when omitted.

Next Steps

1

Learn More about our Models

Explore Sarvam AI’s specialized Models for Indian languages - from speech processing to text generation and translation.

2

Explore API Capabilities

Discover our comprehensive API Capabilities for speech technologies, text processing, and analytics.

3

View Examples

Browse our Cookbook for some inspiration and step-by-step tutorials.

4

Discord

Join our Discord community for support, discussions, and updates.