Chat Completions Quickstart

Sarvam AI offers a LLM model:

Features

Hybrid Thinking Mode
  • Supports both “think” and “non-think” modes
  • Think mode for complex logical reasoning
  • Non-think mode for efficient conversations
  • Ideal for mathematical and coding tasks
Advanced Indic Skills
  • Post-trained on Indian languages
  • Native English proficiency
  • Authentic Indian cultural values
  • Rich understanding of local context
Superior Reasoning Capabilities
  • Outperforms similar-sized models
  • Strong performance on coding tasks
  • Excellent mathematical reasoning
  • Advanced problem-solving abilities
Seamless Chatting Experience
  • Full Indic script support
  • Romanized language support
  • Multilingual conversation handling
  • Natural language understanding

Code Examples

1from sarvamai import SarvamAI
2
3client = SarvamAI(
4 api_subscription_key="YOUR_SARVAM_API_KEY",
5)
6response = client.chat.completions(messages=[
7 {"role": "user", "content": "Hey, what is the capital of India?"}
8])
9print(response)
Key Considerations
  • Maximum context length: 4096 8192
  • Temperature range: 0 to 2

    • Non-thinking mode: 0.2 (recommended)
    • Thinking mode: 0.5 (recommended)
  • Top-p range: 0 to 1
  • Reasoning effort options: low, medium, high

    • Setting any value enables thinking mode
    • Higher values increase reasoning depth
  • Enable wiki_grounding for factual queries

Check out our detailed API Reference to explore Chat Completion and all available options.