AI Agents

Self-hosted Claude Code alternatives

People search this for two completely different reasons, and the right answer depends entirely on which one you are. Sorting that out first will save you a migration you did not need.

Which problem do you have?

  • “I want it running somewhere that is not my laptop.” You do not need an alternative. Claude Code runs perfectly well on a server — we install it in under a minute and it leaves nothing running between sessions. Skip to moving it.
  • “I do not want to depend on one vendor.” Then you do need a different agent, because Claude Code is closed source and talks to Anthropic models only. Skip to the alternatives.

If you just want it off your laptop

Claude Code is closed source, so you cannot self-host it in the licence sense. You can still run it on a machine you own, which is what most people actually mean. We measured it on a 1 vCPU / 1 GB server: it installs in under a minute, and an idle box sits at its operating-system baseline because Claude Code is invoked per session rather than run as a service.

The honest limit: because it is invoked per session, it cannot pick up work while you are away. If you want an agent that responds to a schedule or a webhook, that is a different shape of tool — see OpenClaw and Hermes below. Step-by-step: Run Claude Code & Codex on a VPS.

The alternatives

All open source, all runnable on your own hardware. The column that matters most is “any model” — that is the property Claude Code does not have, and the reason most people end up on this page.

Self-hostable alternatives to Claude Code: OpenCode, goose, OpenClaw, Hermes Agent, Cline, Aider, Pi, OpenHands
AgentLicenceAny modelLocal modelsInterface
OpenCodeMITCLI, TUI, Desktop app, Web UI
gooseApache-2.0YesFullCLI, Desktop app, API
OpenClawMITYesVia proxyCLI, Desktop app, API
Hermes AgentMITYesVia proxyCLI, Desktop app, API
ClineApache-2.0YesFullIDE extension, CLI
AiderApache-2.0YesVia proxyCLI
PiMITYesCLI, TUI, SDK
OpenHandsMITYesFullWeb UI, CLI, API

Blank cells mean the project does not state it and we did not infer it. Full sources per cell in the comparison matrix.

OpenCode — the closest swap

A terminal agent with the same basic ergonomics, and the largest open-source agent by adoption. It asks permission before running shell commands. If you want to change as little as possible about how you work, start here. We do not host it.

goose — if governance is the point

Apache-2.0, built at Block, now stewarded by the Linux Foundation. Speaks MCP natively and runs against 15+ providers including local Ollama. If you are here because a vendor changed the terms on you, a foundation-governed project is a materially different bet — Google retiring Gemini CLI for a closed-source successor made that concrete this year.

OpenClaw and Hermes — for work that continues without you

These are not CLIs you invoke; they hold a process open, so they can act on a schedule or answer a channel. That is a capability Claude Code does not have at all. Measured on a 1 vCPU / 1 GB box, OpenClaw idles at 278 MB and Hermes at 120 MB. Both are ones we host, so weigh that accordingly.

Cline — if you want it in your editor

A sidebar agent for VS Code and JetBrains that now ships a CLI too. The right answer if leaving the editor was the friction.

Aider — if you want reviewable changes

Git-native: it commits as it works, so every change is a diff you can read and revert. Unfashionable and extremely practical on a codebase you care about.

What “self-hosted” does and does not buy you

The most common misunderstanding on this topic: self-hosting the agent does not mean the AI runs on your server. You host the program that reads your files and runs your commands. The model still runs on a provider’s API and you still pay per token — unless you point the agent at a local runtime like Ollama, which needs far more machine than the agent does.

What you genuinely gain:

  • Switching providers becomes a config change instead of a migration.
  • The agent keeps running when your laptop closes.
  • Nobody can retire the client out from under you — the source is yours.

And what it costs you, stated plainly:

  • You own updates, backups and the security of the box.
  • Claude Code is a genuinely polished tool; most of these are rougher.
  • A server is a small monthly cost you did not have before.

We wrote the honest version of that trade-off, including the evidence against ourselves, in managed vs self-hosted.

What it takes to run one

Smaller than expected. Measured on real servers, thirty seconds after a live model request:

AgentMemory at idleProven on
Claude Codenothing resident1 vCPU / 1 GB
Hermes Agent120 MB1 vCPU / 1 GB
OpenClaw278 MB1 vCPU / 1 GB
OpenHands846 MB1 vCPU / 2 GB

We have not measured OpenCode, goose, Cline, Aider or Pi on our infrastructure, so there are no numbers here for them rather than estimates.

Related