By Andrew Dugan
Senior AI Technical Content Creator II

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.
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.
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.
Consider making the switch if any of these apply:
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.
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"
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:
OutputEnter your DigitalOcean Gradient model access key: ▌
The wizard verifies the key and writes the OpenCode configuration automatically. No YAML editing required.
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 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.
To set a default model permanently, edit the config on the Droplet:
nano /root/.config/opencode/opencode.json
Update the model field:
{
"$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 |
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.
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.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Andrew is an NLP Scientist with 8 years of experience designing and deploying enterprise AI applications and language processing systems.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.