Features β’ Installation β’ Quick Start β’ Providers β’ Documentation
OpenCLI bridges the feature gap between closed-source tools (Claude Code, Gemini CLI) and the open-source ecosystem:
- 12+ providers: Claude, GPT, Gemini, Grok, DeepSeek, Qwen, Minimax, GLM, Kimi, Devstral, Ollama, OpenAI-compatible
- Mid-session switching:
/provider claude,/model gpt-4o - Model comparison:
opencli benchmark "task" - Model comparison:
opencli benchmark "task"
- Adaptive compression: 30%+ reduction on long sessions
- Provider optimization: 1M context (Minimax), 256K (Qwen), 128K (DeepSeek)
- Sliding window: Keep recent messages, preserve system prompt
- Semantic compression: Summarize old tool results
- Rolling totals: Daily, weekly, monthly costs
- Budget enforcement: 80% warning, 100% blocking
- Cost export: CSV/JSON export for analysis
- Per-provider breakdown: See costs by provider and model
- Task decomposition: Automatic subtask planning
- Specialized models: Optimal model per task type
- Cost optimization: Use cheaper models where appropriate
- Parallel execution: Multiple subtasks when possible
- Docker sandbox: Isolated bash command execution
- Permission prompts: Confirm before tool execution
- Audit logging: All operations logged to
~/.opencli/audit.log - Secure storage: API keys in system keychain
- Git operations: Commit, diff, log, branch management
- Web search: Integrated via Brave/Serper APIs
- File operations: Read, write, edit with diff preview
- MCP protocol: Compatible with Model Context Protocol servers
npm install -g opencli- Node.js >= 20.0.0
- macOS, Linux, or Windows
- (Optional) Docker for sandbox mode
opencli setupThe interactive wizard will guide you through:
- Selecting providers to configure
- Entering API keys (stored in system keychain)
- Setting default provider and model
# Basic usage
opencli "fix the authentication bug"
# Specify provider
opencli -p qwen "explain this codebase"
# Use specific model
opencli -m deepseek-v3 "refactor this function"
# Budget-conscious mode
opencli --budget 5.0 "add input validation"# Debug production issues
opencli -p deepseek "investigate why the API is returning 500"
# Analyze large codebases
opencli -p qwen "explain the architecture of this monorepo"
# Cost-optimized development
opencli profile use budget-conscious
opencli "add unit tests for user.service"
# Local privacy mode
ollama pull codellama
opencli -p ollama "review this sensitive code"
# Web search with GLM
opencli -p glm "search for latest React updates"
# Multi-agent mode
/multiagent
opencli "refactor the authentication module"OpenCLI supports 12+ providers out of the box:
| Provider | Best For | Context | Pricing* | Notes |
|---|---|---|---|---|
| Claude | Best quality | 200K | $3.00/$15.00 | Anthropic's best |
| GPT | Most popular | 128K | $2.50/$10.00 | GPT-4o |
| Gemini | 1M context | 1M | $0.075/$0.30 | Google's fastest |
| Grok | Real-time | 128K | $5.00/$15.00 | xAI flagship |
| DeepSeek | Cost-effective | 128K | $0.14/$0.28 | Budget choice |
| Qwen | Large codebases | 256K | $0.50/$1.00 | Large context |
| Minimax | Massive files | 1M | $0.10/$0.20 | Cheapest |
| GLM | Chinese LLM | 128K | $0.30/$0.60 | Zhipu AI |
| Kimi | Quality | 128K | $0.13/$0.18 | Moonshot AI |
| Devstral | Apache 2.0 | 128K | $0.50/$1.50 | Mistral Codestral |
| Ollama | Local models | Varies | Free | No API key |
| OpenAI-Compatible | Custom | Varies | Varies | Generic |
*Pricing per 1M input/output tokens in USD.
DeepSeek (Recommended)
export DEEPSEEK_API_KEY="sk-..."
opencli config set provider deepseekQwen (Alibaba)
export DASHSCOPE_API_KEY="sk-..."
opencli config set provider qwenMinimax
export MINIMAX_API_KEY="..."
opencli config set provider minimaxGLM (Zhipu AI)
export ZHIPUAI_API_KEY="..."
opencli config set provider glmKimi (Moonshot)
export KIMI_API_KEY="sk-..."
opencli config set provider kimiDevstral (Mistral)
export DEVSTRAL_API_KEY="..."
opencli config set provider devstralOllama (Local)
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Pull model
ollama pull llama3
# Use with OpenCLI
opencli config set provider ollamaOpenAI-Compatible
export OPENAI_COMPAT_BASE_URL="https://your-endpoint.com/v1"
export OPENAI_COMPAT_API_KEY="..."
opencli config set provider openai-compatClaude (Anthropic)
export ANTHROPIC_API_KEY="sk-ant-..."
opencli config set provider claudeModels:
claude-3-5-sonnet-20241022- Latest, 200K context (recommended)claude-3-opus-20240229- Maximum capabilitiesclaude-3-haiku-20240307- Fast, cost-effective
GPT (OpenAI)
export OPENAI_API_KEY="sk-..."
opencli config set provider gptModels:
gpt-4o- Latest, multimodal (recommended)gpt-4o-mini- Fast, cost-effectivegpt-4-turbo- High qualitygpt-3.5-turbo- Budget option
Gemini (Google)
export GOOGLE_API_KEY="..."
opencli config set provider geminiModels:
gemini-2.0-flash-exp- 1M context, ultra-fast (recommended)gemini-1.5-pro- Maximum capabilitiesgemini-1.5-flash- Fast, cost-effective
Grok (xAI)
export XAI_API_KEY="..."
opencli config set provider grokModels:
grok-2- Latest, vision support (recommended)grok-beta- Experimental accessgrok-vision-beta- Vision-focused
- Architecture Documentation - System design and data flow
- Provider Setup Guide - Detailed provider configuration
- Contributing Guide - How to contribute
- Code of Conduct - Community guidelines
# View configuration
opencli config list
# Set default provider
opencli config set provider deepseek
# Set budget limits
opencli config set budget.limit 10
# Enable Docker sandbox
opencli config set tools.sandbox true
# Use profiles
opencli profile use fast
opencli profile use power# View cost dashboard
opencli cost show
# Export costs
opencli cost export --format csv > costs.csv
# Set budget limit
opencli config set budget.limit 10# Multi-agent mode
/multiagent
opencli "refactor authentication module"
# Knowledge brain search
opencli knowledge search "context compression"
# Manual compression
/compress force
# Benchmark providers
opencli benchmark "add error handling"OpenCLI includes powerful tools for development:
Execute shell commands with permission prompts:
opencli "run the test suite and fix failing tests"Read, write, and edit files:
opencli "add input validation to user.service.ts"Git operations integrated:
opencli "commit the changes with a descriptive message"
opencli "create a new feature branch for auth fix"Built-in web search (via GLM or external API):
opencli "search for the latest React best practices"Run bash commands in isolated containers:
# Enable sandbox
opencli config set tools.sandbox true
# Run in sandbox
opencli --sandbox "analyze this untrusted script"All tool executions require confirmation:
[Tool: bash] Executing command:
rm -rf node_modules
Execute this command? [Y/n]
All operations logged to ~/.opencli/audit.log:
cat ~/.opencli/audit.log# Use cheaper models for simple tasks
opencli -m qwen-turbo "format this code"
# Set budget limits
opencli config set budget.limit 5
# Use profiles
opencli profile use budget-conscious# Manual compression
/compress force
# Change strategy
opencli config set compression.strategy sliding
# View context stats
opencli /compress stats# Quick tasks - use fast models
opencli -p qwen -m qwen-turbo "task"
# Complex tasks - use capable models
opencli -p deepseek -m deepseek-v3 "task"
# Large files - use large context
opencli -p minimax "analyze this file"
# Privacy - use local models
opencli -p ollama "task"We welcome contributions! Please see CONTRIBUTING.md for details.
# Clone repository
git clone https://github.com/open-cli/opencli
cd opencli
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Link for local development
npm linkopencli/
βββ src/
β βββ core/ # Agent loop, session, planner
β βββ providers/ # Provider implementations
β βββ tools/ # Tool implementations
β βββ knowledge/ # Knowledge brain system
β βββ cost/ # Cost tracking
β βββ ui/ # Terminal UI components
βββ tests/ # Unit and integration tests
βββ docs/ # Documentation
βββ scripts/ # Utility scripts
- β Multi-provider support
- β Context compression
- β Cost tracking
- β Multi-agent routing
- β Security features
- β Advanced tools
- GitHub Integration
- Enhanced UI with Ink
- Additional providers
- Performance optimizations
- Comprehensive documentation
- VS Code extension
- Team collaboration features
- Enterprise SSO support
- Custom model fine-tuning
- Plugin system
Built with inspiration from:
- Claude Code - Provider adapter pattern
- Aider - Context compression strategies
- Qwen-Code - Multi-provider support
- Cursor - Terminal UI design
Apache License 2.0 - see LICENSE for details.
If you find OpenCLI useful, please consider giving us a star on GitHub!
- npm: https://www.npmjs.com/package/opencli
- GitHub: https://github.com/open-cli/opencli
- Documentation: https://docs.opencli.dev
- Discussions: https://github.com/open-cli/opencli/discussions
- Issues: https://github.com/open-cli/opencli/issues
Built with β€οΈ for the open-source community