← All guidesAI Development

Set Up an AI Coding Agent Without Managing Your Own Models

A deliberate, OS-agnostic guide to connecting OpenCode and T3 Code to serverless inference, then making a safe first change.

What this guide helps you do

You are connecting three separate pieces. A serverless inference provider supplies models and billing. OpenCode is the coding agent that authenticates with that provider. T3 Code is a local interface that starts and manages OpenCode sessions.

This guide uses DigitalOcean as the serverless inference provider. Sign in to it inside OpenCode first. Do not put a provider credential in your repository, a configuration file, or a T3 Code setting. Once OpenCode can use the 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.

Check your Node.js version
node --version
Install OpenCode
npm install -g opencode-ai
Verify OpenCode is available
opencode --version

2. Connect a serverless inference provider 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.

Open your project and start OpenCode
Set-Location -LiteralPath "C:\path\to\your-project"
opencode
Enter this in OpenCode
/connect

3. 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).

Choose a model in OpenCode
/models
Paste this read-only test prompt
Read 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.
First test

Verify this workflow before scaling it

Input
Use one disposable project folder and a read-only task, such as listing package scripts and the first failing check.
Build
Connect the provider in OpenCode, select the model, then let T3 Code use that verified OpenCode session.
Expected result
The agent returns a small inspection summary without asking for another credential or changing a file.
Stop if
Stop if a model is absent, authentication repeats, or the request asks for repository changes before the inspection succeeds.
Next step
Review the summary, choose one small edit yourself, and run the original check again.

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.

Start T3 Code
npx t3@latest

5. 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.

Paste this tightly scoped first task
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.

Find the OpenCode executable
(Get-Command opencode).Source