Opencode.AI is a free open source CLI coding agent.
The CBorg Client repository provides a custom build of Opencode with LiteLLM provider support and accurate cost tracking for CBorg API users, along with pre-compiled release binaries, a build script, and a sample configuration file.
Installation
Quick Install (Pre-compiled Binary)
Pre-compiled binaries with the CBorg LiteLLM patches are published to the awschmeder/opencode releases. Download the artifact for your platform and install it to /usr/local/bin.
macOS (Apple Silicon – arm64)
curl -L https://github.com/awschmeder/opencode/releases/download/latest/opencode-darwin-arm64.zip \
-o opencode.zip \
&& unzip opencode.zip \
&& sudo install -m 755 opencode /usr/local/bin/opencode \
&& sudo codesign --force --sign - /usr/local/bin/opencodemacOS users: Re-signing the binary with
codesign(shown above) is required, otherwise macOS may terminate it with a SIGKILL on launch.
Linux (x86_64)
curl -L https://github.com/awschmeder/opencode/releases/download/latest/opencode-linux-x64.tar.gz \
| tar -xz \
&& sudo install -m 755 opencode /usr/local/bin/opencodeLinux (ARM64)
curl -L https://github.com/awschmeder/opencode/releases/download/latest/opencode-linux-arm64.tar.gz \
| tar -xz \
&& sudo install -m 755 opencode /usr/local/bin/opencodeVerify the installation:
opencode --versionmacOS users: Opencode has known issues with the native Terminal app on macOS. Install Ghostty and launch Opencode from within it for the best experience:
brew install --cask ghostty
Build from Source
To build your own CBorg-patched Opencode binary, use the build script and Makefile in the cborg-client opencode folder. This requires Bun and git:
git clone https://github.com/lbnl-science-it/cborg-client.git \
&& cd cborg-client/opencode \
&& make build \
&& sudo make installmake build clones upstream Opencode, applies the LiteLLM provider patch (PR #14468) plus the additional cost-tracking patches, and compiles a native binary for your platform. See the cborg-client opencode README for details on the included patches and other build targets.
Configuration
A pre-configured opencode.json file is available in the cborg-client opencode folder. Copy it to your Opencode config directory at ~/.config/opencode/opencode.json:
mkdir -p ~/.config/opencode \
&& curl -L https://raw.githubusercontent.com/lbnl-science-it/cborg-client/main/opencode/opencode.json \
-o ~/.config/opencode/opencode.jsonIf you cloned the repository, copy it directly instead:
mkdir -p ~/.config/opencode \
&& cp cborg-client/opencode/opencode.json ~/.config/opencode/opencode.jsonThen save your CBorg API key to the environment variable CBORG_API_KEY:
export CBORG_API_KEY=your-api-key-hereThe configuration file contents:
{
"$schema": "https://opencode.ai/config.json",
"enabled_providers": ["litellm"],
"model": "litellm/cborg-coder-fast",
"provider": {
"litellm": {
"name": "CBorg API",
"options": {
"baseURL": "https://api.cborg.lbl.gov/v1",
"apiKey": "{env:CBORG_API_KEY}"
},
"models": {
"cborg-coder-fast": {
"name": "CBorg Coder Fast",
"textVerbosity": "low",
"reasoningSummary": "off"
},
"cborg-coder": {
"name": "CBorg Coder",
"textVerbosity": "low",
"reasoningSummary": "off"
},
"gemini-flash-lite": {
"name": "Gemini Flash Lite ($)",
"textVerbosity": "low",
"reasoningSummary": "off"
},
"gemini-flash": {
"name": "Gemini Flash ($$)",
"textVerbosity": "low",
"reasoningSummary": "off"
},
"gemini-pro-high": {
"name": "Gemini Pro ($$$)",
"textVerbosity": "low",
"reasoningSummary": "off"
},
"gpt-codex": {
"name": "GPT Codex ($$)",
"textVerbosity": "low",
"reasoningSummary": "off"
},
"claude-sonnet-high": {
"name": "Claude Sonnet ($$$)",
"textVerbosity": "low",
"reasoningSummary": "off"
},
"claude-opus-high": {
"name": "Claude Opus ($$$$)",
"textVerbosity": "low",
"reasoningSummary": "off"
}
}
}
},
"mcp": {
"context7": {
"type": "remote",
"url": "https://api.cborg.lbl.gov/mcp/context7",
"enabled": true,
"headers": {
"Authorization": "Bearer {env:CBORG_API_KEY}"
}
},
"valency": {
"type": "remote",
"url": "https://api.cborg.lbl.gov/mcp/valency",
"enabled": true,
"headers": {
"Authorization": "Bearer {env:CBORG_API_KEY}"
}
}
},
"tools": {
"*": true
}
}Additional models available on the proxy are discovered automatically at startup. To use a different default model, edit ~/.config/opencode/opencode.json and change the "model" field.