Sarvam CLI
Agent-style terminal interface for Sarvam AI.
Sarvam CLI brings chat, voice, translation, transcription, language detection, and speech generation into a clean terminal workflow. It is designed to feel closer to a modern coding agent CLI than a thin API wrapper.
Why
Sarvam has strong multilingual and speech APIs, but quick experimentation usually means writing setup code first. Sarvam CLI removes that setup friction:
- talk to Sarvam directly from the terminal
- test speech and translation flows without boilerplate
- switch between text, voice, and file-based workflows quickly
- keep per-user config local and simple
Highlights
- Guided home screen with onboarding
- Interactive chat workspace with boxed composer flow
- Voice chat using microphone input and spoken replies
- Speech-to-text for audio files
- Translation for file or stdin input
- Text-to-speech with file output
- Language detection
- Per-user config with env-var overrides
Installation
Basic install:
pip install sarvam-cli
With voice support:
pip install "sarvam-cli[voice]"
For local development from this repo:
python -m venv .venv
source .venv/bin/activate
pip install -e .
Quick Start
- Set your API key:
sarvam config set-api-key
- Open the CLI:
sarvam
- Start chatting:
sarvam chat
Configuration
Sarvam CLI stores user config at:
~/.config/sarvam/config.json
Useful commands:
sarvam config set-api-key
sarvam config set-base-url https://api.sarvam.ai
sarvam config show
sarvam config path
Environment variables are also supported:
export SARVAM_API_KEY=your_api_key
export SARVAM_BASE_URL=https://api.sarvam.ai
For one-off overrides:
sarvam --api-key your_api_key chat "Hello"
sarvam --base-url https://api.sarvam.ai chat "Hello"
You can override the config directory too:
export SARVAM_CONFIG_DIR=/custom/path
Command Overview
Open the landing screen:
sarvam
Show guided help:
sarvam help
Interactive chat:
sarvam chat
sarvam chat "Explain transformers simply"
Voice chat:
sarvam chat --voice --lang hi-IN
Translate text:
sarvam translate notes.txt --to kn-IN --from-lang en-IN
cat notes.txt | sarvam translate --to hi-IN
Transcribe audio:
sarvam transcribe meeting.wav
Generate speech:
sarvam speak "Welcome to Sarvam AI" --lang en-IN --output speech.wav
sarvam speak "Namaste" --lang hi-IN --play
Detect language:
sarvam detect-language notes.txt
Chat UX
sarvam chat opens a dedicated terminal workspace rather than a plain prompt loop.
Inside chat:
/help Show session commands
/stats Show session stats
/clear Reset conversation history
/exit Leave the session
Voice Flow
Microphone
-> Speech-to-Text
-> Sarvam Chat
-> Text-to-Speech
-> Speaker
Common Examples
Translate English to Hindi:
sarvam translate ideas.txt --to hi-IN --from-lang en-IN
Chat in the terminal:
sarvam chat
Start a voice session in Hindi:
sarvam chat --voice --lang hi-IN
Generate spoken audio:
sarvam speak "This is a test" --lang en-IN --output test.wav
Check current config:
sarvam config show
Development
Run the CLI from source without installing the console script:
PYTHONPATH=src python -m sarvam_cli
PYTHONPATH=src python -m sarvam_cli help
PYTHONPATH=src python -m sarvam_cli chat
Run tests:
PYTHONPATH=src python -m unittest -v tests.test_e2e
Build release artifacts:
pip install -e ".[release]"
python -m build
python -m twine check dist/*
For full release instructions, see RELEASING.md.
Project Structure
src/sarvam_cli/cli.py Command routing and user flows
src/sarvam_cli/api.py Sarvam API client
src/sarvam_cli/ui.py Terminal UX and rendering
src/sarvam_cli/config.py User config handling
src/sarvam_cli/audio.py Microphone and playback helpers
tests/test_e2e.py End-to-end CLI tests
Notes
- Voice features require optional audio dependencies and working local audio hardware.
- The CLI supports per-user configuration and is suitable for installed users on the same machine without sharing credentials.
- If you exposed a real API key publicly while testing, rotate it.
Metadata
Release files for sarvam-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sarvam_cli-0.1.0.tar.gz | 18.4 kB | Without provenance | Details for sarvam_cli-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sarvam_cli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sarvam_cli-0.1.0-py3-none-any.whl |
Total release size: 33.3 kB
Release files / sarvam_cli-0.1.0.tar.gz
| Download URL | sarvam_cli-0.1.0.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2077e853093366193d2c2db0cd698122a3371f7219b6a2b66cb1984b10c1281
|
|
BLAKE2b-256 checksum How to use checksums |
a1a8df8426e22f39b26dc4759034cb74707ddd3213e407273443a5303cfc6ee0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / sarvam_cli-0.1.0-py3-none-any.whl
| Download URL | sarvam_cli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a698978806ca30dd4fe4886a0d3d111a6f5663cc6c5d372fb0cf9737edaf426
|
|
BLAKE2b-256 checksum How to use checksums |
d7baf8bf5f984e7bccea0d02c1e770d83f4b0bb04fd8ac0eba9b7993bca82f6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for sarvam-cli 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.