Use Clovis with OpenCode from the command line
OpenCode is the recommended integration for using ClovisLLM as a command-line coding assistant. It can explore a project, explain or generate code, and run tasks from the terminal.
This quickstart installs OpenCode, configures the Clovis provider, and starts a first session. For advanced features, see the official OpenCode documentation (in English).
See the OpenCode Desktop guide. The Clovis provider configuration is identical and shared between both interfaces.
Prerequisites
- Node.js and npm installed;
- a dedicated Clovis API key for OpenCode;
- a terminal open with your usual user account.
Do not put the API key in opencode.json, and never commit it. The /connect command stores it separately from the configuration.
1. Install OpenCode
For OpenCode 2, the official npm package is @opencode/cli. The same command works on all three platforms.
- Linux
- macOS
- Windows
npm install -g @opencode/cli
npm install -g @opencode/cli
You can also use the Homebrew tap maintained by OpenCode:
brew install anomalyco/tap/opencode-v2
In PowerShell:
npm install -g @opencode/cli
For full compatibility with Unix development tools, OpenCode recommends WSL. If you use WSL, install Node.js and then OpenCode inside your Linux distribution.
Check the installation:
opencode --version
If the command is not recognized right away, close and reopen the terminal to reload the PATH.
2. Configure the Clovis provider
OpenCode reads its configuration from the global opencode.json file (or opencode.jsonc if you prefer JSON comments). This file does not necessarily exist after installation: create it if needed, along with its parent folder.
- Linux
- macOS
- Windows
The file is located here:
~/.config/opencode/opencode.json
The file is located here:
~/.config/opencode/opencode.json
In PowerShell, the file is available at:
$HOME\.config\opencode\opencode.json
With WSL, use ~/.config/opencode/opencode.json inside your Linux distribution's file system.
Windows reference
The full path looks like C:\Users\user\.config\opencode\opencode.json.

Check that the file is named opencode.json, not opencode.json.txt.

- OpenCode 2
- OpenCode 1
Copy this configuration into the file:
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"clovis": {
"name": "Clovis",
"env": ["CLOVIS_API_KEY"],
"package": "@opencode/ai/providers/openai-compatible",
"settings": {
"baseURL": "https://llm-gateway.clovis-ai.fr/v1"
},
"models": {
"ClovisLLM": {
"name": "ClovisLLM",
"limit": {
"context": 300000,
"output": 32000
}
}
}
}
},
"model": "clovis/ClovisLLM"
}
This configuration:
- declares a provider with the ID
clovis, compatible with the OpenAI API of the Clovis gateway; - declares the ClovisLLM model with its context and output limits;
- selects ClovisLLM as the default model through the
modelproperty.
The same configuration is used by OpenCode Desktop. You can also place an opencode.json file at the root of a project to override the global configuration there.
If you use OpenCode 1, copy this example into opencode.json. To install the OpenCode 1 CLI, use npm install -g opencode-ai@1. Check the installed version with opencode --version.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"clovis": {
"name": "Clovis",
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://llm-gateway.clovis-ai.fr/v1",
"apiKey": "{env:CLOVIS_API_KEY}"
},
"models": {
"ClovisLLM": {
"name": "ClovisLLM",
"limit": {
"context": 300000,
"output": 32000
}
}
}
}
},
"model": "clovis/ClovisLLM"
}
Set the CLOVIS_API_KEY environment variable in your terminal before running opencode from your project directory. Then continue to step 4 to select ClovisLLM.
3. Register the Clovis API key
This step applies to OpenCode 2.
Move to the project you want to work on, then start OpenCode:
cd /path/to/your-project
opencode
Inside OpenCode:
- enter
/connect; - choose Clovis in the provider list;
- choose the API key entry method;
- paste your Clovis API key and confirm.
clovisOpenCode associates the stored key with the providers.clovis section of the configuration file. Any difference in case or spelling breaks this association.
You can check that the key is stored with:
opencode auth list
The opencode auth login clovis --method key command stores the key without opening the interface. You can also set the CLOVIS_API_KEY environment variable before running opencode.
4. Select ClovisLLM
The "model": "clovis/ClovisLLM" property from step 2 automatically selects ClovisLLM at startup.
To switch models, enter /models in OpenCode and choose ClovisLLM in the Clovis section. The opencode models command lists all available models from the terminal, including ClovisLLM.
5. Start a development session
Run opencode from the root of your project, then send a first request, for example:
Explain the structure of this project and report the available test commands.
To guide the assistant on your repository conventions, create an AGENTS.md file at the root of the project describing the rules to follow, then commit it: OpenCode reads it automatically at each session.
6. Check the connection
Verify that ClovisLLM is available:
opencode models
Then, in an OpenCode session, check that the active model shown is ClovisLLM and that the answer to a simple request comes from Clovis.
Troubleshooting
| Problem | Check |
|---|---|
opencode is not recognized | reopen the terminal, then check that the global npm directory is in the PATH |
| ClovisLLM does not appear | check the path and syntax of opencode.json, then restart OpenCode |
| The key is not used | check that the provider chosen in /connect is exactly clovis, then run opencode auth list |
The CLOVIS_API_KEY variable is not taken into account | the variable must be visible to the OpenCode process; if in doubt, use /connect to store the key persistently |
| The gateway connection fails | check the base URL https://llm-gateway.clovis-ai.fr/v1 and your network access to the Clovis service |
| The native Windows installation causes problems | use WSL, recommended by OpenCode for full compatibility |
Go further
- OpenCode 1 configuration
- Installation and getting started (in English)
- JSON/JSONC configuration (in English)
- Providers and authentication (in English)
- OpenCode agents (in English)
To update an npm installation:
npm update -g @opencode/cli