Running OpenCode

Providers

stereOS runs OpenCode as a normal install inside the VM, so any provider that OpenCode supports works out of the box. You are not limited to Anthropic API keys.

Supported options include:

  • Anthropic — pass your API key via the jcard
  • OpenAI — pass your API key via the jcard
  • GitHub Copilot (OAuth) — run opencode auth inside the VM to authenticate interactively
  • Ollama — run a local Ollama instance and point OpenCode at it
  • Any OpenAI-compatible endpoint — set the base URL in your OpenCode config

The jcard [agent.env] section is a convenience for injecting API keys. If your provider uses OAuth or a locally running model, you can omit it entirely and configure OpenCode directly inside the VM.

jcard.toml

With an API key

mixtape = "opencode-mixtape:latest"

[[agents]]
harness = "opencode"
prompt = "Analyze the project structure and write missing unit tests."
workdir = "/workspace"
restart = "on-failure"
max_restarts = 3

[agents.env]
ANTHROPIC_API_KEY = "${ANTHROPIC_API_KEY}"

Export your API key on the host before booting:

export ANTHROPIC_API_KEY="sk-ant-..."

For OpenAI, swap in OPENAI_API_KEY instead.

Without an API key (OAuth, Ollama, etc.)

If you are using GitHub Copilot OAuth or a local model, you don’t need to pass an API key through the jcard:

mixtape = "opencode-mixtape:latest"

[agent]
harness = "opencode"
workdir = "/workspace"

After booting, attach to the tmux session and configure your provider directly (e.g., opencode auth for Copilot).

Boot

The VM name defaults to your current folder name. For example, if your jcard.toml is in ~/projects/my-app/, the VM will be named my-app.

mb up
mb ssh my-app

You can check for the session with tmux:

sudo -u agent -- tmux -S /run/agentd/tmux.sock ls

The agent starts automatically in a tmux session. Attach to it:

sudo -u agent -- tmux -S /run/agentd/tmux.sock a

Detach without stopping: Ctrl-b then d.

Interactive mode

Omit prompt for an interactive OpenCode session:

mixtape = "opencode-mixtape:latest"

[[agents]]
harness = "opencode"
workdir = "/workspace"

Clean up

mb down my-app && mb destroy my-app