Skip to main content
OpenCode is an open-source terminal coding agent. Run it in a Superserve sandbox so its shell commands and file edits stay isolated from your machine.

Via the console

  1. On the Secrets page, create a secret with the Anthropic provider and paste your API key — you only do this once, and the key never enters the sandbox.
  2. Go to console.superserve.ai and click Create sandbox.
  3. Pick the superserve/node-22 template.
  4. Under Advanced Options → Secrets, bind that secret to ANTHROPIC_API_KEY.
  5. Create the sandbox, open its Terminal, and run:

Via the SDK

OpenCode reads ANTHROPIC_API_KEY as usual, but its value is a stand-in token — the real key is attached only on requests to Anthropic, never exposed to the agent. Open the sandbox in the console, launch the terminal, and run opencode.

Persist sessions

Delete when finished

A paused sandbox is kept until you delete it. When you no longer need the sandbox, delete it. This also deletes its files and saved state.
To delete it from another process, pass its ID to Sandbox.killById() (TypeScript) or Sandbox.kill_by_id() (Python). To delete paused sandboxes automatically, see Auto-delete.

Run workspaces in sandboxes

OpenCode workspaces run a session in another environment while you keep using OpenCode on your machine. Add a workspace plugin that gives each workspace its own Superserve sandbox. The agent’s shell commands, file edits, and model calls then run in the sandbox, and the sessions still show in your local OpenCode.
Workspaces are experimental in OpenCode. Set OPENCODE_EXPERIMENTAL_WORKSPACES=true to turn them on.
The plugin binds the anthropic-key secret from Via the SDK, so the sandbox gets a stand-in token and never your real key.
  1. Add the Superserve SDK to ~/.config/opencode/package.json. OpenCode installs it when it starts.
  2. Save the plugin as ~/.config/opencode/plugins/superserve.ts. Keep it in your global config, so the copy of the project in the sandbox does not load it.
  3. In a git project, start OpenCode with workspaces turned on:
  4. Run /warp and select Superserve under New workspace. Your next prompt runs in the new sandbox. Run /workspaces to see or delete workspaces. Deleting a workspace deletes its sandbox.
To create workspaces from code, start the server with OPENCODE_EXPERIMENTAL_WORKSPACES=true opencode serve in the project. Then install a client and call the server API:
Keep these points in mind:
  • The plugin copies the committed files of your current branch into the sandbox, at the same path as on your machine. Commit your changes before you create a workspace. Run OpenCode on macOS or Linux, because the sandbox uses Linux paths.
  • Edits in a workspace stay in its sandbox. Your local files do not change.
  • The OpenCode server in the sandbox listens on a private preview port. The plugin sends the preview token with each request.
  • Keep the sandbox running while you use the workspace. Requests through the preview URL do not resume a paused sandbox, so the workspace disconnects. Resume the sandbox, for example with Sandbox.connect(), then restart OpenCode to reconnect.