Open Source Is Back. Goodbye Claude.

BBetter Stack
Computing/SoftwareSmall Business/StartupsInternet Technology

Transcript

00:00:00OpenCode is an open source coding agent that just crossed 180,000 stars on GitHub
00:00:04and it's a direct replacement for tools like ClaudeCode without the glitchy UI and expensive
00:00:10subscriptions. You'll get access to hundreds of models including free and local models which is
00:00:15pretty cool so you're not vendor locked into one platform. Today we're going to pull apart OpenCode
00:00:20and we're going to compare it to some of the paid alternatives and test whether free and open source
00:00:24really holds up when you're trying to push to production. And we cover a huge amount of dev
00:00:29content on this channel so if you want to stay up to date then subscribe.
00:00:37OpenCode is a coding agent that lives in your terminal and it comes with a huge array of tools
00:00:42like bash, edit, grep, webfetch and websearch. These are all the things that made ClaudeCode so useful
00:00:49so seeing them in a free and open source tool is really nice. Once installed we can run the open
00:00:54code command to enter our terminal. Here I'm using ghosty which is one of OpenCode's recommended
00:01:00terminals. You can see immediately the terminal UI here is really clean but the big difference is
00:01:06bringing your own models. By default I'm using a free model called Big Pickle but using the slash
00:01:12models command I can easily switch to other free alternatives or paid models from companies like
00:01:18Google, Anthropic and OpenAI. Hitting control A I can also see a huge list of models which come from
00:01:24models.dev, a directory officially supported by OpenCode. Here you'll have access to models like
00:01:30GLM 5.2 and DeepSeq 4. Even with paid models this can be considerably cheaper than sticking to API
00:01:37only pricing with labs like Anthropic because models like GLM 5.2 are much much cheaper with comparable
00:01:44results to models like Fable 5. GLM 5.2 even beat Fable 5 at web design according to Design Arena. At the
00:01:51time of recording there is no auto mode for OpenCode to select a suitable model based on its assigned task
00:01:57features you'd see in harnesses like Copilot but what you can do instead is configure custom sub
00:02:02agents to use a specific model then call on those for specific tasks and this is a great way to segue
00:02:09into configuring OpenCode's agents. In OpenCode agents come in two types primary and sub-agents.
00:02:15Primary are the top level agents you'd always use you get build and plan exactly as you would expect from
00:02:21harnesses like Copilot or Claude code. You can use tab to change this or just use the slash agents
00:02:27command. So plan is exactly as you would expect for planning large features without actually making those
00:02:32changes and then you can switch to the build agent to actually implement that plan or if you just want
00:02:37to make changes directly stick into the build agent. Sub-agents on the other hand are for specialist
00:02:42tasks and they'll be invoked automatically depending on your prompt but you can tag them manually by using
00:02:48the @ character. By default you'll have access to the general agent for researching complex questions
00:02:53and executing multi-step tasks and then we have the explore agent which has read-only access for exploring
00:03:00large code bases. Now the really interesting and powerful part of OpenCode is that you can configure
00:03:06your own custom agents. So there are a few ways that you can set up custom agents with OpenCode. You can
00:03:12use the JSON file which I just explained earlier and if you want all your config in one place this is the
00:03:17right way to do it. So I'll just enlarge this. We can see that under the agents config we've got a build
00:03:23agent, we've got the plan agent. So these are the ones that come as default but you can change these if
00:03:28you like and then we've got a custom agent here called code review and this just happens to be using Claude
00:03:33Sonic 4 and then we've got a little description of what it does and then a prompt that would
00:03:38automatically be injected into the agents when you ask to perform a specific task. If you don't want
00:03:45all of your config in one place instead you can have a dot OpenCode folder with an agents folder and inside
00:03:51that you can describe the specific agent that you want as a markdown. So here we have the uiengineer.md
00:03:58and the description is it handles UI component implementation styling and front-end engineering tasks.
00:04:04The mode for this would be subagent. We're using GLM 5.2 just because that is very very good at doing
00:04:10design based on the design benchmarks. You can also change the temperature as well to modify the sort of
00:04:15randomness of the output that you would get from the model and then you can also modify any of the
00:04:19default permissions. So in this case we always want to allow edits and always allow bash commands.
00:04:24Within the markdown file you then can give further instructions on exactly what this agent does.
00:04:30So here we say you're a ui engineer specializing in front-end development, you excel at and then you
00:04:34can give as much detail as you like to guide your agent in the correct direction. So next time that
00:04:40you trigger a prompt that requires design work it's going to do exactly what you want. So here as another
00:04:46example we have a review.markdown and this will just do code review for us. In this case we set
00:04:51the temperature as a really low number because we want more of a deterministic output from the model.
00:04:56We provide the same sort of permissions this time we're using Claude Sonic 4 and then we give a little
00:05:01description of what it does review code for quality and best practices. Again the mode is going to be
00:05:07subagent and then again a short or long description to explain exactly what the model does and the more
00:05:12detail you give here the less likely it is to do the wrong thing or hallucinate. Now when i'm working
00:05:17on a ui task i can tag my agent and let glm handle all of the design work. Now here are a few things to
00:05:24improve quality of life when using open code. Flip on lsp in your config and it will auto start the correct
00:05:29language server per file. So the model gets real type information and errors not just raw text and this
00:05:35is off by default so you do need to flip it on. Using the at character also gives you fuzzy file search to
00:05:41pulling files into context. You can use undo or redo to reverse the agents changes and they do stack.
00:05:47Share can give you a link to the whole session for debugging or handing to a teammate. You can also use
00:05:52init which writes an agents.md a checked in file that teaches the agent your projects conventions and this
00:05:58is just exactly like the Claude md file in Claude code. So my verdict here is that the ui is considerably better than
00:06:04Claude code plus it has access to all of the same tools with the added benefit that you can use your
00:06:10own models and configure custom tools and agents. On cost it's actually not black and white if you're on
00:06:15api only pricing then open code wins easily because you have access to so many more much cheaper models
00:06:22but if you're on a subscription with anthropics pro or max plan for example you cannot use third-party
00:06:28harnesses like open code because anthropics specifically block access to them but if you
00:06:32are on that subscription then Claude code bundles in huge discounts compared to raw api rates so if
00:06:38you're on api only pricing then stick to open code but if you do have that subscription then Claude code
00:06:44is the winner on pure cost. If you enjoy hearing about the latest ai tooling then we've done a breakdown of
00:06:50glm 5.2 you can watch here otherwise i've been warren from better stack thanks for watching and i'll see you in the next one

Key Takeaway

OpenCode provides a flexible, open-source terminal coding agent that outperforms proprietary alternatives by allowing custom model selection and specialized agent configuration.

Highlights

  • OpenCode is an open-source coding agent that supports hundreds of models, including local and free alternatives.

  • The tool provides terminal-based functionality comparable to ClaudeCode, including bash, edit, grep, and websearch tools.

  • Users can configure custom agents by defining behavior, permissions, and specific models in JSON files or markdown files within a .opencode directory.

  • Activating the language server protocol (LSP) in OpenCode configuration provides the model with real-time type information and error detection.

  • API-only users achieve cost savings by choosing cheaper, high-performing models like GLM 5.2 over standard Anthropic API rates.

  • Anthropic's Pro or Max subscriptions currently block access to third-party harnesses like OpenCode, making ClaudeCode more cost-effective for those specific users.

Timeline

OpenCode Features and Setup

  • OpenCode offers a terminal-based interface with native tools like bash, edit, and websearch.
  • Users can switch between numerous local, free, or paid models via the /models command.
  • The tool integrates with models.dev to provide access to models such as GLM 5.2 and DeepSeq 4.

OpenCode functions as an open-source replacement for tools like ClaudeCode. It runs directly in the terminal, with recommendations like the Ghosty terminal for a clean UI. Unlike locked platforms, it allows users to bring their own models and switch between them easily based on task requirements or cost considerations.

Configuring Primary and Custom Agents

  • Primary agents include built-in 'plan' and 'build' functions for task execution.
  • Custom agents can be created using centralized JSON configuration or individual markdown files.
  • Markdown-based agent configuration allows precise control over model selection, temperature, and permissions for tasks like code review or UI engineering.

Agents in OpenCode handle specialized tasks and can be triggered via the @ character. Configuring a custom agent involves specifying its mode, model, and detailed instructions to prevent hallucinations and improve output accuracy. This approach enables specialized workflows, such as low-temperature settings for deterministic code reviews.

Optimization and Cost Comparison

  • Enabling LSP in the configuration provides the agent with necessary context for type information and errors.
  • OpenCode allows project-specific training via an init-generated agents.md file to learn project conventions.
  • OpenCode is more cost-effective for API-only users, while ClaudeCode is cheaper for users already paying for Anthropic Pro subscriptions.

Quality of life improvements include undo/redo functionality and fuzzy file searching via the @ character. While OpenCode offers greater flexibility, cost efficiency depends on the user's current subscription model. Third-party tools are restricted for users on specific Anthropic plans, making the choice between OpenCode and ClaudeCode dependent on existing vendor commitments.

Community Posts

View all posts