Skip to main content

Install and Use OpenCode

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

AI-Corporate recommends OpenCode for developers, administrators, and other advanced users. OpenCode can modify files autonomously and work out tasks. Always review the suggested changes.

More information can be found 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 with Coding

OpenCode supports [custom OpenAI-compatible providers]. Create a file named opencode.json in your project folder.

Use it to configure the Coding endpoint and the 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.6-luna": {
"name": "GPT-5.6 Luna"
},
"gpt-5.6-terra": {
"name": "GPT-5.6 Terra"
},
"gpt-5.6-sol": {
"name": "GPT-5.6 Sol"
}
}
}
},
"model": "ai-corporate-coderen/gpt-5.6-luna",
"small_model": "ai-corporate-coderen/gpt-5.6-luna"
}

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 afterward.

Start OpenCode

Navigate to the project folder:

cd path/to/your/project

Start OpenCode:

opencode

In OpenCode, use the model selection to choose the AI-Corporate Coding model if it is not done automatically.

Safe working 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 applying 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 the variable temporarily for the current terminal:

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

If you see Authorization header with Bearer token is required, the tool is not sending the key as Authorization: Bearer .... If you see Unknown parameter, remove provider-specific settings that the Coding endpoint from AI-Corporate does not support.

WhatsApp