OpenCode Guide

OpenCode is a free, open-source AI coding agent. It is available as a terminal app, a desktop app (beta), and an IDE extension. It supports 75+ LLM providers through Models.dev, and you can log in with an existing GitHub Copilot or ChatGPT account to use it at no extra cost.

Getting Started

Install using any of these methods:

curl -fsSL https://opencode.ai/install | bash

Or with a package manager:

# npm
npm install -g opencode

# Homebrew
brew install opencode

Then run opencode in any project directory to start a session.

A desktop app is also available in beta for macOS, Windows, and Linux. Download it from opencode.ai.

Using Your Existing Accounts

One of OpenCode's best features for students: you can log in with accounts you may already have.

  • GitHub Copilot: If you have the free Copilot Student plan, you can use it with OpenCode.
  • ChatGPT Plus/Pro: If you have a ChatGPT subscription, you can log in with your OpenAI account.
  • Any API key: Bring your own API key from Anthropic, OpenAI, Google, and 75+ other providers.

Pricing

OpenCode itself is free and open source (MIT license). You only pay for the AI models you use, and there are free options:

  • Free models: OpenCode includes some free model options and works with local models through Ollama.
  • Zen: A curated set of models optimized for coding agents. Pay-as-you-go with no markup on model costs.
  • Bring your own key: Use any API key from any provider.

Key Features

  • LSP integration: Automatically loads the right language servers for the LLM
  • Multi-session: Run multiple agents in parallel on the same project
  • Share links: Share a link to any session for reference or debugging
  • Privacy-first: Does not store your code or context data

Resources