sarvamai/skills

chat

Write correct Sarvam AI chat-completion code (Sarvam-105B, Sarvam-30B) — OpenAI-compatible API, streaming, reasoning mode, and the content=None gotcha. Use…

First seen Feb 8, 2026

Installation

$ npx skills add https://github.com/sarvamai/skills
Feature your product here Skill page unit · reach builders installing agent skills View pricing →

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from sarvamai/skills.

npx skills add https://github.com/sarvamai/skills

Browse all from sarvamai/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 71
License LICENSE
Default branch main
Open issues 2
Status Active

History

  1. First seen on skills.sh
  2. First recorded snapshot · 119 installs

SKILL.md

Chat Completions — Sarvam AI

Live in-chat completion → [sarvam-mcp](../sarvam-mcp) (sarvamtoolsllm_complete). This skill = SDK code.

[!IMPORTANT]
Auth: api-subscription-key header — NOT Authorization: Bearer. Base URL: https://api.sarvam.ai/v1

Models

Model Context Best For
sarvam-105b 128K Complex reasoning, coding, agentic workflows
sarvam-30b 64K Real-time chat, voice agents, conversational AI

The fixed-context variants (sarvam-105b-32k, sarvam-30b-16k) are retired — base models serve their full context window directly.

Quick Start (Python)

from sarvamai import SarvamAI
client = SarvamAI()

response = client.chat.completions(
    model="sarvam-30b",
    messages=[{"role": "user", "content": "भारत की राजधानी क्या है?"}]
)
print(response.choices[0].message.content)

Streaming (Python)

for chunk in client.chat.completions(
    model="sarvam-30b",
    messages=[{"role": "user", "content": "Write a poem about India"}],
    stream=True
):
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Quick Start (JavaScript/TypeScript)

import { SarvamAIClient } from "sarvamai";

const client = new SarvamAIClient({ apiSubscriptionKey: "YOUR_SARVAM_API_KEY" });

const response = await client.chat.completions({
    model: "sarvam-30b",
    messages: [{ role: "user", content: "भारत की राजधानी क्या है?" }]
});
console.log(response.choices[0].message.content);

OpenAI-Compatible (both languages)

from openai import OpenAI
client = OpenAI(api_key="your-key", base_url="https://api.sarvam.ai/v1")
response = client.chat.completions.create(model="sarvam-30b", messages=[...])

Gotchas

Gotcha Detail
SDK method Python: client.chat.completions(...), JS: client.chat.completions({...}) — no .create() in either. OpenAI SDK uses .create() as usual.
JS constructor new SarvamAIClient({ apiSubscriptionKey: "..." }) — NOT SarvamAI(). Key is passed explicitly.
content can be None Models produce reasoningcontent before content. If maxtokens is too low, reasoning consumes the budget, finishreason is "length", and content is None. Omit maxtokens, set 500+, or disable reasoning with reasoningeffort=None. Check reasoningcontent as fallback.
reasoning_effort Thinking is on by default at "low". Values: `"low"\ "medium"\ "high", or None to disable reasoning entirely. NOT thinking=True`. Reasoning tokens count toward completion tokens and billing.

Full Docs

Fetch detailed parameters, tool calling, streaming, and examples from: