Sarvam CLI is an open-source AI agent that brings the power of Sarvam AI's language models directly into your terminal. This is a fork of Gemini CLI, modified to work with Sarvam AI's API.
- π§ Powerful Sarvam models: Access to Sarvam-30B and Sarvam-105B models
- π§ Built-in tools: File operations, shell commands, web fetching, code search
- π Extensible: MCP (Model Context Protocol) support for custom integrations
- π» Terminal-first: Designed for developers who live in the command line
- π‘οΈ Open source: Apache 2.0 licensed
- Node.js 18+
- npm or bun
# Clone the repository
git clone https://github.com/swarn/sarvam-cli.git
cd sarvam-cli
# Install dependencies
npm install
# Build
npm run bundle
# Run
./sarvam --helpOr use bun:
bun build --compile ./bundle/sarvam.js --outfile sarvam
./sarvam --helpSarvam CLI uses Sarvam AI's API. Get your API key from https://sarvam.ai
# Set your Sarvam API key
export SARVAM_API_KEY="your-api-key"
# Optionally set the model (defaults to sarvam-30b)
export SARVAM_MODEL="sarvam-30b"
# Or use the base URL for custom endpoints
export SARVAM_BASE_URL="https://api.sarvam.ai/v1"You can also pass the API key directly:
SARVAM_API_KEY="your-key" ./sarvam -p "your prompt"./sarvam# Simple prompt
./sarvam -p "Hello, how are you?"
# With specific model
./sarvam -m sarvam-30b -p "What is 2+2?"
# With sandbox disabled (for file operations)
./sarvam -p "list files" --sandbox=false-p, --prompt Run in non-interactive (headless) mode
-m, --model Model to use (sarvam-30b, sarvam-105b)
-s, --sandbox Run in sandbox mode (default: true)
-y, --yolo Automatically accept all actions
-d, --debug Run in debug mode
-o, --output-format Output format: text, json, stream-json
-v, --version Show version number
-h, --help Show help- Query and edit large codebases
- Debug issues with natural language
- Generate code and explanations
- Run shell commands
- Read, write, and edit files
- Search and grep through codebases
- List directory contents
Tools are automatically available. Simply ask in natural language:
- "run
ls -la" - Execute shell commands - "read package.json" - Read file contents
- "write hello.txt with 'Hello World'" - Create/write files
- "list files in src" - List directory contents
- "search for function main" - Search in files
For more details, see the docs directory:
Contributions are welcome! Please feel free to submit a Pull Request.
Apache License 2.0 - See LICENSE for details.
Built with β€οΈ using Sarvam AI