Skip to content

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.

For the terminal or one-shot CLI:

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

Other supported installers include npm and Homebrew:

Terminal window
npm install -g opencode-ai
brew install anomalyco/tap/opencode

For the desktop app, download OpenCode Desktop from opencode.ai/download, or install it with a package manager:

Terminal window
brew install --cask opencode-desktop

Create an API key in the ai& console, then add it to OpenCode in whichever surface you use.

In the OpenCode TUI, run:

/connect

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

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.

For CI, scripts, or non-interactive runs:

Terminal window
export AIAND_API_KEY="sk-your-aiand-api-key"

Open the model picker and choose a model from the ai& section:

/models

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

Interactive terminal UI:

Terminal window
opencode

One-shot CLI:

Terminal window
opencode run "say hi in one word"

The Desktop app uses the same built-in ai& provider as the terminal:

  1. Install OpenCode Desktop from opencode.ai/download.
  2. Open Settings → Providers → View all providers, search for ai&, and paste your API key.
  3. Open a project folder.
  4. Run /models and choose an aiand/... model.

Check that OpenCode can reach ai&:

Terminal window
opencode run -m aiand/zai-org/glm-5.2 "reply with only: ok"

You can also test the key directly against ai&:

Terminal window
curl -sS https://api.aiand.com/v1/models \
-H "Authorization: Bearer $AIAND_API_KEY"
  • 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 with opencode run -m aiand/<model-id>.
  • Unauthorized request — re-enter the key with /connect or opencode auth login (terminal) or under Settings → Providers → View all providers → ai& (Desktop), or confirm AIAND_API_KEY is 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_KEY is already exported.