Skip to main content

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 your first session. For advanced features, continue with the official OpenCode documentation.

Prefer a graphical interface?

See the OpenCode Desktop guide to install the application and configure Clovis without editing a file.

Prerequisites

  • Node.js and npm installed;
  • a dedicated Clovis API key for OpenCode;
  • a terminal opened with your regular user account.
Keep the key secret

Do not put the API key in opencode.jsonc, and never commit it. The /connect command stores it separately from the configuration.

1. Install OpenCode

The official npm package is named opencode-ai. The same command works on all three platforms.

npm install -g opencode-ai

Check the installation:

opencode --version

If the command is not immediately recognized, close and reopen the terminal to reload the PATH.

2. Configure the Clovis provider

After installation, the configuration directory and the global opencode.jsonc file are already present. Simply open this file in your text editor, then replace its contents with the Clovis configuration below.

The file is located here:

~/.config/opencode/opencode.jsonc

Copy this configuration into the file:

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"clovis": {
"npm": "@ai-sdk/openai-compatible",
"name": "Clovis",
"options": {
"baseURL": "https://llm-gateway.clovis-ai.fr/v1"
},
"models": {
"ClovisLLM": {
"name": "ClovisLLM"
}
}
}
},
"model": "clovis/ClovisLLM"
}

The model property automatically selects ClovisLLM at startup. You must enter the clovis provider ID exactly as written when connecting.

3. Store the Clovis API key

Go to the project you want to work on, then start OpenCode:

cd /path/to/your/project
opencode

In OpenCode:

  1. enter /connect;
  2. select Other Custom provider;
  3. enter exactly clovis as the provider ID;
  4. paste your Clovis API key and confirm.

Selecting a custom provider in OpenCode

Entering the clovis provider ID in OpenCode

Entering the Clovis API key in OpenCode

Why must the ID be clovis?

OpenCode associates the stored key with the provider.clovis section of the configuration file. A difference in spelling or capitalization prevents this association.

You can confirm that the provider ID is registered with:

opencode auth list

4. Verify the connection

Restart opencode if necessary. The home screen should display ClovisLLM as the active model.

ClovisLLM selected in OpenCode

Try an initial request, for example:

Explain the structure of this project and list the available test commands.

To initialize repository-specific instructions, run /init. OpenCode analyzes the project and proposes an AGENTS.md file: review it before keeping it in Git.

Troubleshooting

ProblemCheck
opencode is not recognizedreopen the terminal, then check that the global npm directory is present in the PATH
ClovisLLM does not appearcheck the path and syntax of opencode.jsonc, then restart OpenCode
The key is not being usedcheck that the provider ID entered with /connect is exactly clovis, then run opencode auth list
The native Windows installation causes problemsuse WSL, which OpenCode recommends for full compatibility

Go further

To update an npm installation:

npm update -g opencode-ai