Skip to main content
Last Updated: September 17, 2026

Introduction

OpenCode is an open-source AI coding agent that runs in your terminal. It provides an interactive interface for coding, planning, reviewing, and debugging. OpenCode works with SaladCloud in two ways:
  • Salad AI Gateway - no infrastructure or custom provider configuration to manage. OpenCode discovers Salad AI Gateway through models.dev and loads the SaladCloud AI SDK provider automatically.
  • Self-hosted model - deploy your own SaladCloud container group for full control over the model, hardware, and configuration. Still very easy to set up and use.

Prerequisites

Before getting started, make sure you have:

Step-by-Step Setup

Step 1: Choose Your Backend

Salad AI Gateway is the fastest way to get started - no container groups to deploy, no cold starts to wait for.
  1. Sign in to the SaladCloud portal.
  2. Create or copy your AI Gateway API key by following Pay-Per-Token Onboarding.
Available models:

Step 2: Install OpenCode

Install OpenCode using the official install script:
Or install via npm:
Verify the installation:

Step 3: Connect OpenCode to SaladCloud

Choose the instructions for your backend:
Log in once to save your AI Gateway API key in OpenCode:
  1. Search for and select SaladCloud AI Gateway.
  2. Paste AI Gateway API key you created during onboarding.
  3. Press Enter to save it.
To skip provider selection, use opencode providers login --provider salad-cloud instead.
Use the key listed under AI Gateway Keys for your organization, not the regular SaladCloud Current API Key. Do not add a Salad-Api-Key header for AI Gateway.
OpenCode saves the credential locally, so you do not need to export an environment variable each time you open a terminal. Confirm that SaladCloud AI Gateway appears in the saved providers:
Refresh the models catalog and verify that the model is available:
The command should print:
Log in before running the models command. Without a saved credential or SALAD_CLOUD_API_KEY in the environment, OpenCode can report Provider not found: salad-cloud even when its models cache is current. If your version does not recognize providers, run opencode upgrade or use the older alias opencode auth login.
No custom provider block is required. OpenCode gets the endpoint and model metadata from models.dev and installs @saladtechnologies-oss/ai-sdk-provider automatically.As an alternative to saving credentials, export the key in the same terminal before running OpenCode:
To make Salad AI Gateway the default, add the model setting to ~/.config/opencode/opencode.json. A minimal configuration is shown below; preserve any settings already in your file:
The model setting is optional if you prefer to pass --model salad-cloud/qwen3.6-35b-a3b when launching OpenCode.

Step 4: Test the Connection

For Salad AI Gateway, make a test request directly from the command line:
For an interactive session, navigate to your project and start OpenCode:
OpenCode will open a TUI in your terminal. Test with a simple task:
“Create a hello world Python script that prints ‘Hello from SaladCloud!’”
If OpenCode successfully creates the file, your setup is complete.

Troubleshoot Provider Discovery

If OpenCode reports Provider not found: salad-cloud:
  1. Check whether SaladCloud appears in your saved providers:
  2. If it is missing, run opencode providers login and select SaladCloud AI Gateway. If you use the environment variable instead, confirm that SALAD_CLOUD_API_KEY is set in the terminal where you run OpenCode.
  3. Check your OpenCode version and upgrade if necessary:
  4. Run opencode models salad-cloud --refresh again.
If the provider is listed but requests return 401 Unauthorized, log in again with the organization-specific AI Gateway key. Listing models confirms provider discovery, not that your API key is valid.

Tips for Best Results

Use the Build Agent

OpenCode’s built-in build agent handles code generation and editing with all tools enabled. It uses whichever model is set as the default in your config. You can also switch to the built-in plan agent (Tab key) for read-only analysis and planning without the risk of unintended file modifications.

Context Window

The Qwen 3.6-35B-A3B recipe and AI Gateway support a 262,144 token context window. The context value in the config lets OpenCode track how much context is remaining and manage prompt sizes accordingly, so make sure it reflects your actual deployment configuration.

Persist Your API Key

Choose how to keep your credentials available:
opencode providers login saves your key locally for future sessions. No shell-profile change or API key in opencode.json is needed. Treat OpenCode’s credential file as a secret and do not commit or share it. See OpenCode’s authentication documentation for storage details.