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)
Homebrew (macOS)
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.
Quick start
After installation, verify it works and make your first request:
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:
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.
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
| Flag | Description |
|---|---|
-q / --quiet | Print the raw command to stdout and exit (pipe-friendly) |
-a <file> / --attach | Attach 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 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:
!! reads from ~/.zsh_history or ~/.bash_history automatically.
Debug
Pipe error output directly to ShellAI for AI analysis and a suggested fix:
Build
Construct complex, multi-part commands from a natural language description:
How do I
Quick one-shot lookup for common tasks. Behaves like ask but optimised for short how-to queries:
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.
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
| Command | Description |
|---|---|
/run <cmd> | Execute a shell command inline; output is fed back as context |
/compact | Summarise the conversation to free context window space |
/copy | Copy last AI response to clipboard |
/diff | Show git changes since the session started |
/search / Ctrl+F | Regex search across all sessions |
/model | Switch provider or model mid-session |
/effort <level> | Set reasoning effort: low | medium | high |
/new | Start a new session |
/sessions | Open the session browser |
/insights | Pull nyxCore project insights |
/sync | Push session to nyxCore memory |
/help | Show 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
| Key | Action |
|---|---|
Ctrl+E | Open $EDITOR for multi-line input |
Ctrl+F | Open cross-session search |
Ctrl+C | Interrupt streaming response |
j / k | Scroll chat history |
q | Quit session |
Safety badges
Every generated command is risk-analysed after generation and assigned one or more badges:
| Badge | Meaning | Required 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 |
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:
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:
/api/show — no manual config needed.
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:
Add cloud API keys to FrugalRoute's env file at ~/.frugalroute/.env to enable cloud escalation. Without keys, all requests stay on Ollama.
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, free | gemini → gemini-2.5-flash |
| Best quality, worth paying | anthropic → claude-sonnet-4-20250514 |
| Fastest responses | groq → llama-3.3-70b-versatile |
| Full agentic / coding tasks | anthropic → claude-sonnet-4-20250514 |
| Privacy / no internet | ollama → any local model |
| Cheapest that still works well | gemini → gemini-2.5-flash-lite (free) |
| Already have OpenAI credits | openai → gpt-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
| Model | Best for | Cost (per 1M tokens) |
|---|---|---|
claude-sonnet-4-20250514 | Default. Best all-rounder. Agentic tasks, coding, analysis | $3 in / $15 out |
claude-3-5-sonnet-20241022 | Same quality tier as above, slightly older | $3 in / $15 out |
claude-3-5-haiku-20241022 | Fast, cheap. Simple questions, quick fixes | $0.80 in / $4 out |
claude-3-opus-20240229 | Deep reasoning, complex analysis. Rarely needed. | $15 in / $75 out |
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
| Model | Best for | Cost (per 1M tokens) |
|---|---|---|
gemini-2.5-flash | Default. Free tier available. Fast, capable, great value | Free* |
gemini-2.5-pro | Complex reasoning, long documents | $1.25 in / $5 out |
gemini-2.5-flash-lite | Simple tasks, maximum speed. Also used for task decomposition | Free* |
gemini-2.0-flash | Balanced performance | Free* |
*Free within Google's rate limits. See Google AI Studio for current limits.
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
| Model | Best for | Cost (per 1M tokens) |
|---|---|---|
gpt-4o | Default. Balanced quality and speed | $2.50 in / $10 out |
gpt-4o-mini | Fast, cheap. Good for simple commands | $0.15 in / $0.60 out |
gpt-4-turbo | Long context, complex tasks | $10 in / $30 out |
gpt-3.5-turbo | Very 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
| Model | Best for | Cost (per 1M tokens) |
|---|---|---|
llama-3.3-70b-versatile | Default. Best quality on Groq | $0.59 in / $0.79 out |
llama-3.1-8b-instant | Maximum speed, trivial tasks | $0.04 in / $0.04 out |
mixtral-8x7b-32768 | Long context tasks | $0.24 in / $0.24 out |
gemma2-9b-it | Lightweight tasks | $0.10 in / $0.10 out |
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
| Model | Best for | Cost (per 1M tokens) |
|---|---|---|
grok-3 | Complex reasoning, latest knowledge | $10 in / $10 out |
grok-3-mini | Fast, cheap tasks | $0.10 in / $0.10 out |
grok-2 | Balanced | — |
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
| Model | Notes |
|---|---|
deepseek/deepseek-chat:free | Free. Strong at coding |
qwen/qwen-2.5-coder-32b-instruct:free | Free. Excellent code generation |
meta-llama/llama-3.3-70b-instruct:free | Free. Good general tasks |
google/gemini-2.0-flash-exp:free | Free. Fast and capable |
mistralai/mistral-small-24b-instruct-2501:free | Free. 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
| Model | Best for |
|---|---|
glm-4-plus | Default. Best quality |
glm-4-air | Fast, lightweight |
glm-4-flash | Speed-optimized |
codegeex-4 | Code-specific tasks |
Ollama — what fits your GPU
| VRAM | Recommended models |
|---|---|
| 4–6 GB | qwen2.5-coder:7b, phi4-mini, gemma3:4b |
| 8 GB | qwen2.5-coder:14b, phi4:14b, gemma3:12b |
| 16 GB | qwen2.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.
| Task | 7B | 14B | 32B |
|---|---|---|---|
| Simple shell commands | ✓ | ✓ | ✓ |
| Code generation | OK | Good | Great |
| Multi-step tool use | ✗ | Unreliable | OK |
| Agentic sessions | ✗ | ✗ | Partial |
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
| Task | Recommended |
|---|---|
shellai ask — shell command generation | Any provider. Groq is fastest. Gemini free tier is plenty. |
shellai fix / shellai debug | anthropic/claude-sonnet-4-20250514 or openai/gpt-4o. Haiku/mini usually work for simple fixes. |
| Long agentic chat sessions | anthropic/claude-sonnet-4-20250514 — by a significant margin. |
| Privacy-sensitive work | ollama — nothing leaves your machine. |
| Minimising cost | gemini-2.5-flash free → groq/llama-3.1-8b-instant → openai/gpt-4o-mini → anthropic/claude-3-5-haiku |
| Orchestration / task decomposition | gemini-2.5-flash-lite (auto-selected, free) — ShellAI uses this automatically before complex Ollama requests. |
Switching models
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.
Built-in workflows
| Name | Description |
|---|---|
docker-cleanup | Remove unused containers, images, and volumes |
log-rotation | Archive and compress application logs older than N days |
git-cleanup | Delete merged branches locally and remotely |
deps-audit | Scan project dependencies for known vulnerabilities |
backup-db | Dump, compress, and upload a database to S3 |
ssl-check | Report SSL certificate expiry across a list of hosts |
k8s-report | Cluster resource utilisation analysis |
disk-report | Find 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
| Tool | Description |
|---|---|
shell.generate | Generate a safe command from natural language |
shell.execute | Execute a pre-generated command with safety check |
shell.explain | Explain what a command does |
shell.run_workflow | Execute a named workflow from the marketplace |
shell.context | Return current workspace context (git, project type, cwd) |
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