Skip to main content

Install and use OpenCode

OpenCode is an agentic coding tool. It is available as a terminal application, desktop application and IDE extension.

AI-Corporate recommends OpenCode for developers, administrators and other advanced users. OpenCode can independently modify files and work out tasks, so always review the proposed changes.

More information is available on the OpenCode website and in the official OpenCode documentation.

Install

The simplest installation according to the OpenCode documentation is:

curl -fsSL https://opencode.ai/install | bash

You can also install OpenCode with Node.js:

npm install -g opencode-ai

Or with Homebrew on macOS and Linux:

brew install anomalyco/tap/opencode

Connect to Coding

OpenCode supports custom OpenAI-compatible providers. Create an opencode.json file in the project folder.

Use the Coding endpoint and allowed models:

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ai-corporate-coderen": {
"npm": "@ai-sdk/openai-compatible",
"name": "AI-Corporate Coding",
"options": {
"baseURL": "https://europe-west1-ai-corporate.cloudfunctions.net/coderenOpenAiCompatibleApi/v1",
"apiKey": "{env:AI_CORPORATE_CODEREN_API_KEY}"
},
"models": {
"gpt-5.4-mini": {
"name": "GPT-5.4 mini"
},
"gpt-5.4": {
"name": "GPT-5.4"
},
"gpt-5.5": {
"name": "GPT-5.5"
}
}
}
},
"model": "ai-corporate-coderen/gpt-5.4-mini",
"small_model": "ai-corporate-coderen/gpt-5.4-mini"
}

Then set the API key as an environment variable.

macOS and Linux

export AI_CORPORATE_CODEREN_API_KEY="aic.your-api-key"

Windows

setx AI_CORPORATE_CODEREN_API_KEY "aic.your-api-key"

Open a new terminal afterwards.

Start OpenCode

Go to the project folder:

cd path/to/your/project

Start OpenCode:

opencode

Use the model selector in OpenCode to select the AI-Corporate Coding model if it is not selected automatically.

Work safely with OpenCode

Because OpenCode is agentic, it is important to review changes.

Recommended workflow:

  1. Work in a Git repository.
  2. Start with small tasks.
  3. Review diffs before using code.
  4. Test the application after changes.
  5. Commit only changes you understand.

Environment variables and OpenCode

For OpenCode, you can store the coding API key in a local .env file in the project folder:

AI_SCHOOL_CODEREN_API_KEY=ais.your-api-key

Make sure OpenCode actually loads this environment variable. In PowerShell you can also set it temporarily for the current terminal:

$env:AI_SCHOOL_CODEREN_API_KEY="ais.your-api-key"

If you see Authorization header met Bearer token is verplicht, the tool did not send the key as Authorization: Bearer .... If you see Unknown parameter, remove provider-specific settings that the AI-Corporate coding endpoint does not support.