Terminal AI coding assistant built with Python, Textual and litellm
- Python 99.8%
- Shell 0.2%
Textual TUI with Tokyo Night theme, litellm for multi-provider LLM, agent loop with native tool_calls, 8 built-in tools (read, write, edit, bash, grep, glob, list_dir, patch), 3 modes (Build/Plan/Ask), SQLite session persistence. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| src/opencode | ||
| .gitignore | ||
| opencode.json | ||
| pyproject.toml | ||
| README.md | ||
| run.sh | ||
coder-cli
Terminal AI coding assistant built with Python. Inspired by OpenCode.
Features
- Full TUI built with Textual
- Multi-provider LLM support via litellm
- Native OpenAI-compatible tool calling (read, write, edit, bash, grep, glob, list, patch)
- Three modes: Build (full tools), Plan (read-only), Ask (chat only)
- Session management with SQLite persistence
- Tokyo Night color theme
Install
uv venv && source .venv/bin/activate
uv pip install -e .
Configure
Create opencode.json in your project directory:
{
"model": "openai/gpt-4o",
"max_tokens": 8192,
"provider": {
"api_key": "sk-...",
"base_url": "https://api.openai.com/v1"
}
}
Or use environment variables:
export OPENAI_API_KEY="sk-..."
export OPENAI_API_BASE="https://api.openai.com/v1"
Run
# TUI mode
python -m opencode
# Non-interactive
python -m opencode -p "explain this code"
# Custom model
python -m opencode -m anthropic/claude-sonnet-4-20250514
Keyboard Shortcuts
| Key | Action |
|---|---|
| Enter | Send message |
| Shift+Enter | New line |
| Tab | Switch mode (Build/Plan/Ask) |
| Ctrl+S | Switch session |
| Ctrl+N | New session |
| Ctrl+H | Help |
| Ctrl+C | Quit |