An open-source AI coding terminal assistant — multi-model, git-native, privacy-first.
⚡ aicli │ gpt-4o │ myproject
You: explain the auth middleware and suggest improvements
Assistant: The auth middleware in src/middleware/auth.go uses JWT...
▌
- 🤖 Multi-model — OpenAI, Anthropic Claude, Google Gemini, Ollama (local), OpenRouter, and any OpenAI-compatible API
- 🌿 Git-native — every AI edit creates a checkpoint;
/undoreverts instantly - 🛡️ Privacy-first — run fully local with Ollama; no forced telemetry
- 🤖 Agent mode — autonomous plan→execute→reflect loop with human-in-the-loop approval
- 🔧 Built-in tools — read/write files, run commands, search code, fetch URLs
- ⚡ Fast — single Go binary, no runtime dependencies
- 🖥️ Cross-platform — Linux, macOS, Windows
# 1. Clone the repo
git clone https://github.com/Devn913/aicli.git
cd aicli
# 2. Install Go
brew install go
# 3. Install aicli
go install ./cmd/aicli
# 4. Add Go binaries to PATH
export PATH="$PATH:$(go env GOPATH)/bin"
# 5. Create a starter config
aicli init --provider openrouterbrew install Devn913/tap/aicligo install github.com/Devn913/aicli/cmd/aicli@latestGrab the latest binary from Releases for your platform.
git clone https://github.com/Devn913/aicli.git
cd aicli
go install ./cmd/aicli# 1. Initialize config
aicli init --provider openrouter
# 2. Set your API key (or use Ollama for local models)
export OPENROUTER_API_KEY=sk-...
# 3. Start the interactive TUI
aicli
# 4. Or ask a single question
aicli ask "what does the middleware do?"
# 5. Run an autonomous agent task inside the TUI
# then use /agent <task># Install Ollama: https://ollama.com
ollama pull llama3.2
# Use it with aicli
aicli --provider ollama| Provider | Models | Free tier | Local |
|---|---|---|---|
| OpenAI | GPT-4o, o3, o1, GPT-4o-mini | ❌ | ❌ |
| Anthropic | Claude Sonnet, Opus, Haiku | ❌ | ❌ |
| Google Gemini | Gemini 2.5 Pro/Flash | ✅ via aistudio | ❌ |
| Ollama | Llama 3.2, Qwen2.5, Mistral, any | ✅ | ✅ |
| OpenRouter | 200+ models | ✅ some | ❌ |
| OpenAI-compatible | Any (set base_url) |
varies | varies |
Config is loaded in this order (highest precedence last):
- Built-in defaults
~/.config/aicli/config.toml(user).aicli/config.toml(project — commit this for team settings)- Environment variables
# .aicli/config.toml
[provider]
default = "openrouter" # or "ollama" for local
[providers.openai]
model = "gpt-4o"
# API key: set OPENAI_API_KEY env var
[providers.anthropic]
model = "claude-sonnet-4-5"
# API key: set ANTHROPIC_API_KEY env var
[providers.ollama]
base_url = "http://localhost:11434"
model = "llama3.2"
[providers.openrouter]
base_url = "https://openrouter.ai/api/v1"
model = "anthropic/claude-sonnet-4-5"
[providers.gemini]
model = "gemini-2.5-flash"
[agent]
confirm_dangerous = true # ask before writing files / running commands
max_iterations = 50
[editing]
diff_preview = true # show diff before applying| Variable | Description |
|---|---|
OPENAI_API_KEY |
OpenAI API key |
ANTHROPIC_API_KEY |
Anthropic API key |
GEMINI_API_KEY |
Google Gemini API key |
OPENROUTER_API_KEY |
OpenRouter API key |
AICLI_PROVIDER |
Override active provider |
AICLI_MODEL |
Override active model |
aicli Interactive TUI chat (default)
aicli init Create a starter config
aicli ask <question> Single question, non-interactive
aicli providers List configured providers
aicli version Print version
Flags:
--provider Override provider (openai|anthropic|ollama|openrouter|gemini)
--model Override model name
--help Show help
--version Print version
| Command | Description |
|---|---|
/add <file> |
Add file to conversation context |
/drop <file> |
Remove file from context |
/clear |
Clear conversation history |
/undo |
Restore last checkpoint (revert AI edits) |
/diff |
Show git diff |
/commit [msg] |
Git commit AI changes |
/tokens |
Show token usage for this session |
/agent <task> |
Run autonomous agent task |
/model <name> |
Switch model mid-session |
/help |
Show all commands |
Agent mode runs a plan→execute→reflect loop. The agent can read/write files, run commands, and search code to complete multi-step tasks.
# From CLI
aicli
# then use:
/agent refactor the database layer to use connection pooling
# From TUI (type in the chat box)
/agent write tests for all untested functions in src/services/By default, the agent asks for confirmation before writing files or running shell commands (confirm_dangerous = true).
- Checkpoints: before any file edit, a checkpoint is saved in
.aicli/checkpoints/. Use/undoto revert. - Confirmation: review write and run_command actions carefully before approving them in agent mode.
- No secrets in config: API keys go in env vars or system keychain — never in
.aicli/config.toml. - Secret scanning: aicli warns before sending file content containing detected credentials to an LLM.
cmd/aicli/ Entry point
internal/
agent/ Autonomous agent loop
chat/ Conversation management + streaming
cli/ Bubble Tea TUI
config/ Config loading (TOML + env)
editing/ File editing + checkpointing
git/ Git integration
providers/ LLM provider abstraction
openai/ OpenAI + compatible APIs
anthropic/ Anthropic Claude
ollama/ Ollama local models
tools/ Built-in agent tools
pkg/types/ Shared types
See CONTRIBUTING.md. All contributions welcome.
- v0.1 — MVP: multi-provider TUI, file editing, agent mode, git integration
- v0.2 — Repo map (tree-sitter AST), real-time streaming, context engine
- v0.5 — Local embeddings, semantic search, session memory, plugin SDK
- v1.0 — LSP integration, shell sandboxing, audit log, secret scanner
Apache 2.0 © 2026 Devn913