Skip to content

OpenCode Configuration Guide

Open-source AI coding assistant — your intelligent coding partner in the terminal

📋 Overview

OpenCode is an open-source AI coding assistant that helps you write, debug, and improve code from the terminal, an IDE, or a desktop app. With a native terminal TUI, parallel sessions, and support for 75+ model providers, it's an ideal companion for command-line developers.

ResourceURL
OpenCode projecthttps://github.com/opencode-ai/opencode

✨ Features

  • Native terminal TUI: Built for CLI developers — fast and fluid
  • Smart LSP loading: Loads the right language server automatically for better context
  • Parallel sessions: Run multiple sessions side by side without interference
  • Shareable session links: Share a session link with collaborators
  • 75+ model providers: Cloud and local models alike
  • Multi-platform: Terminal CLI, desktop app (Beta), and IDE extensions

🛠️ Install & Configure

Step 1: Install OpenCode

Open a terminal and install OpenCode globally:

bash
npm install -g opencode-ai

Once installed, run opencode in the terminal. The TUI should appear.

Successful install screen

Step 2: Install CC-Switch

Follow the CC-Switch configuration tool docs to download and install CC-Switch locally.

Step 3: Add the MortyCode Provider

1. Choose the configuration target

Open CC-Switch, select OpenCode at the top, then click Add Provider.

Add provider screen

2. Fill in the provider details

Configure the fields as follows:

FieldDescription
Preset providerSelect MortyCode
Provider identifierA custom name like MortyCode-Claude
API formatUse Anthropic for Claude; OpenAI for GPT; Google (Gemini) for Gemini
API KeyPaste the Key you created in the MortyCode console
Extra optionsSet {"setCacheKey":true}

💡 Supported Groups

Pick the API Key from the right group for the models you want:

Reverse-only group

  • Claude series: reverse-only group
  • GPT series: Codex group
  • Gemini series: Gemini group

Select the matching group when you create a dedicated Key.

✅ Verify the Setup

  1. Reopen the terminal and run opencode
  2. Run /models and check whether your configured channel appears in the list
  3. If you see your model, the setup is good to go

Model list verification

Happy coding! 🎉

Chat in action

FAQ

"npm not found" on install?

Install Node.js first — see Node.js environment setup.

Configured channel not showing in the model list?

  • Confirm the configuration is saved in CC-Switch
  • Restart your terminal and run opencode again
  • Double-check that the API Key is correct

More Questions

See the FAQ or contact support.

Friendly, helpful, and made with care