OpenClaude: An Open Fork of the Claude Code CLI Agent with Support for Any LLM
March 31, 2026 — Source code for Anthropic's Claude Code CLI agent was leaked from the npm package's source maps. Within hours, OpenClaude appeared on GitHub — a fork with an OpenAI-compatible provider. This allows using the entire Claude Code tool stack (bash, file operations, grep, MCP, agents) with models like GPT-4o, DeepSeek, Gemini, or Llama via Ollama.
OpenClaude preserves the original architecture: the obfuscated Node.js/TypeScript code was reconstructed from source maps. A shim provider was added to redirect Anthropic API calls to OpenAI Chat Completions. The Claude model itself was not leaked — external LLMs are used.
Architecture and Key Components
The system is built on the ReAct pattern: the agent analyzes a task, selects a tool, executes an action, processes the result, and repeats the cycle.
Core Tools
- Bash: Execute shell commands
- FileRead/FileWrite/FileEdit: Read, write, and edit files
- Grep/Glob: Search by patterns and files
- WebFetch/WebSearch: Internet access
- Agent: Sub-agents for subtasks
- MCP (Model Context Protocol): Connect external servers
- Tasks: Plan multi-step tasks
- LSP (Language Server Protocol): Code navigation
The model provider is configured via environment variables. Example configurations:
# GPT-4o
export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_API_KEY=sk-your-key
export OPENAI_MODEL=gpt-4o
# DeepSeek
export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_API_KEY=sk-your-key
export OPENAI_BASE_URL=https://api.deepseek.com/v1
export OPENAI_MODEL=deepseek-chat
# Ollama locally
export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_BASE_URL=http://localhost:11434/v1
export OPENAI_MODEL=llama3.3:70b
# OpenRouter
export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_API_KEY=sk-or-your-key
export OPENAI_BASE_URL=https://openrouter.ai/api/v1
export OPENAI_MODEL=google/gemini-2.5-pro
Session context is saved in markdown files, ensuring memory between runs.
Installation and Launch
Requires Bun (Node.js is possible but slower):
git clone https://github.com/Gitlawb/openclaude.git
cd openclaude
bun install
bun run build
Profiles for quick start:
# Auto-detect provider
bun run profile:init
# Ollama
bun run profile:init -- --provider ollama --model llama3.1:8b
# OpenAI
bun run profile:init -- --provider openai --api-key sk-...
# Launch
bun run dev:profile
For Ollama: ollama pull llama3.3:70b and start the server.
Model Testing Results
| Model | Tool Calling | Speed | Agent Quality | Notes |
|--------|--------------|----------|-----------------|------------|
| GPT-4o | Native | High | High | Close to original |
| DeepSeek Chat | Medium | High | Medium | Breaks on chains |
| Llama 3.3 70B (Ollama) | Supported | Low | Below Average | For simple tasks |
| 7-8B Models | Weak | Medium | Low | Not for agents |
The original slash commands are preserved:
/commit— Generate commit messages/review— Code review/compact— Compress context/diff— View changes/doctor— Project diagnostics
Support for MCP servers and vision models for computer vision.
Legal Aspects and Alternatives
Claude Code source code is Anthropic's property. The fork is positioned as an educational project. The OpenAI shim is public domain. Risks of violating Anthropic's ToS remain.
Legal alternatives:
- claude-code-proxy: Translates Anthropic API to OpenAI without code leakage
- Aider: Open source agent with native LLM support
- Continue.dev: IDE plugin for any models
- OpenClaw: Messenger agent
Key Takeaways
- OpenClaude reveals Claude Code's internal architecture: ReAct cycle, tools, context management
- Best results with GPT-4o; local models (Llama 70B) suit simple tasks
- Installation via Bun, configuration via OPENAI_* variables
- Preserves slash commands and MCP, but legal risks exist
- Alternatives: Aider, Continue.dev without legality concerns
— Editorial Team
No comments yet.