Documentation
On This Page

Documentation

Everything you need to install, configure, and get the most out of ShellAI.

Installation

ShellAI ships as a single self-contained binary. No Node, no Python, no runtime to manage.

Quick install (recommended)

$ curl -fsSL https://shellai.dev/install.sh | sh

Homebrew (macOS)

$ brew install shellai/tap/shellai

Manual download

Download the latest release from GitHub Releases for your platform (macOS Intel/ARM, Linux amd64/arm64, Windows amd64), then move the binary onto your $PATH.

Supported platforms
macOS (Intel & Apple Silicon) · Linux (amd64, arm64) · Windows (amd64)

Quick start

After installation, verify it works and make your first request:

$ shellai --version
$ shellai ask "find all files modified in the last 24 hours"

On first run, ShellAI auto-detects your API keys from environment variables, or prompts you to configure a provider.

Configuration

ShellAI stores config in ~/.shellai/config.yaml. It's created automatically on first run.

# ~/.shellai/config.yaml
provider: anthropic        # openai | anthropic | gemini | ollama
model: claude-sonnet-4-20250514

# Environment (dev = default, prod = stricter safety)
mode: dev

# Chat settings
chat:
  max_history: 100         # messages per session

# LLM reasoning effort (for supported providers)
llm:
  reasoning_effort: medium # low | medium | high

# Ollama (only needed if provider = ollama)
ollama:
  host: http://localhost:11434
  model: llama3.2

API keys

Keys are stored in your OS keychain — never in the config file. Set them once:

$ shellai config set-key anthropic sk-ant-…
$ shellai config set-key openai sk-…

Alternatively, export environment variables — ShellAI picks them up automatically:

export ANTHROPIC_API_KEY=sk-ant-…
export OPENAI_API_KEY=sk-…
export GEMINI_API_KEY=…

Ask

The primary command. Describe what you want in plain English — ShellAI generates the exact shell command, explains it, and shows a safety badge before asking you to confirm.

$ shellai ask "compress all PNG files in ./assets to 80% quality"

After generation you'll see an interactive prompt:

Generated: mogrify -quality 80 -format png ./assets/*.png

[WR] Writes files · affects ~34 files

[E]xecute  [C]opy  [M]odify  [R]evise  [Q]uit

Flags

FlagDescription
-q / --quietPrint the raw command to stdout and exit (pipe-friendly)
-a <file> / --attachAttach a file's content as context (max 100 KB/file, 500 KB total)

Explain

Paste any command — no matter how cryptic — and get a plain-English breakdown:

$ shellai explain "awk 'NR%2==0' file | sort -t: -k2 -rn | head -20"

ShellAI streams a detailed explanation breaking down each part — flags, pipes, risks, and alternatives.

Fix

Correct the last command you ran, or a command you pass directly:

$ shellai fix !!   # reads last command from shell history
$ shellai fix "gti commit -m 'fix'"

!! reads from ~/.zsh_history or ~/.bash_history automatically.

Debug

Pipe error output directly to ShellAI for AI analysis and a suggested fix:

$ npm install 2>&1 | shellai debug
$ ./deploy.sh 2>&1 | shellai debug

Build

Construct complex, multi-part commands from a natural language description:

$ shellai build "watch my Go app, restart on changes, log to file"

How do I

Quick one-shot lookup for common tasks. Behaves like ask but optimised for short how-to queries:

$ shellai howdoi list open ports

Chat mode

A persistent, context-aware AI session that knows your project, git state, and shell history. Think of it as a senior engineer sitting next to you.

$ shellai chat             # new session
$ shellai chat --resume    # resume last session

Sessions

Sessions are stored as JSON in ~/.shellai/sessions/ with 8-char hex IDs. They're automatically named from your first message and searchable by name or ID prefix.

Slash commands

CommandDescription
/run <cmd>Execute a shell command inline; output is fed back as context
/compactSummarise the conversation to free context window space
/copyCopy last AI response to clipboard
/diffShow git changes since the session started
/search / Ctrl+FRegex search across all sessions
/modelSwitch provider or model mid-session
/effort <level>Set reasoning effort: low | medium | high
/newStart a new session
/sessionsOpen the session browser
/insightsPull nyxCore project insights
/syncPush session to nyxCore memory
/helpShow all commands and keybindings

@file mentions

Type @path/to/file anywhere in a message and ShellAI will attach that file's contents as context (max 100 KB per file).

Keyboard shortcuts

KeyAction
Ctrl+EOpen $EDITOR for multi-line input
Ctrl+FOpen cross-session search
Ctrl+CInterrupt streaming response
j / kScroll chat history
qQuit session

Safety badges

Every generated command is risk-analysed after generation and assigned one or more badges:

BadgeMeaningRequired action
[RO] Read-only. No changes to the filesystem. Press Enter to run
[WR] Writes or modifies files. Preview is shown, then confirm
[DG] Destructive — data may be unrecoverable. Type a confirmation word
[SU] Requires sudo / elevated privileges. Additional callout shown
[NT] Makes network requests. Informational only
Blocked commands
Catastrophic patterns like rm -rf /, dd if=/dev/zero of=/dev/sda, and similar are auto-rejected entirely and cannot be executed through ShellAI under any circumstances.

Production mode

Set mode: prod in your config to enable stricter safety across all commands. In production mode, every destructive command is elevated to high-risk regardless of the LLM's assessment.

Undo system

Before executing a [WR] or [DG] command, ShellAI snapshots the affected files to ~/.shellai/snapshots/. You can restore them with:

$ shellai undo

Snapshots are kept for 24 hours with a maximum of 50 entries.

LLM providers

ShellAI supports Anthropic, OpenAI, Gemini, Groq, xAI, OpenRouter, Zhipu, and Ollama. It auto-detects which one to use based on available API keys, in priority order: Anthropic → OpenAI → Gemini → Groq → Ollama.

Anthropic

provider: anthropic
model: claude-sonnet-4-20250514   # default

Available models: claude-sonnet-4-20250514, claude-3-5-sonnet-20241022, claude-3-5-haiku-20241022, claude-3-opus-20240229

OpenAI

provider: openai
model: gpt-4o   # default

Available models: gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-4, gpt-3.5-turbo

Google Gemini

provider: gemini
model: gemini-2.5-flash   # default

Available models: gemini-2.5-flash, gemini-2.5-pro, gemini-2.5-flash-lite, gemini-2.0-flash

Ollama (offline)

Run ShellAI 100% offline with any locally available Ollama model:

$ curl -fsSL https://ollama.ai/install.sh | sh
$ ollama pull llama3.2
$ shellai config set provider ollama
Tool-calling detection
ShellAI auto-detects whether your Ollama model supports tool calling via /api/show — no manual config needed.
🧩
Task decomposition for local models
When you send a complex request, ShellAI automatically calls a cheap cloud model (e.g. Gemini Flash Lite — free tier) to break the task into numbered atomic steps before streaming. This dramatically improves multi-step reliability on smaller local models like 14B. No configuration needed — it just works. To disable: shellai config set llm.planner_enabled false

Auto routing (FrugalRoute)

Set provider: auto to let ShellAI route each request to the best available model automatically — simple tasks run locally on Ollama (free), complex ones escalate to a cloud provider.

provider: auto

On first use, ShellAI auto-starts FrugalRoute via npx frugalroute — npm fetches the package, it starts on localhost:3100, and ShellAI connects. Subsequent requests reuse the running instance (~10s startup on first use only).

To skip the first-run download, install globally:

$ npm install -g frugalroute

Add cloud API keys to FrugalRoute's env file at ~/.frugalroute/.env to enable cloud escalation. Without keys, all requests stay on Ollama.

Complexity routing
FrugalRoute scores each prompt for complexity. Simple queries (e.g. "list files by size") go to a local model instantly and free. Multi-step or domain-heavy requests escalate to a capable cloud model. You get smart routing without paying for every request.
!
Troubleshooting: "auto routing requires FrugalRoute"
Install npx (via Node.js) or bunx (via Bun) so ShellAI can auto-start FrugalRoute. Or pre-install: npm install -g frugalroute

Models & Capabilities

ShellAI supports seven cloud providers and local models via Ollama. Here's which model to use for which task — no guessing required.

Quick picks

I want to…Use this
Just get started, freegeminigemini-2.5-flash
Best quality, worth payinganthropicclaude-sonnet-4-20250514
Fastest responsesgroqllama-3.3-70b-versatile
Full agentic / coding tasksanthropicclaude-sonnet-4-20250514
Privacy / no internetollama → any local model
Cheapest that still works wellgeminigemini-2.5-flash-lite (free)
Already have OpenAI creditsopenaigpt-4o

Anthropic (Claude)

Best overall quality for complex tasks, agentic chat, and multi-step tool use. The default provider if you have an API key.

shellai config set-key anthropic <your-api-key>
shellai config set llm.provider anthropic
ModelBest forCost (per 1M tokens)
claude-sonnet-4-20250514Default. Best all-rounder. Agentic tasks, coding, analysis$3 in / $15 out
claude-3-5-sonnet-20241022Same quality tier as above, slightly older$3 in / $15 out
claude-3-5-haiku-20241022Fast, cheap. Simple questions, quick fixes$0.80 in / $4 out
claude-3-opus-20240229Deep reasoning, complex analysis. Rarely needed.$15 in / $75 out
When to use Anthropic
You need reliable multi-step tool use, complex code generation, or long agentic sessions. Claude handles "keep going until done" better than any other provider.

Google Gemini

Strong free tier. gemini-2.5-flash is free and handles most tasks well. Best starting point if you don't want to enter a credit card.

shellai config set-key gemini <your-api-key>
shellai config set llm.provider gemini
ModelBest forCost (per 1M tokens)
gemini-2.5-flashDefault. Free tier available. Fast, capable, great valueFree*
gemini-2.5-proComplex reasoning, long documents$1.25 in / $5 out
gemini-2.5-flash-liteSimple tasks, maximum speed. Also used for task decompositionFree*
gemini-2.0-flashBalanced performanceFree*

*Free within Google's rate limits. See Google AI Studio for current limits.

Orchestration model
gemini-2.5-flash-lite is what ShellAI uses internally for task decomposition — it's fast, free, and handles breaking down complex requests into steps before passing them to your main model.

OpenAI (GPT)

The original. Well-supported, predictable, works well for code and chat. Use if you already have credits.

shellai config set-key openai <your-api-key>
shellai config set llm.provider openai
ModelBest forCost (per 1M tokens)
gpt-4oDefault. Balanced quality and speed$2.50 in / $10 out
gpt-4o-miniFast, cheap. Good for simple commands$0.15 in / $0.60 out
gpt-4-turboLong context, complex tasks$10 in / $30 out
gpt-3.5-turboVery cheap, basic tasks only$0.50 in / $1.50 out

Groq

Fastest inference of any provider. Models run on custom LPU hardware — responses are near-instant. Trade-off: less capable models than Anthropic/OpenAI.

shellai config set-key groq <your-api-key>
shellai config set llm.provider groq
ModelBest forCost (per 1M tokens)
llama-3.3-70b-versatileDefault. Best quality on Groq$0.59 in / $0.79 out
llama-3.1-8b-instantMaximum speed, trivial tasks$0.04 in / $0.04 out
mixtral-8x7b-32768Long context tasks$0.24 in / $0.24 out
gemma2-9b-itLightweight tasks$0.10 in / $0.10 out
When to use Groq
You want the fastest possible response time for simple ask/fix/explain commands. Not ideal for agentic chat — model quality is lower than Claude/GPT-4o.

xAI (Grok)

Strong at reasoning and real-time knowledge. Competitive pricing for complex tasks.

shellai config set-key xai <your-api-key>
shellai config set llm.provider xai
ModelBest forCost (per 1M tokens)
grok-3Complex reasoning, latest knowledge$10 in / $10 out
grok-3-miniFast, cheap tasks$0.10 in / $0.10 out
grok-2Balanced

OpenRouter

Access to 100+ models through a single API key — including free models not available directly (DeepSeek, Mistral, Meta Llama). See openrouter.ai/models for the full list.

shellai config set-key openrouter <your-api-key>
shellai config set llm.provider openrouter
ModelNotes
deepseek/deepseek-chat:freeFree. Strong at coding
qwen/qwen-2.5-coder-32b-instruct:freeFree. Excellent code generation
meta-llama/llama-3.3-70b-instruct:freeFree. Good general tasks
google/gemini-2.0-flash-exp:freeFree. Fast and capable
mistralai/mistral-small-24b-instruct-2501:freeFree. Efficient for simple tasks

Zhipu AI (GLM)

Chinese AI provider. Strong at Chinese language tasks. Competitive pricing.

shellai config set-key zhipu <your-api-key>
shellai config set llm.provider zhipu
ModelBest for
glm-4-plusDefault. Best quality
glm-4-airFast, lightweight
glm-4-flashSpeed-optimized
codegeex-4Code-specific tasks

Ollama — what fits your GPU

VRAMRecommended models
4–6 GBqwen2.5-coder:7b, phi4-mini, gemma3:4b
8 GBqwen2.5-coder:14b, phi4:14b, gemma3:12b
16 GBqwen2.5-coder:32b, deepseek-r1:14b
24 GB+qwen2.5-coder:32b, deepseek-r1:32b

Local models work great for simple ask/fix/explain commands. For complex agentic tasks, models under 32B will struggle — not because of ShellAI, but the models themselves.

Task7B14B32B
Simple shell commands
Code generationOKGoodGreat
Multi-step tool useUnreliableOK
Agentic sessionsPartial
🧩
RTX 3070 (8 GB VRAM)?
qwen2.5-coder:14b or phi4:14b are your best bets. For agentic tasks, use gemini-2.5-flash (free) instead — it's significantly more capable.

Task-based recommendations

TaskRecommended
shellai ask — shell command generationAny provider. Groq is fastest. Gemini free tier is plenty.
shellai fix / shellai debuganthropic/claude-sonnet-4-20250514 or openai/gpt-4o. Haiku/mini usually work for simple fixes.
Long agentic chat sessionsanthropic/claude-sonnet-4-20250514 — by a significant margin.
Privacy-sensitive workollama — nothing leaves your machine.
Minimising costgemini-2.5-flash free → groq/llama-3.1-8b-instantopenai/gpt-4o-minianthropic/claude-3-5-haiku
Orchestration / task decompositiongemini-2.5-flash-lite (auto-selected, free) — ShellAI uses this automatically before complex Ollama requests.

Switching models

$ shellai config set llm.provider anthropic
$ shellai config set llm.model claude-3-5-haiku-20241022

Or use the in-chat model picker: type /model in chat mode to switch interactively.

Workflows

Pre-built playbooks for common DevOps tasks. Run with one command, no setup required.

$ shellai run docker-cleanup

Built-in workflows

NameDescription
docker-cleanupRemove unused containers, images, and volumes
log-rotationArchive and compress application logs older than N days
git-cleanupDelete merged branches locally and remotely
deps-auditScan project dependencies for known vulnerabilities
backup-dbDump, compress, and upload a database to S3
ssl-checkReport SSL certificate expiry across a list of hosts
k8s-reportCluster resource utilisation analysis
disk-reportFind what's consuming your disk space

Macros

Reusable command templates with {{variable}} substitution. Stored in ~/.shellai/macros/.

# Example macro: deploy.json
{
  "name": "deploy",
  "template": "git push {{remote:origin}} {{branch:main}} && ssh {{host}} 'cd {{path}} && ./deploy.sh'",
  "variables": {
    "remote": { "type": "string", "default": "origin" },
    "branch": { "type": "string", "default": "main" },
    "host":   { "type": "string" },
    "path":   { "type": "path" }
  }
}

MCP server setup

ShellAI includes an MCP server that gives Claude Desktop, Cursor, and other AI tools intelligent, safety-aware shell access.

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "shellai": {
      "command": "npx",
      "args": ["@shellai/mcp-server"],
      "env": {
        "SHELLAI_API_KEY": "your-api-key"
      }
    }
  }
}

Available MCP tools

ToolDescription
shell.generateGenerate a safe command from natural language
shell.executeExecute a pre-generated command with safety check
shell.explainExplain what a command does
shell.run_workflowExecute a named workflow from the marketplace
shell.contextReturn current workspace context (git, project type, cwd)
Never a dumb pipe
The ShellAI MCP server generates commands and checks them for safety before execution — unlike basic shell MCPs that blindly run whatever they're told.

Configuration reference

Full annotated ~/.shellai/config.yaml:

provider: anthropic         # openai | anthropic | gemini | ollama
model: ""                  # override default model for provider

mode: dev                  # dev | prod (prod elevates all DG commands)

shell: ""                  # override auto-detected shell

chat:
  max_history: 100         # max messages kept per session

llm:
  reasoning_effort: medium # low | medium | high
  planner_enabled: true    # auto-decompose complex tasks (default: true)
  planner_provider: ""     # provider for decomposition (empty = auto-select cheapest)
  planner_model: ""        # model for decomposition  (empty = auto-select cheapest)

ollama:
  host: http://localhost:11434
  model: llama3.2

nyxcore:
  enabled: true            # auto-discovered on localhost
  host: ""                 # override discovery host
  port: 0                  # override discovery port