OpenCode is the best open-source coding agent for most developers in 2026. It is MIT-licensed, works with more than 200 model providers, and runs in a terminal, a desktop app, on your phone or from your own scripts.

Pair it with a free hosted model from OpenCode Console or a local Qwen3.8-27B through Ollama and your next side project costs nothing in tooling. This guide sticks to the current docs, GitHub metadata and model cards, all checked on December 6, 2026. Older tutorials are already out of date.

Quick answer: what is the best open-source coding agent?

OpenCode takes the top spot. The project is MIT-licensed, its repository has about 231,000 GitHub stars, and the current release is v2.4.5. It ships with a build agent, a read-only plan agent, general and explore subagents, and a model picker that covers hosted APIs, gateways and local runtimes.

The free path is real, not a trial gimmick. OpenCode Console lists a rotating set of zero-cost models, including a free DeepSeek V4.1 Flash variant. If you would rather keep code on your own machine, OpenCode discovers Ollama, LM Studio and vLLM servers automatically and lets you run a coding agent locally with no per-token bill.

OpenCode homepage showing the desktop, terminal, mobile and SDK apps

Open source does not mean free to run

An open-source coding agent is the software loop. It reads files, plans a change, edits code, runs commands, reads the output and repeats. You can inspect that code, fork it and point it at any model you like.

The model is a separate cost. Most agents are bring-your-own-key tools, so the bill appears when you connect OpenAI, Anthropic, DeepSeek or another provider.

Free AI coding models come from three places:

  • Hosted free models from a gateway such as OpenCode Console, Kilo Gateway or Cline.
  • Local open-weight models served by Ollama, LM Studio or vLLM.
  • Limited free tiers from API providers, usually with tight quotas.

The rest of this guide is about picking one of those routes on purpose instead of accidentally.

How the best open-source coding agents compare

Star counts come from the GitHub API on December 6, 2026. They measure attention, not quality.

Agent License GitHub stars Best for Where it runs
OpenCode MIT 231k All-round use with hosted or local models Terminal, desktop, mobile, SDK
Codex CLI Apache-2.0 137k People who already pay for ChatGPT Terminal
Cline Apache-2.0 72k Approval-driven work inside an IDE VS Code, JetBrains, CLI, desktop
Kilo Code MIT 28k IDE users who want free model routing VS Code, JetBrains, CLI, desktop
Aider Apache-2.0 50k Git-first pair programming Terminal
Qwen Code Apache-2.0 31k Local Qwen setups Terminal, IDE plugins, desktop
Pi MIT 126k Minimal, build-it-yourself agents Terminal
Goose Apache-2.0 57k Code plus general automation Desktop, CLI
OpenHands MIT 95k Unattended agent work in sandboxes Self-hosted web app

Why OpenCode gets the top spot

Model freedom is the main reason. The OpenCode site says it supports more than 200 providers, and the docs show native packages for OpenAI, Anthropic, Google, Azure, Bedrock, OpenRouter and xAI. Ollama, LM Studio and vLLM are discovered automatically, so a local model shows up in /models without a config file.

The built-in agents are useful, not decorative. Build is the default coding agent. Plan explores the codebase and writes a plan without editing normal project files. General and Explore run as subagents in child sessions, and you can define your own agents in Markdown with their own model and permission rules.

Free access is built into the product. OpenCode Console carries the models the team has tested for coding-agent work, and a subset is priced at zero. The free models have a daily request limit, but there is no per-token charge.

There is independent evidence that OpenCode works as a harness, too. DeepSeek's model card for V4.1 Flash evaluates the model across several agent scaffolds, including OpenCode. In that card, OpenCode scored 65.5 on DeepSWE v1.1 and 85.0 on Terminal-Bench 2.1 with DeepSeek's 1M-token context. DeepSeek's own harness scored higher, which is a reminder that the scaffold matters. The point is that OpenCode is one of the harnesses a frontier lab bothered to test.

The downsides are worth stating. OpenCode 2 changed the install commands, config keys and plugin API, so a lot of 2025 advice will fail. Free models rotate and hit daily limits. The provider list no longer offers a direct Claude Pro or Max sign-in; Claude models now come through the Claude Agent integration, which uses a local Claude Code login, or through an Anthropic API key. The desktop, web and mobile apps are newer than the terminal, which remains the most mature surface.

If you want a deeper terminal walkthrough, our OpenCode TUI setup guide covers the interface, sessions and keybinds. For a direct comparison with a paid editor, see OpenCode vs Cursor.

Other agents worth your time

Cline is the best-known open-source agent for VS Code. It splits work into Plan and Act modes, and it asks for approval on file edits and terminal commands by default. It now also ships a CLI, a JetBrains plugin, a desktop app and a cloud option. Cline runs rotating free model promotions, with FREE-tagged models in the picker, and its ClinePass plan costs $9.99 per month for higher limits on open models. Our guide to using Cline with free OpenRouter models covers that setup.

Cline homepage showing its desktop, IDE, CLI and SDK products

Kilo Code is the strongest pick if you want an MIT-licensed agent with free routing built in. It started as a Roo Code fork and now runs in VS Code, JetBrains, the CLI, a desktop app and the cloud. Kilo's Auto Free option routes requests to free models through Kilo Gateway where available, and the platform itself is free for individuals. Kilo Code free models are a good fit for IDE users who do not want to manage API keys on day one. Kilo was acquired by Anaconda in 2026, and the repository remains active under the Kilo organization.

Kilo Code homepage showing its desktop app and editor integrations

Codex CLI is OpenAI's Apache-2.0 terminal agent. It makes the most sense if you already pay for ChatGPT, because OpenCode can sign in with a ChatGPT plan and use those models against your subscription. It is tuned for OpenAI models, so other providers feel like second-class citizens.

Qwen Code is Alibaba's Apache-2.0 terminal agent, optimized for Qwen models. It is a sensible pairing if you want the agent and the model both running on your own machine.

Aider is still a solid git-first pair programmer that commits every change with a clear message. Its latest tagged release is v0.86.0 from August 2025, even though the repository receives occasional commits. Do not expect many new features.

Pi, Goose and OpenHands serve narrower needs. Pi is a minimal MIT-licensed agent you can extend yourself. Goose is a general-purpose desktop and CLI agent under Apache-2.0. OpenHands is a self-hosted MIT agent built for unattended work in Docker sandboxes.

What changed in 2026

If you read a best-coding-agent post from 2025, parts of it are probably wrong now. Five changes matter:

  • Roo Code shut down. The repository was archived on May 15, 2026, after the team stopped work on the VS Code extension. Kilo Code is the easiest migration path because it started as a Roo Code fork.
  • Continue was acquired by Cursor. The Continue homepage confirms the acquisition, and the open-source code remains available, but the team's focus has moved to Cursor. Treat Continue as a legacy option for new setups.
  • Gemini CLI lost its consumer free tier. On June 18, 2026, Google moved free, Google AI Pro and Google AI Ultra users to the closed-source Antigravity CLI. Gemini CLI is still Apache-2.0 and works with enterprise Code Assist licenses, paid API keys and Vertex AI.
  • OpenCode shipped version 2. The install command moved to https://opencode.ai/v2/install, the npm package became @opencode/cli, and provider config moved from provider to providers. Direct Claude Pro and Max sign-in is gone; the Claude Agent integration replaced it.
  • DeepSeek V4 Flash was deprecated on October 26, 2026. Its replacement, DeepSeek V4.1 Flash, is the model now offered free on OpenCode for a limited time.

That last point matters for anyone following a tutorial that still recommends deepseek-v4-flash-free. The model ID changed, and the old one no longer works.

The free models you can use today

Free catalogs move quickly. Treat this table as a snapshot of December 6, 2026 and confirm the current list in your agent's model picker.

Route Works with What you get The catch
OpenCode Console free models OpenCode DeepSeek V4.1 Flash Free, Nemotron 3.5 Lightning Free, MiMo-V2.6-Flash Free, Big Pickle and more Daily request limit, rotating catalog
Kilo Auto Free Kilo Code Routing to free models through Kilo Gateway Upstream availability and limits
Cline free promotions Cline Rotating models tagged FREE Limited quota, promotions change
Ollama or LM Studio Most agents Unlimited use, full privacy Needs capable hardware and tuning
ClinePass or OpenCode Go Cline, OpenCode More reliable access to open models Paid, not free

OpenCode Console: the easiest free start

OpenCode Zen free models now live inside OpenCode Console, the gateway the OpenCode team documents as the tested model catalog. Sign in, run /connect, choose OpenCode, then run /models and pick an entry with no input price.

The current free list includes DeepSeek V4.1 Flash Free, MiMo-V2.6-Flash Free, Nemotron 3.5 Lightning Free, Nemotron 3.5 Super VL Free, Flint 40B Free, Hy4 flash Free, SubQ Savant 1.4 Free, Big Pickle, Jev 1.13 Free and several alpha models. DeepSeek V4.1 Flash Free follows a zero-retention policy and is not used for training, according to the OpenCode docs. Big Pickle and some alpha models do collect data during their free period, so read the privacy notes before you paste proprietary code.

Free models have a daily request limit. When you hit it, you can wait, switch to another free model or move to a paid model. To hide free models entirely, set OPENCODE_DISABLE_FREE_MODELS=1 on the server process.

OpenCode docs listing the current free models, including DeepSeek V4.1 Flash Free and Nemotron 3.5 Lightning Free

Local models: free forever, with homework

Running a coding agent locally removes rate limits and keeps your source code on your machine. The tradeoff is hardware. Agents send long system prompts and make many tool calls, so small models struggle. You want a large context window and reliable tool calling.

Qwen3.8-27B is the realistic pick for a single machine. It is a 27B dense model under Apache-2.0 with a 262K native context window that extends to 1M tokens. The Ollama build is about 18 GB and reports a 256K context window, so it fits a 24 GB GPU or a recent Mac with enough unified memory.

Ollama now has a direct OpenCode launcher. After pulling the model, run:

ollama pull qwen3.8 ollama launch opencode --model qwen3.8 

If you already have OpenCode running, start Ollama and select ollama/qwen3.8 from /models. OpenCode discovers the local server automatically. You only need a provider block when Ollama runs on another host or port.

Ollama page for Qwen3.8 showing the 27B model, 18 GB download, 256K context and an OpenCode launch command

If tool calls fail or the model forgets the conversation, raise Ollama's context size. A num_ctx value between 16k and 32k is a common fix. The default is often too small for an agent that reads several files per turn.

The best open-weight models for coding

These are the models worth knowing if you want to download weights or host them yourself. Scores are vendor-reported on different harnesses, so compare rows carefully and treat small gaps as noise.

Model License Size Context Notes
DeepSeek V4.1 Flash MIT 552B backbone, 763B released weights 1M tokens DeepSWE v1.1 score of 74.2 and Terminal-Bench 2.1 score of 90.6 in DeepSeek's harness. Too large for a home machine, so use a host or the free OpenCode endpoint
Qwen3.8-27B Apache-2.0 27B dense 262K native, 1M extended About 18 GB at the Ollama quantization. Terminal-Bench 2.1 score of 73.0 and SWE-bench Pro score of 61.7
GLM-5.3 Custom 753B 1M Strong terminal-agent scores, but the license needs a read before commercial use
Kimi K3 Custom 2.78T total Large Cluster territory. Useful through a hosted API, not on a desktop

DeepSeek V4.1 Flash is the cleanest pick license-wise. MIT has no revenue gate, no user cap and no separate commercial agreement. It is also the model behind the free OpenCode endpoint, so you can test it before you rent a GPU.

Qwen3.8-27B is the practical local choice. Apache-2.0 is permissive, the model is small enough for one GPU, and the benchmark gap to much larger models is smaller than the parameter count suggests. It will not match DeepSeek V4.1 Flash on the hardest repository-level tasks, but it is good enough for feature work, refactors and test fixes.

Hugging Face model card for DeepSeek V4.1 Flash showing 763B parameters, the MIT license, 552B backbone parameters and a 1M token context

For more model comparisons, our best coding models on OpenRouter guide tracks prices and context windows across providers. If you want a router that stitches several free providers together, the OmniRoute free vibe coding setup is a good companion.

How to set up OpenCode with a free model

This is the short path from nothing to a working agent. The commands below match OpenCode 2.4.5.

Step 1: Install OpenCode

Use the method from the OpenCode docs, since install commands change between major versions.

# Install script, macOS and Linux curl -fsSL https://opencode.ai/v2/install | bash # npm npm install -g @opencode/cli # Homebrew brew install anomalyco/tap/opencode-v2 

Windows package managers are not supported. Download the standalone Windows binary from the OpenCode site, or install inside WSL.

Step 2: Connect OpenCode Console

Create an OpenCode account, then start OpenCode inside your project folder and run:

/connect 

Choose OpenCode and sign in. If you already have an API key, set OPENCODE_API_KEY instead.

Step 3: Pick a free model

Run:

/models 

Choose an entry with no input price, such as DeepSeek V4.1 Flash Free. Model IDs use the opencode/<model-id> format, for example opencode/deepseek-v4.1-flash-free.

Step 4: Plan first, then build

Switch to the Plan agent, describe the project and review the plan. When the approach looks right, switch to Build and let it implement one piece at a time. This one habit improves results on free models more than any prompt trick.

Optional: use a local model instead

Install Ollama, pull Qwen3.8-27B and launch OpenCode against it:

ollama pull qwen3.8 ollama launch opencode --model qwen3.8 

For a remote Ollama server, add a provider block in opencode.json using the OpenCode 2 shape:

{ "$schema": "https://opencode.ai/config.json", "providers": { "ollama": { "settings": { "baseURL": "http://gpu-host:11434/v1" } } } } 

Match the model name to what ollama list shows on your machine, since tags vary.

Practical tips for free models

Free models are less forgiving than frontier ones. These habits make a real difference.

  • Plan first, build second. Cheap models do much better when the path is already clear.
  • Keep tasks small. One feature, one bug or one refactor per session.
  • Write an AGENTS.md file with your stack, commands, code style and rules. Our AGENTS.md reference has a template.
  • Commit before every agent run. A clean git state turns a bad edit into a one-line revert.
  • Make the model run the tests. Ask it to run your test command and fix failures instead of guessing.
  • Switch models when stuck. Free models differ more than their names suggest.
  • Add MCP servers sparingly. Each tool adds context. Our OpenCode MCP servers guide shows how to start small.
  • Paste the full error and file path, not a summary. The debug this error prompt is a good template.
  • Never paste secrets. Keep API keys and .env files out of prompts, especially on free hosted models.

Limits you should know about

Free comes with tradeoffs. Being upfront about them saves frustration.

  • Daily request limits. OpenCode's free models are capped, and Kilo and Cline free routes depend on upstream capacity.
  • Disappearing models. Promotional and stealth models can vanish without much notice. DeepSeek V4 Flash is already gone.
  • Privacy variance. Zero retention is common but not universal. Big Pickle and some alpha models collect data during the free period.
  • A quality ceiling. Open-weight models are strong in 2026, but a frontier paid model still wins the hardest, longest tasks.
  • Token pressure. Long sessions burn context even on free tiers. Start a fresh session for a new task.
  • Hardware cost. A local model has no per-token fee, but the GPU or Mac you need is not free.

Which setup should you choose?

Your situation Best setup
Terminal user who wants the strongest all-rounder OpenCode with a free Console model
VS Code or JetBrains user Kilo Code with Auto Free, or Cline with a FREE model
Privacy matters, with a decent GPU or Mac OpenCode with Qwen3.8-27B through Ollama
Already pay for ChatGPT OpenCode with a ChatGPT sign-in, or Codex CLI
Want agents running unattended OpenHands, self-hosted
New to coding agents Start with OpenCode's Plan agent and read our AI coding agents explained guide

Cline vs OpenCode comes down to control. OpenCode is terminal-first and works best when you let it run through a task. Cline is IDE-first and asks for approval at each step by default. Both are open source, and both can use local models.

Frequently asked questions

What is the best open-source coding agent in 2026?

OpenCode is the best all-round pick for most developers. It is MIT-licensed, supports more than 200 model providers, runs in the terminal, desktop and phone, and includes free hosted models. Cline and Kilo Code are stronger choices if you want to stay inside VS Code or JetBrains.

Is OpenCode really free to use?

The OpenCode software is free and open source under the MIT license. Model usage is separate. OpenCode Console lists free models with a daily request limit, and local models through Ollama or LM Studio have no per-token fee. Paid models are billed per request.

What are the best free models to use with a coding agent?

On OpenCode Console, the current free list includes DeepSeek V4.1 Flash Free, Nemotron 3.5 Lightning Free, MiMo-V2.6-Flash Free, Big Pickle and several alpha models. Kilo Code routes to free models through Auto Free, and Cline runs rotating free promotions. For local use, Qwen3.8-27B is the practical pick on a 24 GB GPU or a recent Mac.

Can I run an AI coding agent completely offline?

Yes. OpenCode, Cline, Kilo Code and Qwen Code can connect to a local server such as Ollama, LM Studio or vLLM. You need a model with reliable tool calling and a large context window. Qwen3.8-27B takes about 18 GB in Ollama and runs with a 256K context window.

Is Claude Code open source?

No. Anthropic publishes a repository for Claude Code documentation, plugins and issue tracking, but the CLI source is not released under an open-source license. OpenCode, Codex CLI, Cline and Kilo Code are the open-source alternatives. OpenCode can still use Claude models through the Claude Agent integration or an Anthropic API key.

Is Gemini CLI still free?

Not for most individuals. On June 18, 2026, Google moved free, Google AI Pro and Google AI Ultra access from Gemini CLI to the closed-source Antigravity CLI. Gemini CLI remains Apache-2.0 and is maintained for Gemini Code Assist Standard and Enterprise customers, plus paid API and Vertex AI keys.

Key Takeaways

  • OpenCode is the best open-source coding agent for most developers in 2026, thanks to its MIT license, 200+ providers, built-in Plan and Build agents, and free model access.
  • Open source does not mean free to run. The agent costs nothing, but the model is where the bill appears, so choose a free route on purpose.
  • The three free routes are hosted free models from OpenCode Console, Kilo Auto Free or Cline, local models through Ollama or LM Studio, and limited free API tiers.
  • Free catalogs rotate. DeepSeek V4 Flash was deprecated in October 2026, and its replacement, V4.1 Flash, is the current free pick.
  • DeepSeek V4.1 Flash is the cleanest open-weight choice under MIT, while Qwen3.8-27B under Apache-2.0 is the realistic option for one machine.
  • Good habits beat bigger models. Plan first, keep tasks small, write an AGENTS.md, commit often and let the agent run your tests.

Conclusion

You do not need a subscription to start coding with an agent in 2026. Install OpenCode, connect a free Console model, and use the Plan agent before you let anything touch a file. If you want privacy or no daily caps, put Qwen3.8-27B behind Ollama and let OpenCode discover it.

The free route has limits, and they change often. Check the model picker each time, keep your tasks small and do not build a workflow around one promotional model. The software is open source, so the loop outlives any single model catalog.

Every article on Dev9b follows the standards in our Editorial Policy. If you have a free coding-agent workflow worth sharing, the Contributor Guide explains how to pitch it. This article was drafted and edited with AI assistance, then reviewed by the F9XR Team. Facts, star counts and model lists were checked against the linked vendor docs and model cards on December 6, 2026. Screenshots were captured from the public OpenCode, GitHub, Hugging Face, Ollama, Kilo Code and Cline pages on the same day. The cover image is the author's editorial illustration.