Skip to content

DemonKingSwarn/sarvam-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Sarvam CLI

Version License

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.

πŸš€ Why Sarvam CLI?

  • 🧠 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

πŸ“¦ Installation

Prerequisites

  • Node.js 18+
  • npm or bun

Quick Install

# 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 --help

Or use bun:

bun build --compile ./bundle/sarvam.js --outfile sarvam
./sarvam --help

πŸ” Authentication

Sarvam 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"

πŸš€ Getting Started

Interactive Mode

./sarvam

Non-Interactive Mode (Headless)

# 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

Command Options

-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

πŸ“‹ Key Features

Code Understanding & Generation

  • Query and edit large codebases
  • Debug issues with natural language
  • Generate code and explanations

Automation

  • Run shell commands
  • Read, write, and edit files
  • Search and grep through codebases
  • List directory contents

Tool Usage

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

πŸ“š Documentation

For more details, see the docs directory:

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

Apache License 2.0 - See LICENSE for details.


Built with ❀️ using Sarvam AI

About

An open-source AI agent that brings the power of Sarvam directly into your terminal.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors