clai mascot

Hi! I'm clai!

Your AI-powered shell command generator. Describe what you want to do in plain English, and I'll give you the exact command. No more memorizing obscure flags or searching through man pages.

Features

Natural Language to Shell Commands

Just describe what you need in plain English and get the exact command.

Multiple AI Providers

Choose from OpenAI, Anthropic (Claude), Google Gemini, or xAI (Grok).

Cross-Platform

Works seamlessly on Windows, macOS, and Linux.

Smart Context

Automatically detects your OS and shell for accurate commands.

Multiple Options

Get several command alternatives to choose from.

Risk Indicators

Commands are clearly marked as low, medium, or high risk.

Installation

Prerequisites: Node.js 18 or higher and npm.

# Clone the repository
git clone https://github.com/domzilla/clai
cd clai

# Install dependencies
npm install

# Build the project
npm run build

# Link globally to use from anywhere
npm link

After installation, run clai for the first time and the setup wizard will guide you through configuring your AI provider.

Quick Start

# First run will prompt for API key setup
clai "list all files larger than 100MB"

The setup wizard will guide you through:

Usage

# Generate a command from a description
clai "find all duplicate files in current directory"

# Use a specific provider
clai -p anthropic "compress all images in this folder"

# Use a specific model
clai -m gpt-4.1 "show disk usage by folder"

# Get more command options (default is 3)
clai -n 5 "list running processes sorted by memory"

# Verbose mode - show detailed explanations
clai -v "set up a git pre-commit hook"

# Quiet mode - output command only, no interactive menu
clai -q "count lines of code"

Command Options

Option Description
-m, --model <model> Override the default AI model
-p, --provider <provider> Override the default AI provider
-n, --count <number> Number of command options to generate
-v, --verbose Show detailed command explanations
-q, --quiet Output only the command (no menu)
--raw Output raw LLM response (for debugging)

Supported Providers

Provider Default Model
OpenAI gpt-4.1-mini
Anthropic claude-sonnet-4-5
Google Gemini gemini-2.5-flash
xAI (Grok) grok-4

Models are fetched dynamically from provider APIs when possible, with fallback to a curated list.

Get Your API Keys

Shell Integration

For the ultimate experience, set up shell integration. This lets you type a description directly in your terminal and press a key to transform it into a command.

How It Works

  1. Type a description: list files by size
  2. Press: Alt+a
  3. Select a command from the menu
  4. The command appears in your prompt, ready to execute
  5. Press Enter to run it
# Auto-detect your shell
clai shell

# Or specify a shell
clai shell zsh
clai shell bash
clai shell fish
clai shell powershell

Examples

File Operations

clai "rename all .jpeg files to .jpg"
clai "find files modified in the last 24 hours"
clai "delete all node_modules folders recursively"
clai "compress this folder into a zip file"

System Information

clai "show top 10 processes by CPU usage"
clai "display disk space usage"
clai "list all open network ports"
clai "find which process is using port 3000"

Git Operations

clai "undo the last commit but keep changes"
clai "show commits from last week"
clai "create a branch from a specific commit"
clai "squash the last 3 commits"

Text Processing

clai "count occurrences of 'error' in all log files"
clai "replace tabs with spaces in all .py files"
clai "extract email addresses from a file"
clai "sort a CSV file by the second column"

Risk Levels

Every generated command includes a risk indicator:

Risk Description Examples
Low Read-only operations, safe to run ls, cat, grep
Medium Creates or modifies files mkdir, touch, chmod
High Potentially destructive rm, rm -rf, sudo

For high-risk commands, clai prefers safer alternatives when possible.