惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
J
Java Code Geeks
The GitHub Blog
The GitHub Blog
博客园_首页
U
Unit 42
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
IT之家
IT之家
G
Google Developers Blog
L
LangChain Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
爱范儿
爱范儿
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
Jina AI
Jina AI
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
小众软件
小众软件
H
Help Net Security

DigitalOcean Community Tutorials

It's Time to Break Up with Your Cloud: Why AI Teams are Switching We Built a Private-Document AI App to Test Platform Security. Here Is What We Could Actually Verify. PostgreSQL Explained: A Complete Beginner-to-Advanced Guide How To Install and Configure Postfix on Ubuntu How To Build a Web Application Using Flask in Python 3 Build AI Reading List with DigitalOcean Functions and Mistral How To Concatenate Strings in Python How to Allow MySQL Remote Access Securely How To Install and Use Docker on Rocky Linux How To Build a Multi-Agent AI System with Docker Agent DSPy Use Cases: Build Optimized LLM Pipelines How To Submit AJAX Forms with jQuery Build an AI-Powered GPU Fleet Optimizer with the DigitalOcean AI Platform ADK Monitor GPU Utilization in Real Time: A Complete Guide Reduce File Size of Images in Linux - CLI and GUI methods Reduce PDF File Size in Linux: Tools and Methods How To Set Up a Private Docker Registry on Ubuntu How To Troubleshoot Terraform: Errors and Fixes How to Use Go Modules Python Multiprocessing Example: Process, Pool & Queue Convert Class Components to Functional Components with React Hooks How To Install and Configure Ansible on Ubuntu LLM Tokenizers Simplified: BPE, SentencePiece, and More How To Monitor System Authentication Logs on Ubuntu How to Use Traceroute and MTR to Diagnose Network Issues How to Deploy Postgres to Kubernetes Cluster Importing Packages in Go: A Complete Guide Create RAID Arrays with mdadm on Ubuntu How To Make an HTTP Server in Go How To Set Up Time Synchronization on Ubuntu
OpenCode: An Open-Source Claude Code Alternative
Andrew Dugan · 2026-05-26 · via DigitalOcean Community Tutorials

Introduction

If you’ve been using Claude Code to get AI assistance directly in your terminal, you already know how powerful the experience is. You describe a task, and an agent reads your files, edits code, runs commands, and reports back, all without leaving the command line. The only real downside from Claude Code is that it is built for Anthropic’s models. Its pricing is tied to an Anthropic subscription, and your code passes through Anthropic’s infrastructure.

OpenCode is the open-source answer to that. It delivers the same terminal-native, agentic coding experience, including file editing, shell commands, Language Server Protocol (LSP) integration, and multi-session support, but you’re in control of the model and the infrastructure. In this tutorial, you’ll deploy OpenCode on a DigitalOcean Droplet using the 1-Click Marketplace App, pre-configured for Serverless Inference, with no local install and no configuration files to hand-write.

Key Takeaways

  • OpenCode is an open-source, terminal-based AI coding agent with over 163,000 GitHub stars and 7.5 million monthly users, built as a drop-in replacement for tools like Claude Code.
  • DigitalOcean offers a 1-Click Application that deploys OpenCode on a Droplet, pre-configured with DigitalOcean Serverless Inference, with no local install required.
  • The Droplet comes with access to MiniMax M2.5, Claude Sonnet 4.5, GPT-5, DeepSeek, Llama 3.3, Kimi K2.5, and more, all via a single Gradient model access key.
  • The entire setup can be complete in five minutes: deploy the Droplet, SSH in, paste your model access key into the setup wizard, and start coding.

Claude Code brought a true agentic loop running inside your terminal. Rather than copy-pasting code suggestions from a chat window, Claude Code can open files, apply edits, run your test suite, read the output, and iterate, all autonomously. It understands your project at the LSP level, meaning it has access to the same type of information your editor does.

For developers who live in the terminal, this is a significant quality-of-life upgrade. The appeal is real, and the experience is genuinely good. But every line of code you hand it passes through their systems under their data policies.

Why Use OpenCode + DigitalOcean Instead?

OpenCode replicates the Claude Code experience, including a terminal user interface (TUI), file editing, shell commands, LSP awareness, and multi-session support, but removes the lock-in. Here are some of the main benefits:

Model Freedom. You pick the model. Kimi K2.6, DeepSeek V4 Pro, Llama 4, Qwen 3 Coder, whatever performs best for your workload. You can even switch mid-project with a single /models command.

Open-Source and Auditable. OpenCode is MIT-licensed. You can read the code, fork it, and know exactly what it’s doing with your files and prompts.

Privacy-First by Design. OpenCode does not store your code or conversation data. DigitalOcean Inference does not retain or train on prompt or response data beyond what’s required to provide the functionality.

Pay-Per-Token, Not Per Seat. Instead of a fixed monthly subscription, you pay for what you use. For developers who code in bursts, this is often significantly cheaper.

DigitalOcean as the Backbone. DigitalOcean offers a 1-Click Application that deploys OpenCode on a Droplet, pre-configured for serverless inference. SSH in, paste your model access key, and it’s ready. No local install, no configuration files to hand-write.

Model Flexibility from Day One. The 1-Click app defaults to MiniMax M2.5, a capable general-purpose model, but the full Gradient catalog is available immediately: Kimi K2.5, Claude Sonnet 4.5, GPT-5.2, DeepSeek, Llama 3.3, Qwen3, and more. Switching is a single /models command.

How to Determine If This Is Right for You

Consider making the switch if any of these apply:

  • You’re paying a monthly subscription for Claude Code, Cursor, or a similar tool and want lower or more predictable costs.
  • You want to experiment with different models without switching tooling.
  • You work in environments where sending code to a specific third party is a concern.
  • You’re already a DigitalOcean customer and want to consolidate your AI spend there.
  • You prefer open-source software and want to understand what’s running on your machine.

Step 1 — Creating a Gradient Model Access Key

Log in to the DigitalOcean Control Panel and on the left side panel, navigate to Inference → Manage. Click Create Model Access Key, give it a name (e.g., opencode-droplet), and copy the key. You won’t be able to view it again after leaving the page.

This single key gives you access to the full catalog of Gradient models, including MiniMax M2.5, Kimi K2.5, Claude Sonnet 4.5, DeepSeek, Llama 3.3, and more, with no separate API accounts required for each.

Step 2 — Deploying the OpenCode 1-Click Application

Go to the OpenCode listing in the DigitalOcean Marketplace and click Deploy to DigitalOcean.

Choose a Droplet size. The minimum specs are 1 GB RAM / 1 vCPU / 25 GB storage, but 2 GB RAM / 2 vCPU or more is recommended for comfortable use:

Use Case RAM CPU Storage
Minimum 1 GB 1 vCPU 25 GB
Recommended 2 GB 2 vCPU 50 GB

Add or create an SSH key for secure access, then click Create Droplet. The Droplet is ready in under a minute.

Alternatively, deploy via the API:

curl -X POST -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer '$TOKEN'' -d \
    '{"name":"opencode-server","region":"sfo2","size":"s-2vcpu-4gb","image":"opencode"}' \
    "https://api.digitalocean.com/v2/droplets"

Step 3 — SSHing In and Completing the Setup Wizard

Once the Droplet is ready, SSH in:

ssh root@your-droplet-ip

On first login, the setup wizard runs automatically. When prompted, paste the Gradient model access key you created in Step One:

Output

Enter your DigitalOcean Gradient model access key: ▌

The wizard verifies the key and writes the OpenCode configuration automatically. No YAML editing required.

Step 4 — Running OpenCode and Choosing Your Model

Navigate to your project and launch OpenCode:

cd /path/to/your/project
opencode

If you don’t already have a project on the Droplet, you can create an empty project directory or directly start OpenCode and have it create the folders for you.

The OpenCode terminal user interface showing a split-pane layout with a conversation panel on the left displaying the agent's responses and file edits, and a scrollable session view, with a prompt input field at the bottom for entering coding tasks

The default model is MiniMax M2.5 (digitalocean/minimax-m2.5). To view the full list of available models, or to switch models, run /models inside the TUI.

Try a real prompt:

Build a simple Python FastAPI app with the following:
- A GET /health endpoint that returns {"status": "ok", "timestamp": <current UTC time>}
- A POST /shorten endpoint that takes a {"url": "..."} body and returns a
  fake short code (just md5 the url, return first 8 chars)
- A requirements.txt with fastapi and uvicorn
- A test file using pytest that tests both endpoints
- A README.md explaining how to run it

Create all the files, then run pip install -r requirements.txt and pytest to
confirm the tests pass.

OpenCode reads the relevant files, plans the changes, applies edits across the codebase, runs your tests, and reports back, the same loop you’d get from Claude Code, with a model you chose, on infrastructure you control.

Switch between the build agent (full file access) and plan agent (read-only analysis) at any time by pressing Tab.

Step 5 — Pinning Your Model and Adding Project Rules

To set a default model permanently, edit the config on the Droplet:

nano /root/.config/opencode/opencode.json

Update the model field:

/root/.config/opencode/opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "model": "digitalocean/minimax-m2.5"
}

You can also add a RULES.md file in your project directory to give the agent standing instructions that persist across sessions:

# Project Rules

- This is a Python 3.12 project using FastAPI and PostgreSQL.
- Always add type hints to function signatures.
- Never modify existing migration files. Create new ones.
- Run `pytest` before considering any task complete.

Helper scripts are pre-installed on the Droplet for common tasks:

Action Command
Check version /opt/opencode-version.sh
Update to latest /opt/update-opencode.sh
Re-run setup wizard /opt/setup-opencode.sh

FAQ

Is OpenCode as capable as Claude Code?

For most everyday coding tasks, including refactoring, debugging, writing tests, and generating boilerplate, yes. The quality of the experience depends heavily on the model you choose, which is exactly the point. You can benchmark different models against your specific codebase and tasks, and switch freely.

What does this cost compared to Claude Code?

DigitalOcean Inference bills per token. Check the current pricing page for per-model rates. The Droplet itself costs a few dollars per month depending on size. For reference, Claude Code usage is billed against your Anthropic API quota or bundled into a Pro/Max subscription starting at $20/month. Developers who code in bursts typically find per-token pricing cheaper, while heavy daily users may find subscriptions more predictable. If you want Claude specifically, Gradient also provides Claude Sonnet and Opus via the do-anthropic models listed in Step Four.

Is my code sent to DigitalOcean servers?

With the Droplet setup, your code lives on the Droplet itself, not your local machine. Prompts are sent from the Droplet to DigitalOcean Inference to generate responses. DigitalOcean does not retain prompt or response data after the request completes. For maximum privacy, restrict the Droplet to a virtual private cloud (VPC) and scope your model access key. Review DigitalOcean’s data privacy policy for full details.

Can I switch models mid-project?

Yes. Run /models in the TUI at any time to switch. Your conversation history stays intact, and only the model handling the next request changes.

Can I use my own Anthropic or OpenAI API keys instead of Gradient?

Yes. Skip the setup wizard by pressing Enter when prompted, then use /connect inside OpenCode to add your own API keys for any of 75+ supported providers. The 1-Click App is pre-configured for DigitalOcean Serverless Inference, but it doesn’t lock you in.

What’s the difference between serverless and dedicated inference on DigitalOcean?

Serverless inference (what this tutorial uses) is shared, pay-per-token, and requires no provisioning, making it ideal for individual developers and small teams. Dedicated inference gives you a reserved GPU endpoint for consistent latency and throughput, suited for production workloads or teams with high request volumes.

Conclusion

OpenCode is a mature, well-supported open-source alternative to Claude Code that gives you the same terminal-native agentic coding experience without the vendor lock-in. The DigitalOcean 1-Click Application removes even the friction of installation. Deploy a Droplet, SSH in, paste a model access key, and you’re coding with Kimi K2.5, Claude Sonnet, or any other DigitalOcean Serverless Inference model in under five minutes.

The next step is to deploy the Droplet and try it on a real task in your codebase. Start with the plan agent to explore, switch to build when you’re ready to make changes, and use /models to experiment with different models until you find the one that fits your workflow best.

Creative CommonsThis work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.