Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.salad.com/llms.txt

Use this file to discover all available pages before exploring further.

Last Updated: May 18, 2026

Introduction

OpenCode is an open-source AI coding agent that runs as a terminal UI. Built in Go, it provides a rich interactive interface for coding, planning, reviewing, and debugging directly from your terminal. OpenCode was built with custom model providers in mind and includes first-class support for OpenAI-compatible endpoints. OpenCode works with SaladCloud in two ways:
  • Salad AI Gateway - no infrastructure to deploy or manage. Sign up for access, point OpenCode at a single shared endpoint, and use your Salad API key directly. Currently in closed beta with monthly flat-rate access.
  • 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:
  • A SaladCloud account
  • Node.js 18+ installed (for the @ai-sdk/openai-compatible package used internally by OpenCode)
  • A terminal environment (Linux, macOS, or WSL on Windows)

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 up for early access at salad.com/ai-gateway.
  2. Once approved, find your Salad API key in the portal.
Available models:
ModelDescription
qwen3.6-35b-a3bQwen 3.6 35B-A3B - best for agentic tasks, coding, and complex reasoning
qwen3.6-27bQwen 3.6 27B - strong balance of capability and speed
qwen3.5-9bQwen 3.5 9B - fastest response times, suited for lighter tasks

Step 2: Install OpenCode

Install OpenCode using the official install script:
curl -fsSL https://opencode.ai/install | bash
Or install via npm:
npm install -g opencode-ai
Verify the installation:
opencode --version

Step 3: Configure OpenCode to Use Your SaladCloud Endpoint

Create or edit the OpenCode configuration file at ~/.config/opencode/opencode.json:
{
  "$schema": "https://opencode.ai/config.json",
  "model": "saladcloud/qwen3.6-35b-a3b",
  "provider": {
    "saladcloud": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "SaladCloud AI Gateway",
      "options": {
        "baseURL": "https://ai.salad.cloud/v1",
        "apiKey": "your-salad-api-key"
      },
      "models": {
        "qwen3.6-35b-a3b": {
          "name": "Qwen 3.6-35B-A3B",
          "limit": { "context": 262144, "output": 32768 }
        },
        "qwen3.6-27b": {
          "name": "Qwen 3.6-27B",
          "limit": { "context": 262144, "output": 32768 }
        },
        "qwen3.5-9b": {
          "name": "Qwen 3.5-9B",
          "limit": { "context": 262144, "output": 32768 }
        }
      }
    }
  }
}
No custom headers are needed - your Salad API key in apiKey is all that’s required.

Step 4: Launch OpenCode and Test the Connection

Navigate to your project directory and start OpenCode:
cd /path/to/your/project
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.

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

To avoid re-exporting SALAD_API_KEY in every terminal session, add it to your shell profile:
echo 'export SALAD_API_KEY=your-salad-api-key' >> ~/.bashrc
source ~/.bashrc