OpenCode

Build agents with
OpenCode

Use OpenCode, the privacy-first open-source AI code assistant. Self-host, use any LLM, and keep full control of your data.

Self-hosted Any LLM Full control

Setup Steps

01

Install OpenCode

Install the open-source AI code assistant

npm install -g opencode-cli
02

Configure your LLM

Use any LLM provider (OpenAI, Anthropic, local models)

opencode config --provider anthropic --api-key YOUR_KEY
03

Install Squads CLI

Install the Squads CLI globally

npm install -g squads-cli
04

Initialize agents

Create the agent structure

squads init

Why OpenCode?

Privacy-first

Your code never leaves your infrastructure. Perfect for sensitive codebases.

opencode --local-only

Use any LLM

Connect to OpenAI, Anthropic, Gemini, or self-hosted models.

opencode config --provider ollama

Open source

Audit the code, contribute features, fork and customize as needed.

github.com/opencode-ai/opencode

Works with squads

Run agents using OpenCode as the execution engine.

squads run research --engine opencode

Supported LLM Providers

Use any provider or run models locally

Anthropic

Claude models via API

OpenAI

GPT-4, GPT-4o via API

Google

Gemini models via API

Ollama

Local models (Llama, Mistral)

LM Studio

Self-hosted models

Custom

Any OpenAI-compatible API

Ready to build?

Initialize your project and start building

npm install -g squads-cli && squads init