Using AI Coding Agents

Coder workspaces provide a relatively safe way to experiment with AI coding agents, like OpenCode, Claude Code, or OpenAI’s Codex. These tools, which generate and also execute code, are very useful, but they come with significant risks. Because Coder workspaces are isolated virtual machines, the potential damage a rogue AI agent running in a workspace can cause is reduced (but not eliminated).

OpenCode

OpenCode is an open source coding agent that works with multiple AI services. OpenCode can be configured to use API-compatible model providers, including College IT’s AI Gateway and UCSB’s AI Commons.

OpenCode is pre-installed on all Coder workspaces. To start it, run opencode from the command line.

College IT (CIT) AI Gateway

On Coder workspaces, OpenCode is preconfigured with access to CIT’s AI gateway. To use CIT models, use OpenCode’s /models command, then filter the model list using “CIT”.

Available CIT models include:

  • gemma-4-31b: General chat, writing, summarization
  • qwen3-coder-next: Code generation, debugging, review
  • gpt-oss-120b: General use, strong language comprehension, fast

CIT’s documentation: https://docs.cloud.college.ucsb.edu/AI-LLM

UCSB AI Commons Gateway

Tip

The UCSB AI Commons gateway will be preconfigured in Coder workspaces starting October 2026. Until then, you will need to configure it manually.

To use UCSB’s AI Commons gateway, edit OpenCode’s configuration file ~/.config/opencode/opencode.json, and add a new provider entry called ucsb-ai-commons:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ucsb-ai-commons": {
      "name": "UCSB AI Commons",
      "options": {
        "baseURL": "https://zkh52rh785.execute-api.us-east-1.amazonaws.com/v1"
      },
      "models": {
        "claude-v4.5-haiku": {
          "name": "Claude 4.5 Haiku"
        },
        "claude-v4.6-opus": {
          "name": "Claude 4.6 Opus"
        },
        "claude-v4.6-sonnet": {
          "name": "Claude 4.6 Sonnet"
        },
        "amazon-nova-pro": {
          "name": "Amazon Nova Pro"
        },
        "qwen3-32b": {
          "name": "Qwen3 32b"
        }
      }
    }
  }
}

After saving opencode.json, you will need to restart any running OpenCode sessions for the new provider configuration to take effect. Use OpenCode’s /connect to configure the new provider with the API you key received from the UCSB AI Commons dashboard.