openclaude
Run Claude Code workflows against any LLM — OpenAI, Gemini, Ollama, and 200+ backends — from a single terminal-first CLI.
OpenClaude is an open-source coding-agent CLI that breaks the lock between the Claude Code workflow and the Anthropic API. By shipping an OpenAI-compatible provider shim alongside the original agent loop, it lets developers point the same terminal interface at any backend: OpenAI, Gemini, GitHub Models, Codex, Ollama, Fireworks AI, Xiaomi MiMo, NEAR AI, Z.AI, and more — or any custom OpenAI-compatible endpoint.
The tool preserves the full coding-agent toolkit that makes Claude Code effective: Bash execution, file read/write/edit, grep, glob, multi-agent task spawning, MCP server connectivity, slash commands, and streaming output. Provider setup is handled through an interactive /provider command that saves named profiles to .openclaude-profile.json, eliminating the need to re-export environment variables on every session.
Background sessions (via openclaude --bg) allow long-running agentic tasks to run detached from the terminal, with named process management, log streaming with -f, and session lifecycle commands. A bundled VS Code extension provides launch integration and theme support without requiring a separate installation.
OpenClaude is released by the GitLawb community and is updated rapidly — 29 releases over roughly 80 days. The project carries a nuanced license: contributor modifications are MIT-licensed, while the underlying Claude Code derived code remains subject to Anthropic’s copyright and terms of service.
What You Get
- Multi-provider routing — Switch between Anthropic, OpenAI, Gemini, Ollama, GitHub Models, Fireworks AI, Codex, and 200+ compatible backends from a single CLI without changing your workflow
- Provider profile system — Save named provider configurations with
/providerso you can switch backends without re-exporting environment variables every session - Background sessions — Run long agentic tasks detached from the terminal using
openclaude --bg, with named session management, log streaming, and lifecycle controls - Full coding-agent toolkit — Bash execution, file read/write/edit, grep, glob, multi-agent task spawning, MCP server connectivity, and streaming token output
- GitHub Copilot optimization — Serialized sub-agent execution mode to control Premium Request consumption when using GitHub Models
- VS Code extension — Bundled extension for launch integration and synchronized theme support without a separate install
- Local model support — Zero-config Ollama and Atomic Chat integration for fully air-gapped local inference on any hardware
- MCP server connectivity — Connect any Model Context Protocol server to extend the agent’s tool surface beyond the built-in toolkit
Common Use Cases
- Cost-conscious teams — Swap Anthropic API calls for Ollama local models or cheaper OpenAI-compatible endpoints while keeping the same coding-agent scripts and slash commands
- Air-gapped development — Run complete agentic coding workflows on an Ollama local model with no network calls to external APIs
- GitHub Copilot subscribers — Use Claude Code–style agentic workflows through GitHub Models with automatic Premium Request throttling to stay within plan limits
- Background refactoring — Launch multi-file refactor or test-generation tasks as named background sessions and monitor their progress without blocking the terminal
- Multi-model experimentation — Compare coding-agent output quality across DeepSeek, Qwen, GPT-4o, and Gemini on the same codebase by switching provider profiles
- MCP-extended workflows — Wire custom MCP servers into the agent loop to give the model access to internal databases, private APIs, or specialized tools
Under The Hood
Architecture OpenClaude follows a layered architecture with clear boundaries between the terminal UI layer built on React with Ink, the agent orchestration layer in QueryEngine, the tool execution layer behind Tool.ts, and the provider abstraction layer in the API client. The entry point handles CLI argument parsing, provider profile loading, and REPL initialization, then delegates the actual agent loop to QueryEngine which coordinates API calls, tool results, automatic context-window compaction, and multi-agent task dispatching. Agent swarms and background sessions are isolated behind well-defined task-type abstractions, and Bun’s compile-time feature flags enable dead-code elimination so production builds exclude coordinator and assistant modes unless explicitly enabled.
Tech Stack The runtime target is Node.js 22+ for end-users while Bun serves as the build toolchain. The terminal UI is built on React 19 with Ink and React Reconciler, enabling component-based interactive interfaces with real-time streaming. The Anthropic SDK is the primary API client, with an OpenAI-compatible shim routing requests to any of 15+ named providers. gRPC via @grpc/grpc-js handles the background daemon and remote session communication. MCP integration uses @modelcontextprotocol/sdk, Orama provides in-process vector and full-text search, Zod handles schema validation throughout, and a VS Code extension lives in a bundled subdirectory.
Code Quality The codebase has extensive test coverage with approximately 395 test files spanning the query engine, cost tracking, tool definitions, MCP integration, CLI entrypoints, skills, agent routing, and provider clients, all running under Bun’s native test runner. TypeScript strict mode and dedicated type-test compilation catch interface mismatches at build time. ESLint enforces project-specific rules including a custom no-top-level-side-effects rule. Error handling uses typed error classes and consistent API error categorization patterns. A dedicated privacy verification script is part of CI to guard against unintended data exfiltration.
What Makes It Unique The dual-build approach is the standout design choice: the same codebase compiles both a Claude Code-compatible SDK entrypoint and an OpenAI-compatible shim, so any tool or script written for Claude Code can be redirected to a different backend with a single environment variable. The GitHub Copilot sub-agent serialization system for controlling premium request consumption, named background sessions with process management, and compile-time feature flags via Bun’s bundler for lean production builds are differentiators that most LLM CLI forks do not implement.
Self-Hosting
OpenClaude carries a dual-layer license that any self-hoster should understand before deploying. The contributor modifications — the multi-provider shim, provider profile system, background sessions, and everything added on top of the original codebase — are offered under MIT. The underlying derived code, however, remains subject to Anthropic’s copyright and their Commercial Terms of Service, which the LICENSE file explicitly acknowledges the project does not have Anthropic’s authorization to distribute. This means the legal posture for self-hosters is genuinely uncertain, and teams with strict IP compliance requirements should evaluate their own position before using it in production.
Operationally, OpenClaude is a CLI process, not a server, which keeps self-hosting lightweight. You install it globally via npm, configure a provider profile with /provider, and you are running. There is no persistent daemon beyond optional background sessions, no database, and no network service to maintain. For teams that want to standardize a provider configuration across machines, .openclaude-profile.json is the mechanism — it is a user-level file containing API keys and base URLs that can be templated and distributed via dotfiles or secrets management. The VS Code extension requires a manual install step from the vscode-extension/ directory.
There is no official managed or paid tier for OpenClaude itself — it is purely self-hosted. The trade-offs compared to using Claude Code directly with an Anthropic subscription are significant: you gain provider flexibility and open-source auditability, but lose Anthropic’s first-party support, guaranteed compatibility with future Claude Code SDK updates, and the legal clarity of using software under its intended license. Projects that rely heavily on Anthropic-specific features such as extended thinking, computer use, or the artifacts API may find those features degrade or disappear when routed through non-Anthropic backends.
Related Apps
claw-code
AI Agents · AI Code Assistants
A Rust-built CLI agent harness for Claude AI with persistent sessions, MCP tool integration, plugin hooks, and multi-provider support — designed to run autonomous coding workflows without human babysitting.
claw-code
MITOpenCode
AI Code Assistants
A fully open-source AI coding agent built for the terminal, with a TUI, desktop app, web client, plugin system, and SDK — one of the most-starred AI coding agents on GitHub.
OpenCode
MITLangflow
AI Agents · AI Development
Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.