Sarvam AI
Google DeepMind

Gemma 4 31B

Process images and text with Google DeepMind’s 31B model, served by Sarvam for conversation and tool use. Direct answers suit workflows that do not need a separate reasoning trace.

  • Vision
  • Tool calling
  • Chat
  • Extraction

Best suited for

  1. 01

    Visual document extraction

    Combine page images and text instructions to extract fields, interpret layouts and prepare information for downstream systems.

  2. 02

    High-volume conversations

    Generate direct responses for chat and support workflows without a separate reasoning step.

  3. 03

    Image-grounded tool use

    Use visual context alongside function calling to turn information from images into application actions.

Build with the Sarvam SDK

pip install --upgrade sarvamaiV2 · Sarvam SDK · Streaming
import osfrom sarvamai import SarvamAI​client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"])​stream = client.chat.completions_v2(    model="gemma4",    messages=[{"role": "user", "content": "Explain why time to first token matters for a chat application briefly."}],    max_tokens=8000,    stream=True,)​for chunk in stream:    if not chunk.choices:        continue    text = chunk.choices[0].delta.content    if text:        print(text, end="", flush=True)
  1. 01 Install the Sarvam SDK

    Install sarvamai for Python or JavaScript. Store your key in SARVAM_API_KEY.

  2. 02 Choose your model

    Use model ID gemma4. The SDK calls https://api.sarvam.ai/v2 for this example.

    V2 Chat Completions. Thinking is off by default, so this example returns a direct answer.

  3. 03 Validate your application

    Check output quality, supported parameters and tool behaviour on representative requests before moving production traffic.

Model API Reference

Frequently Asked
Questions

Explore other models

View catalogue

From model choice to production. Bring your workload, traffic expectations and latency targets. Build on Sarvam’s serving stack in India.