How to Install OpenCode and Finish Your First Task

September 21, 2026

OpenCode is a free, open-source AI coding agent that runs in your terminal and works with almost any model provider. You install it with one script or npm command, run opencode inside a project, and describe what you want changed. Your first edit is a 5-minute job.

What is OpenCode?

OpenCode is a text-based coding agent maintained in the open on GitHub. Unlike IDE plugins, it is provider-neutral: it talks to Anthropic, OpenAI, Google, or a local model through a config file. It reads your project tree, proposes diffs, and runs shell commands with your consent. That neutrality is the main reason developers pick it over lock-in tools.

How do you install OpenCode?

Two supported routes:

  • Install script: curl -fsSL https://opencode.ai/install | bash
  • Package managers: npm i -g opencode-ai, or Homebrew on macOS with brew install opencode

After install, run opencode auth login and pick your provider. The key is stored locally under ~/.local/share/opencode. No account is required to use your own API key.

How do you complete your first task?

Change into a repo and launch the agent:

  1. cd ~/projects/my-api
  2. opencode
  3. Type a concrete request: “Add a /health endpoint that returns 200 with a JSON body containing uptime.”
  4. Review the diff it shows, then approve with y.

OpenCode edits only after you confirm, so the worst case is a rejected patch, not a wrecked working tree. If the plan looks off, reply with a correction instead of starting over — it keeps the context.

Is OpenCode free?

The tool is free and open source. You pay for whichever model you connect. With a cheap model a small task runs a few thousand tokens, well under $0.05. With a frontier model the same task may cost $0.20-$0.50. There is no per-seat license and no usage cap imposed by OpenCode itself.

OpenCode vs IDE agents

If you want autocomplete and inline hints, an editor plugin wins. OpenCode targets the opposite workflow: give an agent a goal and let it touch many files. It pairs well with droid, which leans more autonomous, while OpenCode stays easier to script and embed in pipelines.

Quick Summary

  • OpenCode is a free, open-source terminal coding agent.
  • Install via curl -fsSL https://opencode.ai/install | bash or npm i -g opencode-ai.
  • It is provider-neutral — bring any API key, no account needed.
  • First task takes about 5 minutes; it always asks before editing.
  • Best for developers who want a scriptable agent, not autocomplete.

Last updated September 2026.