Skip to main content

Use Clovis with OpenCode Desktop

OpenCode Desktop lets you use ClovisLLM as a coding assistant from a graphical application. Unlike the command-line version, everything happens in a standalone application, with no terminal.

Recent versions of OpenCode Desktop no longer include a graphical flow for adding a custom provider. Clovis is now declared in the opencode.json configuration file, shared with the CLI version. The procedure below covers installation, configuring the Clovis provider, and selecting ClovisLLM.

Also working from the command line?

The configuration described here is identical to the one in the OpenCode CLI guide. Once opencode.json is in place, both interfaces can use ClovisLLM.

Prerequisites​

  • a dedicated Clovis API key for OpenCode Desktop;
  • a computer running macOS, Windows x64/ARM64, or a Linux x64 distribution that uses DEB or RPM packages;
  • a text editor to modify the configuration file;
  • optional, but recommended: a local Git repository.
Keep your key secret

The API key provides access to the Clovis service. Never add it to a Git repository, a shared document, or a screenshot.

1. Download and install OpenCode Desktop​

Open the official OpenCode download page, then choose the OpenCode Desktop package for your computer:

SystemDownload
macOS.dmg for Apple Silicon or Intel
Windows.exe installer for x64 or ARM64
Linux.deb package for Debian/Ubuntu or .rpm package for Fedora/RHEL (x64)

On macOS, you can also install the application with Homebrew:

brew install --cask opencode-desktop

Install the downloaded package, then launch OpenCode Desktop.

2. Locate or create the opencode.json file​

OpenCode Desktop reads its configuration from the global opencode.json file (or opencode.jsonc if you prefer JSON comments):

SystemLocation
macOS / Linux~/.config/opencode/opencode.json
Windows$HOME\.config\opencode\opencode.json

This file does not necessarily exist after installation: create it if needed, along with its parent folder. The full path on Windows looks like C:\Users\user\.config\opencode\opencode.json.

One configuration for Desktop and CLI

OpenCode Desktop and OpenCode CLI share the same configuration file and the same background server. A key registered from one can be used from the other.

3. Add Clovis as a provider​

Open opencode.json in your text editor and copy the following configuration:

{
"$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 model property.

Save the file, then restart OpenCode Desktop so the configuration is taken into account.

4. Register your API key​

In OpenCode 2, you can store the key from the application or read it from a file.

  1. open a session in OpenCode Desktop;
  2. enter /connect in the prompt area;
  3. select Clovis in the provider list;
  4. choose the API key entry method, then paste your Clovis API key and confirm.

OpenCode stores the key separately from opencode.json. You can check it from a terminal with opencode auth list.

Method B: through a key file​

An application launched from the graphical interface does not always inherit the terminal's environment variables. To avoid this issue, store the key in a file and reference it from the configuration:

  1. create a ~/.clovis/api-key file containing only your API key;
  2. add the "apiKey" line to settings:
{
"$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",
"apiKey": "{file:~/.clovis/api-key}"
},
"models": {
"ClovisLLM": {
"name": "ClovisLLM",
"limit": {
"context": 300000,
"output": 32000
}
}
}
}
},
"model": "clovis/ClovisLLM"
}

OpenCode replaces {file:...} with the file contents at startup. If the file cannot be found, the value becomes an empty string: check the path if authentication fails.

Do not use the environment variable from Desktop

The {env:CLOVIS_API_KEY} syntax works, but an application launched from the graphical interface does not necessarily inherit your terminal's environment variables. From OpenCode Desktop, prefer method A or method B.

5. Select ClovisLLM​

The "model": "clovis/ClovisLLM" property from step 3 automatically selects ClovisLLM at startup.

To switch models temporarily, open the model selector from the prompt area and choose ClovisLLM in the Clovis section. The active model name appears below the prompt area.

6. Add a project and its Git context​

To work on a local repository:

  1. open the project selector below the prompt area;
  2. add the root directory of your Git repository.

Adding the project gives OpenCode access to the repository files and lets it retrieve the Git context, including the active branch and project changes. The detected branch appears next to the project name.

One project per repository

Select the root of the Git repository rather than a subdirectory so that the assistant receives the full project context.

7. Test the connection​

Send a first prompt, for example:

Explain the structure of this project and report the active Git branch.

OpenCode Desktop should answer with ClovisLLM while taking the selected project into account.

Troubleshooting​

ProblemCheck
ClovisLLM does not appearcheck the path and syntax of opencode.json, then restart OpenCode Desktop
Authentication failscheck the key in the Clovis administration console and make sure no spaces were copied before or after it
The {file:...} key is not readcheck that the ~/.clovis/api-key file exists and contains only the key; a missing file becomes an empty string
The environment variable is not visiblean application launched from the graphical interface does not inherit the terminal: use method A (/connect) or method B (key file)
The configuration file is not taken into accountcheck that the file is named opencode.json (or opencode.jsonc) in ~/.config/opencode/, without a .txt extension, then restart the application
The gateway connection failscheck the base URL https://llm-gateway.clovis-ai.fr/v1 and your network access to the Clovis service
The Git branch does not appearadd the root directory of a repository containing a .git directory
The download does not match your computerreturn to the official download page and select the appropriate architecture or package format

Go further​