Skip to content
Gradland
← Blog
🤖

OpenClaude: One CLI, 200+ Models, Zero Lock-in

7 April 2026·4 min readTypeScriptAIDeveloper ToolsNext.jsCLI

Claude Code is a genuinely useful coding agent, but it's locked to Anthropic's API and billing. OpenClaude clones that terminal-first workflow and lets you swap the backend to anything OpenAI-compatible — which in 2025 means basically everything. It hit 19k stars in a week, which tells you a lot of developers have been waiting for exactly this.

What OpenClaude Actually Is

It's a TypeScript CLI that replicates the Claude Code UX — streaming output, file tools, bash execution, grep/glob, MCP support, slash commands — but decouples it from the model provider. You configure a provider profile with /provider inside the app, and from that point on it's the same workflow regardless of whether you're hitting OpenAI, Gemini, GitHub Models, or a local Ollama instance.

Install is one line:

npm install -g @gitlawb/openclaude

Then to run it against GPT-4o:

export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_API_KEY=sk-your-key-here
export OPENAI_MODEL=gpt-4o

openclaude

And to run it fully locally with Ollama and qwen2.5-coder:

export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_BASE_URL=http://localhost:11434/v1
export OPENAI_MODEL=qwen2.5-coder:7b

openclaude

That last one costs you nothing per token. For a lot of tasks — refactoring, writing tests, explaining a codebase — a 7B coder model running locally is plenty.

Wiring It Into a Next.js / TypeScript Project

The practical use case for most of us is dropping OpenClaude into an existing project and having it understand the codebase. Because it has access to bash, grep, and glob tools natively, it can actually navigate your repo structure rather than working blind.

A pattern I'd use for a Next.js app is to give it a .openclaude config at the repo root with project-specific context:

{
  "systemPrompt": "This is a Next.js 14 app using the App Router, TypeScript strict mode, Tailwind, and Prisma with a PostgreSQL database. All API routes live in app/api. Prefer server components unless interactivity is required. Never use 'any'.",
  "tools": ["bash", "file", "grep", "glob"]
}

Then you can run tasks like:

openclaude "Add rate limiting middleware to all routes under app/api/payments"

And it has enough context to actually write something useful rather than generic boilerplate.

The MCP (Model Context Protocol) support is the other interesting bit. If you've already set up MCP servers for your project — say, one that talks to your database schema or your design system tokens — OpenClaude can consume those same servers. You're not rebuilding your tooling for a different agent.

Model Switching as a Real Workflow

Here's the thing that makes OpenClaude genuinely useful beyond just being a free Claude Code: you can benchmark models on your actual codebase.

I'd set up a shell function to swap providers quickly:

function oc-openai() {
  CLAUDE_CODE_USE_OPENAI=1 OPENAI_API_KEY=$OPENAI_API_KEY OPENAI_MODEL=${1:-gpt-4o} openclaude
}

function oc-local() {
  CLAUDE_CODE_USE_OPENAI=1 OPENAI_BASE_URL=http://localhost:11434/v1 OPENAI_MODEL=${1:-qwen2.5-coder:7b} openclaude
}

function oc-gemini() {
  GEMINI_API_KEY=$GEMINI_API_KEY OPENAI_MODEL=gemini-2.0-flash openclaude
}

Now oc-local llama3.1:8b vs oc-openai gpt-4o-mini on the same task gives you real cost/quality data for your specific codebase. That's worth more than any benchmark paper.

What I'd Build With This

1. A cost-aware coding agent wrapper for a team. Build a thin Node.js script that routes tasks to different backends based on complexity. Simple rename refactors go to a local Ollama model. Anything touching auth or payments routes to GPT-4o. You'd use OpenClaude's OpenAI-compatible interface as the consistent layer and just swap env vars based on task classification.

2. A PR review bot that runs in CI. OpenClaude can read files and run bash — wire it up in a GitHub Actions workflow to review diffs against your coding standards file. Point it at a cheap Gemini Flash model to keep costs near zero. You'd call the CLI programmatically, capture stdout, and post the result as a PR comment.

3. A local-first coding assistant for client work. Some client projects have NDAs that make cloud APIs awkward. Running qwen2.5-coder:32b locally through OpenClaude gives you a capable agent with zero data leaving the machine. Set up the system prompt with the client's conventions and you've got a compliant, project-aware assistant.

The interesting thing about OpenClaude isn't that it's technically revolutionary — it's that it makes the agent layer a commodity. The model is now just a config value, and the workflow stays consistent. For anyone building internal tooling or trying to control AI costs across a team, that's the actual unlock.

🤖

Feed this to Buddy?

Worth 4 XP · 🔮 circuit chip · feeds & evolves your TamaAussie

← All postsThanks for reading 🌿