Skip to content

OpenClaude Setup Guide 2026: Run OpenAI, DeepSeek, Gemini, Ollama in One CLI

openclaude logo

Problem

I was deep in a long Claude Code session when the quota ran out. Mid-refactor. The task was clear in my head, but I had to stop and think: fall back to another CLI? Re-learn its config? Abandon the whole workflow?

That is the real pain with coding agents today: model/provider choice is coupled to the tool. If you want a strong model for hard reasoning, a cheap model for mechanical edits, and a local model for sensitive code, you normally juggle several CLIs with several configs.

This post shows how to install OpenClaude, configure different providers (OpenAI, DeepSeek, Gemini, OpenRouter, Ollama), and switch models — all inside one terminal coding-agent workflow.

Think of OpenClaude as a terminal coding-agent shell whose model backend is replaceable.

What Is OpenClaude?

OpenClaude architecture separating coding agent workflow from LLM providers

OpenClaude is an open-source, terminal-first coding agent CLI. Four words matter:

  • open-source
  • terminal-first
  • coding agent (not a chatbot)
  • multi-provider

A coding agent does more than answer prompts. It can inspect a repository, read and edit files, run shell commands, search with grep/glob, run tests, spawn subagents, talk to MCP servers, handle slash commands, and stream output. The workflow stays mostly the same while the model underneath can change.

I verified the install commands, env var names, and slash commands in this post against the official README and docs at writing time (v0.30.0, released 2026-08-31). Do not treat my commands as a guess — check the official docs if in doubt, because commands change between releases.

Architecture: Agent Workflow Decoupled From Model Provider

This is the mental model to keep for the whole post:

OpenClaude architecture
Developer
OpenClaude CLI
Agent Tools: Bash, Read/Write/Edit, Grep/Glob, Agents, MCP, Skills
Provider Layer: OpenAI/Codex, Gemini, DeepSeek, OpenRouter, OpenGateway, Ollama

The key idea: the agent workflow (tools, prompts, session loop) and the model provider are two separate layers. You swap the bottom layer without touching the top.

Install OpenClaude

Prerequisites first. OpenClaude requires Node.js 22 LTS or newer. Then install the npm package globally:

Install OpenClaude
node --version # make sure it is 22 LTS or newer
npm install -g @gitlawb/openclaude@latest

Verify the install:

Verify installation
openclaude --version
openclaude --help

Then launch it inside a Git repository:

Launch OpenClaude
cd my-project
openclaude

If your shell says command not found right after installing, restart the terminal (or fix the npm global bin path on Windows) before assuming the install failed.

Your First OpenClaude Coding Session

Do not configure ten providers before trying anything. Start with one simple task that shows what an agent loop feels like.

Inside your project, give OpenClaude three prompts in order:

Session prompts
1. "Inspect this repository and explain the architecture before changing anything."
2. "Find duplicated validation logic and suggest a refactoring plan."
3. "Implement the smallest safe refactor and run the relevant tests."

Watch what happens. OpenClaude does not answer once and stop. It loops: read a file, grep for usages, inspect callers, edit, run tests, read the result. That loop — read → grep → inspect → edit → test — is the difference between a single-shot prompt CLI and a real coding agent.

Configure LLM Providers in OpenClaude

Provider and model are two different concepts:

  • Provider: OpenRouter, OpenAI, Gemini, DeepSeek, Ollama, and other OpenAI-compatible endpoints
  • Model: the specific model served by that provider

There are two ways to configure a provider: the interactive /provider command, or environment variables. The /provider flow is the recommended path for daily use. It lets you pick a provider, enter the API key, and save a profile, so you do not re-export keys in every terminal.

One important fact I found in the docs: OpenClaude does not automatically load .env files. Use /provider (or export vars in your current shell) instead of relying on a .env file.

The /model command switches the active model without changing the base URL. That is the command you will use most when testing “which model is better for this task”.

Model IDs change faster than provider configuration

Provider setup — the endpoint, the API key, the saved profile — is the stable part and rarely needs to change. The model catalog is a different story:

  • Model IDs and availability update frequently: providers ship, rename, retire, and gate models on their own schedule.
  • Preview and free models can appear and disappear at any time, sometimes without notice.
  • A model ID that works today may be gone or renamed tomorrow.

So do not treat any model name printed in this article as a permanent fact. The examples below are marked Example only and are not recommendations. To pick a model that exists right now, open /model in OpenClaude to see what the provider currently offers (live on OpenRouter / OpenGateway), or check the provider’s official model catalog.

Four Provider Examples

In each example below, the endpoint and API key are the stable part of the setup, while MODEL_ID is a placeholder. Pick an ID that exists today via /model or the provider’s catalog instead of copying a name from this article.

1. OpenRouter — one API, many models

OpenRouter is a good starting provider because one API key reaches a large model catalog. Set it up with the OpenAI-compatible route:

OpenRouter
export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_API_KEY=YOUR_API_KEY
export OPENAI_BASE_URL=https://openrouter.ai/api/v1
export OPENAI_MODEL=<MODEL_ID>
openclaude

<MODEL_ID> is a placeholder — the endpoint and API key above are the stable part of the setup. At the time of writing, one example is google/gemini-2.5-pro (Example only — model IDs and availability change frequently).

Since v0.30.0, OpenRouter (and OpenGateway) get live model lists. New models appear in the picker dynamically instead of waiting for a static list update. So the reliable way to choose a model is: run openclaude, open /model, and select a currently available model — no need to copy an ID from this article. You can also cross-check against OpenRouter’s official model catalog.

2. DeepSeek — cheap, OpenAI-compatible

DeepSeek exposes an OpenAI-compatible endpoint, so the config shape is the same as OpenRouter but with a different base URL:

DeepSeek
export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_API_KEY=YOUR_API_KEY
export OPENAI_BASE_URL=https://api.deepseek.com/v1
export OPENAI_MODEL=<MODEL_ID>
openclaude

The stable part is the base URL https://api.deepseek.com/v1 plus your DeepSeek API key. <MODEL_ID> is a placeholder — at the time of writing, one example is deepseek-v4-flash (Example only — model IDs and availability change frequently). Check DeepSeek’s official docs for the current list of model IDs, and use /model to switch between them.

DeepSeek suits routine coding, code review, repository exploration, and cost-sensitive workloads. I am not claiming it is stronger than other models — pick it when it fits the task and the budget.

3. Gemini — for the Google AI ecosystem

If you already use Google AI, there is a native Gemini route:

Gemini
export CLAUDE_CODE_USE_GEMINI=1
export GEMINI_API_KEY=YOUR_API_KEY
export GEMINI_MODEL=<MODEL_ID>
openclaude

The stable part is CLAUDE_CODE_USE_GEMINI=1 plus your Google AI API key. <MODEL_ID> is a placeholder — at the time of writing, one example is gemini-3-flash-preview (Example only; preview models are especially likely to be renamed or retired). Check Google’s official model catalog for current IDs, and use /model to switch.

You can also reach Gemini through OpenRouter if you prefer one key for everything.

4. Ollama — local inference

OpenClaude with Ollama local coding model architecture

Ollama splits into two parts: provider configuration and suggested local models. They should not be conflated. The provider configuration is:

Ollama (provider configuration)
export CLAUDE_CODE_USE_OPENAI=1
export OPENAI_BASE_URL=http://localhost:11434/v1
export OPENAI_MODEL=<YOUR_OLLAMA_MODEL>
openclaude

Point OpenClaude at your local Ollama server; the base URL http://localhost:11434/v1 is the stable part. <YOUR_OLLAMA_MODEL> is the name of a model you have already pulled locally — check ollama list for exact IDs and run ollama pull <model> first if needed.

Suggested local models. Coding-tuned models are usually a better starting point for agent workflows, but tool-calling quality varies significantly — so test a candidate on your own hardware instead of assuming any locally popular model works well as a coding agent.

The flow is: OpenClaude CLI → localhost → Ollama → local coding model. The real difference here is not “free”: it is local inference, source code that can stay local, and no per-token API bill. The limiting factor becomes your hardware.

Switch Models Without Switching Coding Agents

OpenClaude workflow switching between strong lower-cost and local coding models

This is the core demo. One session, one workflow, several model tiers:

Switch models without switching agents
1. Analyze a large repository → strong reasoning model
2. Edit repetitive code → lower-cost model
3. Review the diff → strong reasoning model
4. Handle sensitive code → local coding-capable model (offline)

In practice:

  1. Ask the strong reasoning model to map out the repository and propose a plan.
  2. Run /model, switch to a lower-cost model, and let it perform the mechanical edits.
  3. Run /model again, switch back to the strong reasoning model, and review the diff.
  4. For code you do not want to send anywhere, switch to a local coding-capable model and keep it local.

Which exact model fills each tier is a moving target — pick what is available today via /model instead of pinning to a specific ID.

The value is not “supports many models”. The value is that model choice becomes part of the workflow.

Environment Variables vs /provider

Both work. Use the right one for the situation:

ApproachBest for
Environment variablesCI/CD, containers, ephemeral environments, scripting
Saved /provider profilesDaily development, frequent model switching, multiple accounts or endpoints

Environment variables are per-shell. Export them in the shell you launch OpenClaude from. The interactive /provider configuration reduces the daily repetition of exporting API key and base URL. All example keys above are placeholders — never commit a real key.

Useful OpenClaude Commands

A short table of the commands I verified against the official docs (I left out commands I could not confirm):

CommandWhat it doesWhen to use
/providerPick a provider and enter or update the API key interactivelyFirst-time setup, fixing auth issues
/modelSwitch the active model without changing the base URLTrying a new model mid-session
/costShow a summary of turn distribution and estimated savingsReviewing spend across models
/repomapInspect and tune the repo map cacheControlling context usage on large repos

For diagnostics, openclaude doctor report --markdown prints a redacted issue report you can read or share.

What Changed in OpenClaude 0.30?

v0.30.0 shipped on 2026-08-31. Two changes matter to a normal user:

  • LLMTR hybrid gateway: a gateway that mixes dynamically discovered models with curated ones, refreshing in the background.
  • Live model lists for OpenRouter / OpenGateway: models are discovered and refreshed instead of sitting in a static list.

So what? Multi-provider stops being a marketing number. When a provider ships a new model, the OpenClaude picker can reflect it without waiting for a release that updates a hardcoded list. Newly released models become visible in your workflow faster — and the /model picker stays a reliable way to find what is currently available.

A Practical Multi-Model Cost Strategy

You do not need the most expensive model for every token in a session. Separate high-cost reasoning from low-cost execution:

TaskSuggested model tier
Architecture reasoningstrong
Difficult debuggingstrong
Repository explorationmedium
Repetitive editscheap
Formatting / docscheap
Sensitive codelocal

Actual cost depends on provider, model, context length, and token usage. This table is a strategy, not a promise of savings.

Local Model Limitations

OpenClaude makes local models easier to integrate into a coding-agent workflow. It does not make local models as good as frontier models. Limits to expect:

  • Tool-calling reliability varies by model
  • Instruction following varies by model
  • Context window is smaller
  • Inference speed depends on hardware
  • Large-repository reasoning is slow or shallow
  • Some models are simply incompatible with agent tool use

The honest conclusion: use local models where their constraints do not hurt the task.

Security Considerations

A coding agent can execute bash, modify files, install packages, and talk to MCP servers. Treat it with the same care as any powerful tool:

  • API keys: never commit them. Use /provider or shell env vars.
  • Shell permissions: do not hand the agent unrestricted permissions until you trust its behavior.
  • Third-party plugins and skills: inspect the source before installing.
  • MCP servers: an MCP server expands what the agent can reach. Remote MCP, web tools, and cloud services can send data off your machine.
  • Local models are not automatically secure: local inference keeps the prompt local, but if the agent still uses remote MCP servers or web tools, data can still leave the machine.

OpenClaude vs Claude Code

A quick, neutral comparison (a full head-to-head deserves its own article):

FeatureOpenClaudeClaude Code
Open sourceYesNo
Model providersCloud + local (OpenRouter, DeepSeek, Gemini, Ollama)Anthropic models
Anthropic modelsOptional, via API or OpenRouterNative
OpenAI-compatible APIsYesLimited or experimental
Local OllamaNativeNot by design
MCPYesYes
Terminal workflowYesYes
Provider switchingCore featureNot by design
Official Anthropic supportNoYes

Claude Code is a vertically integrated experience around Anthropic models and services. OpenClaude is a provider-flexible open-source coding-agent environment. They are different answers to the same question.

Who Should Use OpenClaude?

Good fit:

  • Developers experimenting with multiple models
  • People who already pay for API access (OpenAI, DeepSeek, OpenRouter)
  • Local-model users
  • Cost-conscious developers
  • Anyone who wants an open-source terminal agent

Better served elsewhere:

  • Users who want official Anthropic integration and a fully managed experience
  • Users who do not want to maintain provider configuration or deal with model-compatibility issues

Troubleshooting

OpenClaude cannot see my model

If a model does not show up, check the name against the provider catalog. Free and preview models come and go — on OpenRouter, model availability fluctuates. Set an available model in OPENAI_MODEL or GEMINI_MODEL, then use /model to switch.

API key is configured but requests fail

Usually a wrong env var name or a key saved in the wrong profile. OpenClaude does not auto-load .env files, so confirm the vars are exported in the shell you launch from. Re-enter the key via /provider and try again.

OpenAI-compatible endpoint returns errors

Check that the base URL ends with /v1 (for example https://api.deepseek.com/v1) and that the model id matches what the provider accepts. A mismatched model id is the most common cause — confirm the current ID in the provider’s catalog or /model before debugging anything else.

Ollama model connects but tool calls fail

This is a model capability problem, not a wiring problem. Small or general instruct models often miss tool calls. Try a coding-tuned model and verify the model actually loaded in Ollama with ollama ps. If you see CPU in processor mode, latency will be higher but the setup is valid.

The model stops before finishing a task

Usually a context window or output limit problem. For Ollama, OpenClaude can use longer context via OPENCLAUDE_OLLAMA_NUM_CTX (the default is 32,768 tokens in many setups). For other endpoints you can raise limits per deployment in settings.json:

~/.openclaude/settings.json (example)
{
"modelLimits": {
"my-custom-deployment": { "contextWindow": 262144, "maxOutputTokens": 32768 }
}
}

Different providers behave differently

Expected. Tool calling, instruction following, and verbosity vary by model. Match the task to the model tier instead of expecting identical behavior.

OpenClaude works in one terminal but not another

Environment variables are per-shell. Export them again in the new terminal, or switch to a saved /provider profile so config survives shell restarts.

FAQ

What is OpenClaude? An open-source, terminal-first coding agent CLI that works with multiple model providers.

Is OpenClaude the same as Claude Code? No. Claude Code is Anthropic’s integrated agent around Anthropic models. OpenClaude is a provider-flexible open-source coding-agent environment.

Is OpenClaude free? The tool is open source. The models you run through it are billed by their providers (or run locally with Ollama).

Can OpenClaude use DeepSeek? Yes. It connects to DeepSeek’s OpenAI-compatible endpoint.

Can OpenClaude use OpenAI models? Yes, through the OpenAI-compatible route (CLAUDE_CODE_USE_OPENAI=1).

Can OpenClaude use Gemini? Yes, either natively (CLAUDE_CODE_USE_GEMINI=1) or through OpenRouter.

Can OpenClaude run local models? Yes, it supports local inference through Ollama.

Does OpenClaude support Ollama? Yes, it connects to a local Ollama server at localhost:11434.

Does OpenClaude support MCP? Yes, MCP servers are part of its agent tool layer.

Is OpenClaude safe? It is a powerful tool: it can run shell commands and modify files. Review permissions, inspect third-party plugins or skills, and keep API keys out of your repo.

What is the best model for OpenClaude? There is no single answer, and specific model names change often. Use a strong reasoning model for hard problems, a lower-cost model for mechanical edits, and a local coding-capable model for sensitive code. Compare the same task across models — via /model — to find what works for you.

Summary

In this post, I showed how to install OpenClaude, run a first coding session, configure OpenAI, DeepSeek, Gemini, OpenRouter, and Ollama, and switch models mid-session without switching tools. The key point is that OpenClaude decouples the coding-agent workflow from the model provider, so model choice becomes part of the workflow instead of a reason to change CLIs. Provider setup stays stable; only the model catalog moves — so pick your current model with /model rather than copying a name from this post.

If Claude Code taught developers that terminal-native coding agents are useful, OpenClaude explores the next question: what happens when the agent workflow is no longer tied to one model provider?

Try at least two providers, compare the same coding task across models, and check the official GitHub repository and docs for the latest commands.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments