OpenCode is the best open-source daily coding agent for broad provider choice and several polished surfaces. OpenHands is the best open-source platform for autonomous jobs, Docker-sandboxed execution, and self-hosting. Aider is the smallest mature terminal harness and has the best default git hygiene. The Claude Agent SDK is the official programmable Claude Code loop in Python and TypeScript, with MIT-licensed packages but Anthropic service terms and API authentication. Gemini CLI remains Apache 2.0, but individual free and consumer-plan access moved to the closed-source Antigravity CLI in June 2026, which is a useful warning that open client code and model entitlement are separate.
- Open source is not the same as free inference. Model tokens, hardware, and hosting still have an owner.
- OpenCode is the strongest general-purpose open-source daily driver.
- OpenHands is a platform for autonomous and self-hosted workflows, not merely another terminal chat.
- Aider stays valuable because automatic commits make every agent edit reviewable and reversible.
- The Claude Agent SDK exposes the Claude Code loop as a library, but it uses API authentication for third-party products.
- Audit the license by directory and component; enterprise code can carry different terms from the core.
Open source, free software, free models, and self-hosting are four claims
The phrase “open-source coding agent” often compresses four questions into one. They need separate answers because each creates a different kind of control and a different bill.
| Claim | What it actually means | What it does not promise |
|---|---|---|
| Open-source client or harness | You can inspect, modify, and redistribute code under its license | Free model inference, a sandbox, or a hosted service |
| Free software | The maintainer charges no license or seat fee for that component | No API token bill, cloud bill, or hardware cost |
| Self-hostable | You can operate the service or runtime on infrastructure you control | Simple maintenance, offline operation, or a permissive license for every module |
| Local-model compatible | The harness can call inference on hardware or a server you control | Frontier quality, fast latency, or zero hardware and power cost |
OpenCode and Aider are free software that can call paid APIs or local models. OpenHands core can run locally and self-host, while its enterprise directory carries separate terms. The Claude Agent SDK packages are visible on GitHub and MIT licensed, while use of Anthropic's service remains governed by Anthropic's commercial terms. Gemini CLI is Apache 2.0 even though Google moved individual inference entitlement to a different closed-source client. One adjective cannot summarize those arrangements.
The open-source choices at a glance
Licenses and product shapes checked against first-party repositories and documentation in August 2026.
| Project | License shape | Primary surface | Runtime boundary | Best for |
|---|---|---|---|---|
| OpenCode | MIT | TUI, desktop, editor extensions, server, SDK | Your process or environment; permissions configurable | Daily use, many providers, local models |
| OpenHands | MIT core; enterprise directory separate | CLI, local GUI, headless, SDK, hosted platform | Docker sandbox recommended locally | Autonomous jobs and self-hosting |
| Aider | Apache 2.0 | Terminal | Your process, container, or VM | Small harness and automatic git commits |
| Claude Agent SDK | MIT SDK packages plus Anthropic service terms | Python and TypeScript library | Your process and the permissions you configure | Embedding the Claude Code loop in a product |
| Gemini CLI | Apache 2.0 | Terminal | Your process plus available sandbox modes | Enterprise license or paid-key users who need its existing ecosystem |
The table excludes projects that could not be verified from the site's existing coverage and first-party material used for this guide. That is deliberate. A young category accumulates renamed repositories, unmaintained forks, and “open” products whose server is missing. A shorter list with inspectable claims is more useful than a catalog padded for breadth.
Stars are also absent. They indicate attention and can improve the odds of community support, but they do not answer whether the license covers the runtime, whether the current release recognizes your model, or whether the agent leaves a clean diff. Check repository activity directly when you adopt, then pin a version and define an update owner.
OpenCode: the open-source daily driver
OpenCode is the most direct open-source replacement for a proprietary daily coding agent. The repository is MIT licensed. The product spans a terminal interface, desktop app, VS Code and Zed integrations, a server mode, and SDK paths. Its provider layer uses models.dev and supports a large catalog, including local models, which lets the harness remain stable while the model route changes.
That breadth is the reason to choose it. You can use a direct provider key, a gateway, a local endpoint, or OpenCode's optional first-party paid routes without replacing the agent interface. The model decision and the harness decision stay separate. For organizations with an approved inference gateway or a requirement to keep prompts on a private endpoint, that separation is often the whole procurement case.
OpenCode is not automatically safe because it is open. Its configuration controls permissions, and the documented defaults can allow operations unless you tighten them. The code runs with the reach of the process and environment you give it. Put unattended runs in a container or disposable VM, scope provider credentials, and require review before external side effects. Source access helps you audit the path. It does not create a boundary by itself.
| OpenCode strength | Operational consequence |
|---|---|
| Many providers and local models | You own model selection, credentials, compatibility testing, and budgets |
| Several first-party surfaces | A team can use terminal, desktop, or editor without changing the underlying agent |
| MIT code | Forking is legally straightforward, but carrying the fork is your maintenance work |
| Server and SDK modes | Useful for integration, and another network and auth surface to secure |
| Optional paid model routes | Convenient, but still separate from the free software license |
Best fit: a developer or team that wants one open client across several model providers and is willing to own permission defaults, upgrades, and the provider bill. Poor fit: a team that wants a single vendor responsible for the model, harness, policy, and support contract.
OpenHands: the autonomous platform
OpenHands is larger in scope. It supports a terminal, local web interface, headless execution, SDK-based composition, hosted use, and self-hosted deployment. The recommended local sandbox runs the agent server inside Docker. That matters because autonomous work executes arbitrary commands, installs dependencies, and may browse or contact services. A disposable runtime is part of the product rather than an optional afterthought.
The core OpenHands code and agent-server images are MIT licensed. The repository's enterprise directory is source-available under a separate enterprise license. This is a normal open-core shape, but it has to appear in a serious comparison. “The repository is public” is not the same claim as “every directory can be used and redistributed under MIT.” Read the license files for the components you plan to deploy.
Docker isolation also needs precise language. A container protects host files and processes that are not exposed to it. A directory mounted read-write can still be modified or deleted by the agent. A credential passed into the container can still be used. Internet access still creates an exfiltration path. Mount only the repository or worktree needed for the task, use read-only mounts for reference material, and issue tokens that cannot merge or deploy.
| Choose OpenHands when | Do not choose it merely because |
|---|---|
| You need autonomous issue work in disposable environments | A terminal agent looked less impressive in a demo |
| You want to self-host an agent platform with a documented runtime model | The core license says MIT |
| You need CLI, GUI, headless, and SDK routes around one platform | The hosted trial appears free |
| You can own Docker images, secrets, updates, logs, and network policy | Containers are assumed to make every credential safe |
OpenHands is the strongest option here when platform control matters more than a tiny local footprint. That control comes with an operator's job. If the team only wants an agent in a terminal, OpenCode or Aider is a smaller system to own.
Aider: the small harness with the best git default
Aider is Apache 2.0 software and a mature example of the terminal-harness approach. It maps a repository, sends selected context to a chosen model, applies edits, and integrates tightly with git. Its default to commit agent changes is the important feature. The commit gives every edit a durable review boundary and makes reversal an ordinary git operation.
The model layer is broad. Aider can call major hosted providers, OpenAI-compatible endpoints, and local model servers. That makes it a good fit for policy-driven routing and experiments with local inference. It also means the user owns model naming, API keys, token budgets, and the gap between a new provider release and harness support.
Aider's release cadence slowed after its rapid-growth period. The project is not archived and commits have continued, but a team standardizing on it should inspect the current release and default-branch activity at the time of adoption. In a category where model identifiers and APIs change frequently, cadence is a compatibility property, not a vanity metric.
| Aider default | Why it is useful |
|---|---|
| Agent edits become commits | Review and rollback use normal git history |
| Pre-existing dirty work can be separated | Human and agent provenance do not silently mix |
| Model provider is selectable | The harness does not force one inference vendor |
| No software subscription | Light use can be cheaper than a seat; heavy frontier use can be more expensive |
| Small terminal surface | Less machinery to configure, fewer managed features to rely on |
Choose Aider when you value a compact, inspectable loop and git history more than the newest orchestration surface. Treat it as the baseline every paid terminal agent has to beat in your repository.
Claude Agent SDK: the Claude Code loop as a library
The Claude Agent SDK was previously called the Claude Code SDK, which explains the older search term. It exposes the same class of agent loop as Claude Code: built-in file and command tools, context management, sessions, permission handling, subagents, skills, and MCP integration. Official packages exist for Python and TypeScript.
The SDK belongs in this guide with a qualification. The Python repository and package code are published under an MIT license, and the TypeScript package is likewise inspectable through Anthropic's official source. Using the SDK with Anthropic models is still a service relationship. Anthropic's documentation directs third-party products to API-key authentication and states that offering claude.ai login or subscription limits through a third-party agent requires prior approval. An open SDK does not turn a consumer subscription into a resale API.
| Use the CLI | Use the Agent SDK |
|---|---|
| A script needs to run one coding task and return a result | Your program needs structured events throughout the run |
| A human may resume or inspect the session directly | Your application owns the interface and lifecycle |
| Shell invocation and JSON output are enough | You need custom permission callbacks, tools, or embedded orchestration |
| You want the supported product with minimal code | You are building and operating an agent product |
The SDK gives a team more control than the terminal, and more liability. Your program chooses allowed tools, working directory, settings sources, hooks, and how results are stored. It must also handle secrets, cancellation, retries, cost, logs, and a user-visible review path. “The loop is provided” removes a large implementation burden. It does not remove the product and security work around the loop.
Gemini CLI is the cautionary example
Gemini CLI remains an Apache 2.0 repository, but Google stopped serving individual free, Google AI Pro, and Google AI Ultra users through that client on 18 June 2026. Those consumer paths moved to Antigravity CLI, a closed-source successor. Gemini CLI remains supported for Gemini Code Assist Standard and Enterprise licenses, Google Cloud paths, and paid API-key access.
Nothing about the open-source license was revoked. The client code stayed open. What changed was entitlement to the service behind the client. That distinction is the most useful lesson in this guide: control of the harness and access to a model are separate contracts. A team that requires a route to survive a vendor product change needs a local model or another provider, not only an open client.
Use this test on every project: if the default hosted endpoint disappeared tomorrow, could you point the harness at another compatible model without rewriting the workflow? OpenCode and Aider are designed around that portability. OpenHands can be configured around several model paths. The Claude Agent SDK deliberately targets Anthropic's loop and service. Different answers are valid when they are explicit.
The real cost of a free repository
Open-source agent cost has four meters. The repository license is only the first, and often the smallest.
| Meter | Typical cost | Control |
|---|---|---|
| Software | $0 for the core projects here | License, version pin, fork policy |
| Inference | API tokens, hosted subscription, or local-model hardware | Provider budget, model routing, context discipline |
| Runtime | Developer laptop, Docker host, VM, or cluster | Concurrency cap, image size, idle shutdown, logs |
| Operations | Updates, credential rotation, incident response, compatibility fixes | Named owner, update cadence, rollback plan |
| Review | Engineer time reading and correcting generated changes | Task size, branch isolation, required checks, WIP limit |
A local model can reduce the inference cash line to zero after hardware is available. It can increase elapsed time and maintenance, and may increase review work if the model is less reliable on the repository. A frontier API can finish faster while creating an unbounded bill if the loop is allowed to retry without a limit. Measure accepted work per dollar and per review hour, not token price alone.
Self-hosting is most economical when it satisfies a real constraint: code locality, provider independence, data policy, predictable high utilization, or product customization. Self-hosting for the emotional comfort of “free” often costs more than a seat once upgrades and failures are counted.
Security and maintenance checklist
Source access makes an audit possible. It does not perform the audit. Before an open-source coding agent enters a company repository, verify the code and deployment path you will actually run rather than the homepage claim.
- Read the license files in every shipped component. Check the server, desktop client, enterprise directory, Docker image, SDK, and bundled dependencies separately.
- Pin a release or immutable image digest. “Latest” turns every restart into an unreviewed upgrade.
- List every network destination. Model provider, telemetry, update service, package registries, browser tools, and MCP servers all count.
- Issue task-scoped credentials. The agent should not inherit a token that can read every repository, merge protected branches, deploy, or reach production data.
- Define the writable mount. One repository worktree is a useful default. Home directories, SSH folders, cloud configs, and broad monorepo parents are not.
- Keep an audit trail. Store the prompt, selected model, tool actions, final diff, test results, and human approval without storing secret values.
- Assign an update owner. Someone must read security advisories, test new releases, rotate credentials, and know how to roll back.
- Test recovery. Kill a run mid-edit, revoke its token, remove its container, and prove the branch can be reviewed or discarded cleanly.
The existing AI coding agent security guide covers permissions, sandboxing, prompt injection, and secret scope in detail. The open-source-specific point is accountability: when you self-host, there is no vendor boundary to absorb configuration mistakes. You gain control and become the operator.
A two-week adoption test
Do not choose an open-source agent from a feature list. Run a short bake-off that exercises the reasons you wanted open source in the first place.
Choose two product shapes
Use OpenCode or Aider for a daily terminal test. Add OpenHands only if autonomous or self-hosted platform work is a real requirement. Add the Agent SDK only if you are building an application.
Run the same five tasks
Use one bug, one refactor, one test-only change, one documentation change tied to code, and one read-only security review. Start from clean worktrees.
Change the model once
Verify whether provider portability is real. Record configuration work, behavior drift, and whether the new model preserves tool use and output quality.
Exercise the boundary
Try a denied path, a missing secret, no network, a failing test, and cancellation mid-edit. A safe stop is a product feature.
Price the whole route
Count inference, runtime, maintenance setup, review minutes, and accepted tasks. Free software stays one line rather than becoming the conclusion.
Write the exit plan
Document where configuration, transcripts, branches, credentials, and local state live. Prove you can remove the tool without losing repository history.
Pick the smallest project that satisfies the constraint. OpenCode is the default when you need a flexible open agent. Aider is the default when you want minimal machinery and git boundaries. OpenHands is the default when you are operating an autonomous platform. The Claude Agent SDK is the default when your product needs Claude Code behavior as code. Buying more platform than the problem requires is still lock-in, even when the platform is forkable.
Questions people ask
OpenCode is the best general daily driver because it combines an MIT client, several surfaces, many providers, and local-model support. OpenHands is better for autonomous self-hosted jobs. Aider is better when you want a small terminal harness with automatic git commits.
The core OpenHands code and core agent-server images are MIT licensed. The enterprise directory is source-available under a separate enterprise license. Check the component and directory you plan to deploy rather than treating one repository badge as the whole answer.
The OpenCode software is MIT licensed and free. Inference is separate: use your own provider keys, a local model, or optional OpenCode paid routes. A free client using a paid API still has a token bill.
The repository is active but its release cadence slowed from its earlier pace. Inspect the latest release and default-branch activity before standardizing, especially because provider model names and APIs change quickly.
The official Python and TypeScript SDK packages are published in public repositories and use permissive package licenses. Use of Anthropic models and services remains governed by Anthropic terms, and third-party products should authenticate through approved API routes.
OpenCode, Aider, and OpenHands can use local-model routes, but offline operation also requires local dependencies, no web or MCP calls, and a model capable enough for the task. The harness being open source does not make a hosted model offline.
Docker narrows host reach, but mounted files can still be modified, passed credentials can still be used, and network access can still leak data. Mount one worktree, scope tokens, restrict the network, and keep merge and deploy outside the agent.
Because the Apache 2.0 repository still exists and enterprise, Google Cloud, and paid-key routes remain. It demonstrates that an open client license and entitlement to a vendor model service are separate contracts.
Sources
Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.