OpenCode
OpenCode is an open source AI coding agent available as a terminal interface, CLI, IDE extension, and desktop app. ai& ships as a built-in OpenCode provider: connect with your API key and ai& models appear in the model picker.
1. Install OpenCode
Section titled “1. Install OpenCode”For the terminal or one-shot CLI:
curl -fsSL https://opencode.ai/install | bashOther supported installers include npm and Homebrew:
npm install -g opencode-aibrew install anomalyco/tap/opencodeOpenCode recommends WSL for the terminal experience. You can also install the Windows package:
choco install opencodeor:
scoop install opencodeFor the desktop app, download OpenCode Desktop from opencode.ai/download, or install it with a package manager:
brew install --cask opencode-desktopscoop bucket add extrasscoop install extras/opencode-desktop2. Connect ai&
Section titled “2. Connect ai&”Create an API key in the ai& console, then add it to OpenCode in whichever surface you use.
Terminal
Section titled “Terminal”In the OpenCode TUI, run:
/connectChoose ai& from the provider list and paste your sk-... key. OpenCode stores the credential and reuses it in future sessions.
Outside the TUI, opencode auth login walks through the same provider list from your shell.
Desktop app
Section titled “Desktop app”Open Settings → Providers → View all providers, search for ai&, and paste your sk-... key. The Providers screen lists only connected and popular providers by default, so ai& does not appear until you open the full list.
Environment variable
Section titled “Environment variable”For CI, scripts, or non-interactive runs:
export AIAND_API_KEY="sk-your-aiand-api-key"$env:AIAND_API_KEY = "sk-your-aiand-api-key"3. Pick a model
Section titled “3. Pick a model”Open the model picker and choose a model from the ai& section:
/modelsModel names use aiand/<model-id>, for example aiand/zai-org/glm-5.2. OpenCode pulls its provider catalog automatically, so new ai& models appear after a restart without reinstalling anything.
4. Run OpenCode
Section titled “4. Run OpenCode”Interactive terminal UI:
opencodeOne-shot CLI:
opencode run "say hi in one word"Desktop App
Section titled “Desktop App”The Desktop app uses the same built-in ai& provider as the terminal:
- Install OpenCode Desktop from opencode.ai/download.
- Open Settings → Providers → View all providers, search for ai&, and paste your API key.
- Open a project folder.
- Run
/modelsand choose anaiand/...model.
Verify
Section titled “Verify”Check that OpenCode can reach ai&:
opencode run -m aiand/zai-org/glm-5.2 "reply with only: ok"You can also test the key directly against ai&:
curl -sS https://api.aiand.com/v1/models \ -H "Authorization: Bearer $AIAND_API_KEY"Invoke-RestMethod https://api.aiand.com/v1/models ` -Headers @{ Authorization = "Bearer $env:AIAND_API_KEY" }Troubleshooting
Section titled “Troubleshooting”- ai& is missing from the provider list — update OpenCode to a recent version and restart it so it refreshes the provider catalog.
- A model from the ai& catalog is missing in
/models— the models.dev listing can lag behind the ai& catalog. Restart OpenCode; if it is still missing, pass the model id directly withopencode run -m aiand/<model-id>. - Unauthorized request — re-enter the key with
/connectoropencode auth login(terminal) or under Settings → Providers → View all providers → ai& (Desktop), or confirmAIAND_API_KEYis set in the process running OpenCode. - The Desktop app does not see your key — add it under Settings → Providers → View all providers → ai&, or launch Desktop from a shell where
AIAND_API_KEYis already exported.