← 开源
1rgs

nanocode

Minimal Claude Code alternative. Single Python file, zero dependencies, ~250 lines.

ApplicationsCodingPython
在 GitHub 打开
增长势头
+724 小时新增 Star+0.3%
2.76k
Star
274
Fork
+22
本周
2
贡献者
创建于 2026-01-11 · 更新于 2026-10-14 · 今日第 1797 名
主要开发者
README

nanocode

Minimal Claude Code alternative. Single Python file, zero dependencies, ~250 lines.

Built using Claude Code, then used to build itself.

screenshot

Features

  • Full agentic loop with tool use
  • Tools: read, write, edit, glob, grep, bash
  • Conversation history
  • Colored terminal output

Usage

export ANTHROPIC_API_KEY="your-key"
python nanocode.py

OpenRouter

Use OpenRouter to access any model:

export OPENROUTER_API_KEY="your-key"
python nanocode.py

To use a different model:

export OPENROUTER_API_KEY="your-key"
export MODEL="openai/gpt-5.2"
python nanocode.py

Commands

  • /c - Clear conversation
  • /q or exit - Quit

Tools

Tool Description
read Read file with line numbers, offset/limit
write Write content to file
edit Replace string in file (must be unique)
glob Find files by pattern, sorted by mtime
grep Search files for regex
bash Run shell command

Example

────────────────────────────────────────
❯ what files are here?
────────────────────────────────────────

⏺ Glob(**/*.py)
  ⎿  nanocode.py

⏺ There's one Python file: nanocode.py

License

MIT