To install OpenCode on a VPS, pick a plan with at least 2 cores and 4GB of RAM, connect over SSH, install Node.js 18 or newer and run the official install script. Then add your LLM API keys. OpenCode is an open-source AI coding assistant that works with over 75 LLM providers, and on a VPS it keeps running 24/7.
Key Steps:
- Choose a VPS Plan: Start with at least 2 vCPUs and 4GB RAM. For production, opt for 4+ vCPUs and 8GB+ RAM.
- Connect to VPS via SSH: Use provided credentials to access your server securely.
- Install Required Software: Set up Node.js, Git, and other dependencies.
- Install OpenCode: Use the official script or alternative methods like npm, Homebrew or Chocolatey.
- Configure OpenCode: Add API keys, create a project environment, and enable remote access.
- Manage Sessions: Use OpenCode commands to run, monitor, and troubleshoot your AI tasks.
The same VPS can run other AI coding tools; see how to install Claude Code on a VPS. To pick a model for trading code, compare the best LLMs for quant trading.

Keep your platform running while you're away.
Step 1: Choose a VPS Plan
Pick a plan with at least 2 cores and 4GB of RAM for OpenCode, and 4 cores with 8GB of RAM for production work or several sessions. OpenCode sends prompts to your LLM provider, so CPU and memory mostly go to the terminal app, git, builds and tests.
| QuantVPS plan | Cores and RAM | Storage | Monthly price | Good for |
|---|---|---|---|---|
| VPS Starter | 2 AMD EPYC cores, 4GB DDR4 | 50GB NVMe | $29.99 | One OpenCode session on a small project |
| VPS Lite | 4 AMD EPYC cores, 8GB DDR4 | 75GB NVMe | $59.99 | Production use and a few sessions |
| VPS Lite+ | 4 AMD Ryzen cores, 8GB DDR5 | 75GB NVMe | $79.99 | Faster builds and test runs |
| VPS Pro | 6 AMD EPYC cores, 16GB DDR4 | 150GB NVMe | $99.99 | Large repositories and several agents |
Prices checked on 10 Oct 2026 with monthly billing on the QuantVPS pricing page. Every plan can run Linux, which is what this guide uses.
Step 2: Set Up Your VPS Environment
Connect to Your VPS
After activating your QuantVPS plan, find your server's IP address, username and password in the control panel in the QuantVPS dashboard. If you're using a Linux-based system, you can connect via SSH directly from your terminal. For Windows users, you can either use WSL2 for SSH access or rely on the Windows Remote Desktop app if you prefer a graphical interface.
To connect via SSH, open your terminal and enter:
ssh root@your-vps-ip-address
Make sure to replace "your-vps-ip-address" with the actual server IP address shown in the control panel in the QuantVPS dashboard. When connecting for the first time, you'll be asked to verify the host's fingerprint. Simply type "yes" to proceed.
Once connected, you're ready to install the necessary software to configure your environment for OpenCode.
Install Required Software
Before setting up OpenCode, you'll need to install some essential tools. The most important one is Node.js (version 18.0.0 or newer), as OpenCode depends on modern fetch APIs that aren't supported in older versions. Using nvm (Node Version Manager) is recommended to avoid permission issues, but on Ubuntu/Debian systems, you can install Node.js directly with this command:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs
You'll also need Git for managing repositories. Install it with:
sudo apt-get install git
Additionally, ensure you have a modern terminal emulator (like Windows Terminal) to properly render OpenCode's text-based user interface (TUI). Lastly, secure your LLM API keys from providers such as Anthropic (Claude), OpenAI (GPT), or Google (Gemini). Store these keys as environment variables in your shell profile for easy access.
Read next
Step 3: Install OpenCode on a VPS
Run the Install Script
Now that you have Node.js and Git ready, it’s time to install OpenCode. The quickest way to get started is by using the official installation script. This script automatically detects your system's architecture and installs the appropriate binary. Simply run the following command in your terminal:
curl -fsSL https://opencode.ai/install | bash
This command takes care of downloading the correct version, placing the binary in ~/.opencode/bin, adding that folder to your PATH in your shell config, and setting the necessary permissions. The process is straightforward and usually completes in no time. Once finished, you’ll see a confirmation message letting you know that OpenCode has been successfully installed.
If this method doesn’t work for you, there are other ways to install OpenCode.
Other Installation Options
If the installation script isn’t your preferred method or doesn’t work, you can try these alternatives:
-
Using npm (Node Package Manager):
Install OpenCode globally by running:npm install -g opencode-ai -
For Windows users with Chocolatey:
Run this command:
Tip: If you’re using a Windows-based VPS, install OpenCode through WSL2 to ensure proper Unicode support.choco install opencode
The OpenCode install docs list every other method, including Homebrew (brew install anomalyco/tap/opencode), Scoop and Docker. These commands install OpenCode 1; OpenCode 2 now has its own installer and docs, and the docs note the two can't be installed side by side under the default opencode command.
Confirm the Installation
After installation, it’s important to verify that OpenCode is set up correctly. Start by checking the version:
opencode --version
If the command returns a version number, you’re good to go. However, if you see an error like "command not found", it might mean the binary isn’t in your system’s PATH yet. Reload your shell config, or add the folder the installer printed (by default ~/.opencode/bin) to your PATH:
export PATH=$HOME/.opencode/bin:$PATH
To further confirm everything is working, test the CLI by running:
opencode --help
This will display a list of available commands, ensuring that OpenCode is installed and ready to use.
Step 4: Configure OpenCode for AI Development
Add Your LLM API Keys
To get started, you'll need to authenticate with your LLM provider. Use the following command to log in:
opencode auth login
This will guide you through connecting to providers like OpenAI or Anthropic. Once authenticated, your credentials are stored locally in ~/.local/share/opencode/auth.json. For quicker setup, you can also export your API keys directly as environment variables:
export ANTHROPIC_API_KEY="your-key-here"
export OPENAI_API_KEY="your-key-here"
To confirm that your authentication was successful, run:
opencode auth list
Once your API keys are set up, you're ready to move on to configuring your project environment.
Create Your Project Environment
After authentication, the next step is setting up your workspace. Navigate to your project directory on your QuantVPS instance:
cd /path/to/project
Launch OpenCode and initialize the environment using the /init command in the TUI:
opencode
This scans your codebase and generates an AGENTS.md file in your project root. This file provides essential context for the AI about your project. It's a good idea to add this file to version control to ensure consistency across your team.
For customization, create an opencode.json file in your project root. This file allows you to override global settings and define specific models, tools, and rules for your workflow.
Enable Remote Access
To manage your project from multiple locations, enable remote access. Ensure your SSH terminal supports mouse reporting for smoother navigation in the TUI. To run OpenCode in headless mode and connect remotely, use this command:
opencode serve --port 4096 --hostname 0.0.0.0
Then, connect from your local machine with:
opencode attach http://<vps-ip>:4096
For added security, set the OPENCODE_SERVER_PASSWORD environment variable before starting the server. Keep in mind that the default request timeout for LLM providers is 300,000 milliseconds (5 minutes), which should be sufficient for most AI-related tasks.
DDoS protection
Always-on DDoS protection with advanced filtering. On every plan.
Always-on mitigation filters attack traffic at the network edge. Every plan includes a dedicated IP and unmetered bandwidth for the trading environment.
See every security layerFrom $29.99/mo · Windows or Linux
Step 5: Run and Manage OpenCode Sessions
Start OpenCode Sessions
QuantVPS ensures constant availability, making it simple to manage and resume OpenCode sessions. To get started, you can launch OpenCode in a few different ways. From your project directory, run opencode or opencode tui to open the interactive Terminal User Interface (TUI). If you need to pick up where you left off, use opencode --continue or opencode -c.
For quick, one-off tasks, execute commands like opencode run "your prompt". If you need specialized agents, you can toggle between build for development tasks and plan for reviewing AI-generated logic by using the Tab key.
Managing multiple projects? List all active sessions with opencode session list. To resume a specific session, use opencode --session <session-id>. Need to branch off? Add the --fork flag to create a new session based on an existing one.
Once your sessions are up and running, keeping an eye on system performance is the next critical step.
Monitor System Performance
Keeping tabs on performance is vital for controlling costs and maintaining efficiency. Use opencode stats to monitor real-time token usage and cost data. To narrow the focus to a specific project, run opencode stats --project <project-name>. Want a broader view? Add the --days 7 flag to analyze usage over the past week.
If you notice any performance issues, start by checking API connectivity with tools like ping or curl -I. For more advanced diagnostics, use commands like opencode mcp list to view your Model Context Protocol (MCP) servers or opencode mcp debug <name> to troubleshoot specific connections.
For deeper insights, enable detailed logging with --log-level DEBUG and --print-logs. This will help pinpoint any issues and ensure your sessions remain efficient and uninterrupted.
Troubleshooting Common Issues
If OpenCode isn’t functioning as expected after installation, here are specific fixes for common problems.
Fix Node.js Errors

OpenCode depends on Node.js version 18.0.0 or higher due to its reliance on modern Node fetch APIs. To check your current version, run:
node --version
If your version is below 18, you’ll likely encounter issues. Use Node Version Manager (nvm) to update Node.js. Install nvm with:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
Then, install the latest long-term support (LTS) version of Node.js:
nvm install --lts
Set it as the default version to avoid conflicts:
nvm alias default node
If you encounter EACCES permission errors during npm installations, avoid using sudo. Instead, create a local npm directory:
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
Add this line to your shell configuration file (e.g.,.bashrc or.zshrc):
export PATH=~/.npm-global/bin:$PATH
Reload your shell configuration to apply changes. This setup ensures npm installations stay within your user space, preventing permission-related issues.
Resolve API Authentication Problems
Authentication issues often arise from incorrect API key formats or expired credentials. OpenCode stores provider details in ~/.local/share/opencode/auth.json. If LLM connections fail, refresh your credentials with:
opencode auth login
Double-check that your API keys have the correct prefixes (e.g., OpenAI: sk-, Anthropic: sk-ant-). You can verify this by running:
echo $ANTHROPIC_API_KEY
echo $OPENAI_API_KEY
If the keys are missing, add them to your shell profile and reload it (e.g., source ~/.bashrc). For additional debugging, use:
opencode run hello --print-logs
To see which providers OpenCode recognizes as authenticated, run:
opencode auth list
These steps should help resolve most authentication-related problems.
Order flow
Built for scalpers. Heatmaps on dedicated resources.
Order-flow heatmaps and DOM ladders run on dedicated CPU, memory and NVMe, so your charts keep responding during volatility.
See the dedicated hardwareFrom $29.99/mo · Windows or Linux
Fix Terminal Compatibility Issues
If OpenCode’s Terminal User Interface (TUI) appears blank or doesn’t respond to mouse clicks during SSH sessions, the issue is likely with missing pseudo-terminal (PTY) allocation. When connecting via SSH, include the -t flag:
ssh -t user@vps opencode
As noted by a contributor on the OpenCode GitHub:
"If you're using ssh... please try running ssh with the -t flag, e.g. ssh -t <server> opencode" - veracioux, Contributor, OpenCode GitHub
For local terminal emulators like WezTerm or Kitty, enable mouse support in their configuration files to improve TUI navigation. If the opencode command isn’t recognized, ensure your PATH includes ~/.opencode/bin (install script) or ~/.npm-global/bin (npm). If the binary exists but fails to execute, fix it with:
chmod +x ~/.opencode/bin/opencode
These adjustments should resolve terminal-related issues effectively.
Conclusion
By following the outlined steps, you now have a reliable, remotely accessible OpenCode setup running on QuantVPS. The process is straightforward: select a QuantVPS plan that suits your workload, connect through SSH, execute the installation script, and configure your preferred LLM provider. In just a few minutes, you’ll have an AI development environment ready to go, without the limitations of local hardware.
Plus, its consistent uptime ensures your OpenCode server remains active for long-running tasks, unaffected by local PC sleep modes or network disruptions.
With OpenCode's compatibility with 75+ LLM providers, coupled with QuantVPS's scalable resources, you can experiment with a range of models - whether it's Claude Sonnet or self-hosted setups like Ollama - without worrying about hardware limitations. When exploring new workflows or handling production-level AI projects, QuantVPS offers the performance and reliability you need to keep everything running smoothly. If you also use Anthropic's agent, our guide shows how to install Claude Code on a VPS, and both tools can share one server. To message an assistant from Telegram or Slack instead, see how to install OpenClaw.
Getting more from OpenCode on a remote server
Pin the model and provider in OpenCode's config so a session on the server behaves the same as on your laptop, and keep provider API keys out of the project folder. Check your provider's usage limits before leaving an agent running unattended. QuantVPS's OpenCode VPS for remote development is reached over SSH from any device.
FAQs
Do I need a GPU to run OpenCode on a VPS?
A GPU isn't necessary to run OpenCode on a VPS. Most configurations primarily depend on CPU resources, as the setup revolves around software installation, managing dependencies, and integrating API keys. That said, if you're planning to tackle GPU-intensive tasks or handle large-scale AI workloads, having a GPU can enhance performance. Still, for basic usage, it's entirely optional.
How do I keep OpenCode running after I disconnect from SSH?
To ensure OpenCode continues running even after disconnecting from SSH, you can configure it as a persistent systemd service. Here's how:
-
Create a service file: Set up a systemd service file at
/etc/systemd/system/opencode.servicewith the appropriate configuration for OpenCode. -
Enable the service: Run
sudo systemctl enable opencodeto make sure it starts automatically on boot. -
Start the service: Use
sudo systemctl start opencodeto launch it immediately.
With this setup, OpenCode will keep running in the background, even if you log out.
How can I secure OpenCode remote access on my VPS?
To protect OpenCode remote access on your VPS, start by setting the OPENCODE_SERVER_PASSWORD environment variable to enable HTTP basic authentication. For secure communication, rely on SSH port forwarding or SSH-based connections. Beyond that, implement key security measures such as limiting network access, choosing strong passwords, and incorporating VPN solutions or tools like Tailscale to enhance protection.









