OpenCode Guide
OpenCode is an open-source AI coding assistant framework. It supports integration with multiple AI models, including code generation, modification, and review workflows.
Installation
Choose an installation method based on your workflow.
macOS / Linux
curl -fsSL https://opencode.ai/install | bashWindows PowerShell
Using WSL is recommended. Install it with the macOS / Linux method above inside WSL.
Connect to Flux
After installation, choose one of the following methods to connect OpenCode to Flux.
Using CC-Switch is recommended for centralized configuration.
Steps:
- Follow Create API Key to generate an API key.
- Follow CC-Switch to configure a unified provider.
- Restart
OpenCodeafter configuration is complete.
Verify the Setup
Either configuration path can be confirmed with:
opencode models
opencode run -m openai/<model-id> "Reply with OK only"opencode models lists the loaded models; seeing your model ID there means the configuration was picked up. opencode run makes a real, billed call, and a reply means the setup works.
If the commands fail or the model list is empty, first rule the client out with Test the Key and Endpoint on Their Own, then review opencode.json.
Related Pages
- Create API Key - pick a group and generate a key
- API Endpoints - address and protocol format
- Troubleshooting - locate a problem by symptom
