# OpenClaude
OpenClaude is an open-source, multi-provider coding-agent CLI that originated as a fork of [[Claude Code]] and has since been substantially modified to remove provider lock-in. It keeps the Claude Code workflow shape (prompts, tools, agents, MCP, slash commands, streaming output) but lets the user point it at OpenAI-compatible APIs, [[Gemini]], GitHub Models, Codex OAuth, [[OpenAI Codex|Codex]], [[Ollama]], Atomic Chat, Bedrock, Vertex, and Foundry as backends.
It is an independent community project; not affiliated with, endorsed by, or sponsored by [[Anthropic]]. The project ships under MIT license and explicitly notes that "Claude" and "Claude Code" remain Anthropic trademarks.
Positioning is essentially "the Claude Code experience without the model lock-in"; the same niche [[OpenCode]] occupies from the SST side and that [[OpenClaw]] occupied earlier as a personal-assistant fork. Compared to [[Aider]], [[Kimi CLI]], [[Gemini CLI]], and [[GitHub Copilot CLI]], OpenClaude's differentiator is heritage; it is the closest user-experience match to Claude Code itself because the codebase started there.
## Key features
- **Multi-provider routing**: OpenAI-compatible (OpenAI, OpenRouter, DeepSeek, Groq, Mistral, LM Studio), Hicap, Gemini, GitHub Models, Codex OAuth, Codex CLI auth, Ollama, Atomic Chat, Bedrock, Vertex, Foundry.
- **Provider profiles**: `/provider` slash command for guided setup and saved profiles; `/onboard-github` for GitHub Models onboarding.
- **Agent routing**: per-subagent model assignment via `~/.openclaude.json`; route Explore, Plan, general-purpose, frontend-dev to different backends for cost or capability reasons.
- **Tool surface**: Bash, file read/write/edit, grep, glob, agents, tasks, slash commands; same shape as Claude Code.
- **[[Model Context Protocol (MCP)]] support** for third-party tools.
- **Web search and fetch**: free [[DuckDuckGo]] fallback for non-Anthropic models out of the box; optional Firecrawl path via `FIRECRAWL_API_KEY` for JS-rendered pages and a more reliable search API.
- **Streaming output and multi-step tool loops** with progress events.
- **Image inputs** (URL or base64) for providers that support vision.
- **Headless gRPC server** on `localhost:50051` for embedding the agent in CI, custom UIs, or other applications; bidirectional streaming with permission prompts via `action_required` events. Proto file at `src/proto/openclaude.proto` for non-JS clients.
- **VS Code extension** bundled in `vscode-extension/openclaude-vscode/` for launch integration and provider-aware control-center UI.
## Install and start
```bash
npm install -g @gitlawb/openclaude
openclaude
```
Requires `ripgrep` available on `PATH`. Inside the session, `/provider` walks through provider setup.
Fastest OpenAI setup:
```bash
export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_API_KEY=sk-your-key-here
export OPENAI_MODEL=gpt-4o
openclaude
```
Fastest local Ollama setup:
```bash
export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_BASE_URL=http://localhost:11434/v1
export OPENAI_MODEL=qwen2.5-coder:7b
openclaude
```
If [[Ollama]] is installed, `ollama launch openclaude --model <name>` skips the env-var dance and routes all API traffic through the local Ollama instance.
## Source build
Built with [[Bun]] and [[TypeScript]]:
```bash
bun install
bun run build
node dist/cli.mjs
```
## Repository layout
- `src/` — core CLI/runtime
- `scripts/` — build, verification, maintenance
- `docs/` — setup and contributor docs
- `python/` — standalone Python helpers
- `vscode-extension/openclaude-vscode/` — VS Code extension
- `bin/` — CLI launcher entrypoints
## Caveats
- Anthropic-specific features may not exist on other providers; tool-call quality depends heavily on the chosen model.
- Smaller local models can struggle with long multi-step tool flows.
- Some providers cap output tokens lower than the CLI defaults.
- DuckDuckGo fallback search scrapes results and may be rate-limited or blocked; Firecrawl is the supported alternative.
- `api_key` values stored in `~/.openclaude.json` are plaintext; do not commit.
## References
- GitHub: https://github.com/Gitlawb/openclaude
- npm package: `@gitlawb/openclaude`
- GitLawb mirror: https://gitlawb.com/node/repos/z6MkqDnb/openclaude
## Related
- [[Claude Code]]
- [[AI Agent Harness]]
- [[OpenCode]]
- [[OpenClaw]]
- [[Aider]]
- [[Codex CLI]]
- [[OpenAI Codex]]
- [[Gemini CLI]]
- [[Kimi CLI]]
- [[GitHub Copilot CLI]]
- [[Cline]]
- [[Goose]]
- [[Roo Code]]
- [[Ollama]]
- [[Model Context Protocol (MCP)]]
- [[AI Agents]]
- [[Agentic Engineering]]
- [[How coding agents work]]
- [[Anthropic]]
- [[OpenAI]]
- [[Large Language Models (LLMs)]]