Get started with OpenCode and Berget AI
Install OpenCode, connect it to Berget AI, and run your first AI-assisted coding session on European infrastructure
In this tutorial, you'll install OpenCode, configure it to use Berget AI as its AI provider, and run your first prompt from the terminal. By the end, you will have a working AI coding assistant running on Berget AI's European infrastructure.
Before you start
To complete this tutorial, you'll need:
- A terminal on macOS, Linux, or Windows
- A Berget AI account (free to create)
Set up OpenCode
You'll configure OpenCode to send requests to Berget AI instead of its default provider.
Install OpenCode
Install the OpenCode CLI using your preferred method.
curl -fsSL https://opencode.ai/install | bashbrew install anomalyco/tap/opencodenpm install -g opencode-aiVerify the installation by running:
opencode --versionInstall the Berget AI plugin
Create a file called opencode.json in your project root (or in ~/.config/opencode/opencode.json to apply it globally).
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@bergetai/opencode-auth"]
}Create a Berget AI API key
- Go to API Keys in the Berget AI Console.
- Click + Create New Key.
- Enter a name in the Key Name field (e.g.
OpenCode). - Click + Create Key.
- Store it somewhere safe — it won't be shown again.
berget api-keys create --name "OpenCode"The key is printed once in full (sk_ber_... format). Store it somewhere safe — it won't be shown again.
Connect the Berget AI provider
In the text field, type /connect and select Berget AI from the list of providers. Then select Enter Berget API Key manually and submit your API key.
You can now select any of our models by pressing Ctrl+X and then M. We recommend GLM 4.7 for coding tasks.
What you built
You now have OpenCode running as an AI coding assistant in your terminal, backed by Berget AI. Every prompt you send — your code, your questions, the responses — stays within the EU and is processed on Berget AI's European infrastructure.
For more information how to use OpenCode, see the OpenCode docs.
Next steps
- Models — browse available models
- Quickstart — call Berget AI directly from your own code