OpenCode is an open source AI coding agent for the terminal, desktop and IDEs. It isn't tied to one model vendor: it ships with 75+ providers and can connect to any OpenAI-compatible API.
Example: OpenCode connects to Codelux Gateway at codelux.io/v1/messages and uses anthropic / claude-sonnet-5. The same agent can switch between claude-sonnet-5, claude-opus-5-5, gpt-6-sol, DeepSeek-V41-Flash, kimi-k3, glm-5.3 and more.
How to use OpenCode with Codelux
About 10 minutes: install OpenCode → create a key in Portal → import with CC-Switch or add the provider with /connect + opencode.json → pick a model.
1. Install OpenCode
You need a modern terminal such as WezTerm, Alacritty, Ghostty or Kitty. On Windows, WSL is recommended.
Pick a subscription plan or top up in Billing — any balance works for every agent.
Open API Keys in the left menu and click Create New Key. Give it a name you will recognise, such as the agent's name.
After it is created, copy the API key (starts with sk-) and the API base URL. The key is shown in full only once, so keep it somewhere safe.
4Install CC-Switch
CC-Switch is an open-source (MIT) desktop app that manages API providers for Claude Code, Codex, Gemini CLI, OpenCode and more. It writes the configuration files for you, so you don't have to edit them by hand. Requirements: Windows 10+, macOS 12+, or Linux x86_64/ARM64 with glibc 2.35+ and WebKitGTK 4.1 (e.g. Ubuntu 22.04+, Debian 12+).
Install with Homebrew (recommended):
Terminal
brew install --cask cc-switch
Or download CC-Switch-v{version}-macOS.dmg from Releases. It is a Universal build signed and notarized by Apple, so it runs on both Apple Silicon and Intel Macs.
Download CC-Switch-v{version}-Windows.msi (or the -Windows-Portable.zip portable build) from Releases and run it. On ARM Windows use the -Windows-arm64 files.
From Releases, download the .deb (Debian/Ubuntu), .rpm (Fedora etc.) or .AppImage for your architecture. For example on Ubuntu:
Terminal
sudo apt install ./CC-Switch-v*-Linux-x86_64.deb
On Arch Linux: paru -S cc-switch-bin.
CC-Switch main window: pick the app at the top, then enable a provider; the orange + button adds a new one.
5Import Codelux into CC-Switch in one click
Keep CC-Switch running (it registers the ccswitch:// link handler on first launch).
In Portal, on the success page of the key you just created, find Import to desktop clients. It is only shown on desktop browsers.
On the CC-Switch card, set Target app to OpenCode, then click Import.
Your browser asks to open CC-Switch — allow it. CC-Switch shows a confirmation dialog with the provider name (Codelux), endpoint and key; confirm to add it.
In CC-Switch, switch to OpenCode at the top and make sure the Codelux provider is enabled.
Prefer to add it by hand? In CC-Switch click the orange + → Custom, fill in Provider name (e.g. codelux.io), Websitehttps://codelux.io, your API Key and the Request URL (the Codelux API base URL, no trailing slash), then click Add.
Adding Codelux manually in CC-Switch. For Claude Code the request URL is the host only, without a trailing slash.
In CC-Switch, OpenCode is a co-existing app: the card button is Add, several providers can stay configured, and you choose between them with /models. Reopen your terminal after importing.
6(Option B) Store the key with /connect
Start opencode and run /connect.
Scroll to the bottom and choose Other.
Enter the provider ID codelux — it must match the key used in opencode.json.
Paste your Codelux API key. It is saved to ~/.local/share/opencode/auth.json.
7(Option B) Add the provider to opencode.json
Edit the global config ~/.config/opencode/opencode.json (or opencode.json in a project root to scope it to that project):