Skip to content

OpenCode install guide (Linux / WSL2) ​

Prefer one command?

The OpenCode one-line setup installs OpenCode and configures Claude and GPT for you.

0. Prerequisite: install Node.js ​

Install Node.js first: Node.js on Linux

1. Install OpenCode ​

Step 1: Install OpenCode globally

bash
npm i -g opencode-ai@latest

Step 2: Check the install

bash
opencode --version

If you see a version number, it worked.

2. Install the SDKs (required) ​

2.1 What's an SDK? ​

An SDK is the package that lets OpenCode talk to a given AI service. You need to install the matching one first.

Step 1: Create the config directory

bash
mkdir -p ~/.config/opencode

Step 2: Go into it

bash
cd ~/.config/opencode

Step 3: Install the Anthropic SDK (for Claude models)

bash
npm install @ai-sdk/anthropic

Wait for it to finish (it can take a few minutes).

2.3 Optional: install the OpenAI SDK ​

Want GPT models too? Install the OpenAI SDK as well:

bash
npm install @ai-sdk/openai

Tip: Flash API serves both Claude and GPT, so installing both SDKs saves you a trip later.

3. Configure OpenCode (connect to Flash API) ​

3.1 Where's the config file? ​

Config path: ~/.config/opencode/opencode.json

What that means:

  • ~ is your home directory
  • The full path is /home/<your-username>/.config/opencode/opencode.json

3.2 Get your Flash API key ​

Step 1: Grab your API key from Flash API

  • No account yet? Sign up first
  • After logging in, find your API key in the dashboard and copy it

3.3 Write the config file ​

Here's a config for Claude models (replace the API key):

bash
cat > ~/.config/opencode/opencode.json <<'EOF'
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "flashapi-claude": {
      "npm": "@ai-sdk/anthropic",
      "options": {
        "apiKey": "YOUR_FLASH_API_KEY",
        "baseURL": "https://ai.flashapi.top/v1"
      },
      "models": {
        "claude-opus-5-5": {
          "name": "Claude Opus 5.5",
          "attachment": true
        }
      }
    }
  },
  "model": "flashapi-claude/claude-opus-5-5"
}
EOF

Must replace: swap YOUR_FLASH_API_KEY for the real key you copied from Flash API.

How to do it:

  1. Copy the whole command above
  2. Replace YOUR_FLASH_API_KEY with your real key
  3. Paste it into the terminal and run it

3.4 Adding GPT models too ​

If you installed @ai-sdk/openai earlier, use this config instead (Claude and GPT side by side):

bash
cat > ~/.config/opencode/opencode.json <<'EOF'
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "flashapi-claude": {
      "npm": "@ai-sdk/anthropic",
      "options": {
        "apiKey": "YOUR_FLASH_API_KEY",
        "baseURL": "https://ai.flashapi.top/v1"
      },
      "models": {
        "claude-opus-5-5": {
          "name": "Claude Opus 5.5",
          "attachment": true
        }
      }
    },
    "flashapi-openai": {
      "npm": "@ai-sdk/openai",
      "options": {
        "apiKey": "YOUR_FLASH_API_KEY",
        "baseURL": "https://ai.flashapi.top/v1"
      },
      "models": {
        "gpt-6.1-sol": {
          "name": "GPT-6.1 Sol",
          "attachment": true
        }
      }
    }
  },
  "model": "flashapi-claude/claude-opus-5-5"
}
EOF

What the config does:

  • "model" sets the default model
  • To default to GPT, change it to "model": "flashapi-openai/gpt-6.1-sol"
  • "attachment": true enables file uploads (images, code files, etc.)

4. Start and verify ​

Step 1: Go to your project directory

bash
cd /path/to/your/project

Replace /path/to/your/project with your actual project path.

Step 2: Start OpenCode

bash
opencode

If everything is configured correctly, OpenCode starts up connected to Flash API.

One base URL for GPT, Claude and Gemini