Use DigitalOcean Inference with OpenCode and T3 Code
A deliberate, OS-agnostic setup guide for connecting DigitalOcean Inference to OpenCode, then using that installation in T3 Code.
What this guide sets up
You are connecting three separate pieces. DigitalOcean supplies inference and billing. OpenCode is the coding agent that authenticates with DigitalOcean. T3 Code is a local interface that starts and manages OpenCode sessions.
Sign in to DigitalOcean inside OpenCode first. Do not put a DigitalOcean credential in your repository, a configuration file, or a T3 Code setting. Once OpenCode can use a DigitalOcean model, T3 Code can use that OpenCode installation.
- A DigitalOcean account that can use Serverless Inference
- A local project folder you are comfortable letting an agent read
- A current Node.js release installed on the same computer where you will run T3 Code
- Any terminal available on your operating system
1. Confirm Node.js, then install OpenCode
Open your usual terminal. Run each command separately and read its result before moving on. T3 Code currently requires Node.js 22.16 or newer; if the version check fails or reports an older version, install a supported Node.js release and open a new terminal.
Install OpenCode globally, then verify that this terminal can run it. These npm commands work the same way in PowerShell, macOS Terminal, and common Linux shells.
node --versionnpm install -g opencode-aiopencode --version2. Connect DigitalOcean inside OpenCode
Navigate to the project folder you want OpenCode to inspect, using the normal navigation method for your terminal. Then start OpenCode. This guide intentionally does not prescribe a path command because path syntax differs between operating systems and shells.
At the OpenCode prompt, enter /connect. Choose DigitalOcean, then choose Login with DigitalOcean. Your browser opens for approval; sign in, approve the connection, then return to OpenCode.
OAuth is the recommended first setup because it also discovers DigitalOcean Inference Routers. If your team has given you a Model Access Key, choose Paste Model Access Key and enter it only at OpenCode's credential prompt. Never put it in Git, a screenshot, or a project file.
Set-Location -LiteralPath "C:\path\to\your-project"
opencode/connect3. Pick a model and run a safe first test
In OpenCode, enter /models and choose a DigitalOcean model. A router appears as router:<name>. Choose a router only if you created one in DigitalOcean; otherwise select a listed model.
Run the read-only prompt below before you permit edits. It asks for an inspection only. A useful summary without another credential request confirms that the DigitalOcean connection is working.
If you accidentally approve an edit, use /undo. When the read-only test succeeds, exit OpenCode with its normal exit control (Ctrl+C in most terminals).
/modelsRead this repository. Do not edit, create, delete, or run anything. Tell me:
1. what this project does,
2. where the main application starts, and
3. one low-risk improvement I could make.4. Start T3 Code and turn on OpenCode
Run T3 Code from a terminal where the earlier opencode --version check succeeded. It starts a local server and opens its web interface. In T3 Code, open Settings and enable the OpenCode provider; it is off by default.
If T3 Code cannot find OpenCode, stop here. First confirm that opencode --version still succeeds in the terminal you use to start T3 Code. Restart T3 Code from that terminal. Set an explicit Binary path only when the provider remains unavailable; use the executable location reported by your operating system or package manager, rather than a path copied from this guide.
Create a session, select your project folder, choose OpenCode as the provider, and select the DigitalOcean model you verified. You do not need to authenticate with DigitalOcean again in T3 Code.
npx t3@latest5. Make your first change without giving the agent too much freedom
Start in the agent's planning mode if it offers one. Ask for a plan, read it, then explicitly approve a small change. A good first task changes one file and is easy to review or undo.
After the agent finishes, inspect its file changes before you run the app or commit anything. Keep an eye on your DigitalOcean prepaid balance as well: Serverless Inference is billed by input and output token, and requests stop when the balance reaches zero.
Before editing, show me a short plan. Change only the smallest file needed to add a short greeting to the homepage. Do not install packages, change configuration, or touch unrelated files. Stop and tell me what changed when you are done.If it does not work, fix the right thing
If opencode --version fails, install OpenCode again, open a new terminal, and rerun the check. If OpenCode opens but DigitalOcean is absent from /connect, update OpenCode with npm install -g opencode-ai and restart it.
If DigitalOcean works in OpenCode but its model is missing in T3 Code, stop T3 Code, confirm the model remains visible through /models in OpenCode, then restart T3 Code from a terminal where opencode --version succeeds. Update T3 Code before changing settings, since provider discovery can change between releases.
If T3 Code cannot find OpenCode after that restart, use the platform-specific command below to find the executable. Enter the result in Settings only if you need to set an explicit Binary path. If a request fails after setup, verify your DigitalOcean account can use Serverless Inference, then rerun /connect. Do not create a second credential or edit configuration files until those checks are complete.
(Get-Command opencode).Source