Get started with OpenCode and Berget AI
Use the Berget AI CLI to set up OpenCode, connect it to Berget AI, and run your first AI-assisted coding session on Swedish infrastructure.
In this tutorial, you'll install OpenCode and use the Berget AI CLI to connect it to Berget AI. By the end, you have a working AI coding assistant running on Swedish 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
Install OpenCode
Install the OpenCode CLI using your preferred method.
curl -fsSL https://opencode.ai/v2/install | bashVerify the installation by running:
opencode --versionRun the setup wizard
Run the interactive setup to configure the Berget AI provider for OpenCode:
npx berget code initAlready running OpenCode v2? Run
/connectinside OpenCode instead ofnpx berget code init: it keeps your setup in sync with your installed OpenCode version.
Start OpenCode
opencodeType /connect and choose the browser login (your Berget AI subscription) or the API-key method. Then type /models to select a model for your session. Browse the available models in the models overview.
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 on how to use OpenCode, see the OpenCode docs.
Next steps
- Models—browse available models
- Quickstart—call Berget AI directly from your own code
Get started with Cline in VS Code and Berget AI
Install Cline, connect it to Berget AI, and write your first AI-assisted code, all without your data leaving Europe
Get started with Pi and Berget AI
Use the Berget AI CLI to set up Pi, connect it to Berget AI, and run your first AI-assisted coding session on Swedish infrastructure.