Setting up OpenCode on DCC
OpenCode is an open-source AI coding agent that can be run on a terminal. It can read, change, and run code and assist with agentic AI tasks. Unlike other coding agents like Claude or Codex, OpenCode allows connecting to any free or paid models from multiple providers (including Anthropic and OpenAI) in addition to its included free models.
OpenCode can be used on DCC, either through a SSH terminal or an Open OnDemand Jupyter/RStudio container terminal.
Once you are connected to DCC, enter the following commands on the terminal to set up OpenCode,
Then, you can launch opencode with the command,
and follow the instructions to get started.
Duke's AI Gateway provides access to OpenAI models to Duke users freely or through a fund-code. To add OpenAI models to OpenCode, run /connect in the prompt and select "OpenAI" as the provider. Next, select "ChatGPT Pro/Plus (headless)" as the authentication method and follow instructions to complete the process.
You may then select models through the /model command in the prompt.
Important!
If you will be using opencode to perform computationally intensive tasks, first request an interactive session on DCC and run it on that.