Opencode, an AI coding agent, built for the terminal.
In this article, we review Opencode, an AI coding agent, built for the terminal. We will look at:
-
What is Opencode?
-
Getting started.
I study patterns used in an open source project found on Github Trending. For this week, I reviewed some parts of opencode codebase and wrote this article.
What is Opencode?
Opencode is the AI coding agent built for the terminal. It has the following features:
-
Native TUI: A responsive, native, themeable terminal UI
-
LSP enabled: Automatically loads the right LSPs for the LLM
-
opencode zen: A curated list of models provided by opencode
-
Multi-session: Start multiple agents in parallel on the same project
-
Shareable links: Share a link to any sessions for reference or to debug
-
Claude Pro: Log in with Anthropic to use your Claude Pro or Max account
-
Use any model: Supports 75+ LLM providers through Models.dev, including local models
Learn more about Opencode.ai.
Getting started
opencode is an AI coding agent built for the terminal.
Install
bash npm install -g opencode-ai
Configure
With opencode you can use any LLM provider by configuring their API keys.
If you are new to using LLM providers, we recommend using opencode zen. It’s a curated list of models that have been tested and verified by the opencode team.
-
Run
opencode auth login
, select opencode, and head to opencode.ai/auth. -
Sign in, add your billing details, and copy your API key.
-
Paste your API key.
Initialize
Now that you’ve configured a provider, you can navigate to a project that you want to work on.
cd /path/to/project
And run opencode.
opencode
Next, initialize opencode for the project by running the following command.
/init
This will get opencode to analyze your project and create an AGENTS.md
file in the project root.
You should commit your project’s
AGENTS.md
file to Git.
This helps opencode understand the project structure and the coding patterns used.
Usage
You are now ready to use opencode to work on your project. Feel free to ask it anything!
If you are new to using an AI coding agent, here are some examples that might help.
I picked this above info from the opencode documentation.
Read more about:
About me:
Hey, my name is Ramu Narasinga. I study codebase architecture in large open-source projects.
Email: ramu.narasinga@gmail.com
Want to learn from open-source? Solve challenges inspired by open-source projects.