Skip to main content
Replicas supports Opencode as a first-class coding agent alongside Claude Code, Codex, and Cursor. Opencode chats run inside your workspace VM through OpenRouter, with the same repository access and integrations as other agents.

Setup

Opencode uses an OpenRouter API key. There is no OAuth flow like Claude Code or Codex.
  1. Create an API key from the OpenRouter keys page.
  2. Paste the key in Coding Agents settings during onboarding or anytime later.
  3. Set org-level credentials for the whole team, or add a personal key in User settings that takes priority over org defaults.
See Credentials for scope details and auth behavior.
OpenRouter usage bills to the OpenRouter account that owns the key.

Models

Opencode uses OpenRouter model slugs in the workspace model picker and through the API:
Model IDLabelNotes
z-ai/glm-5.2GLM 5.2Default
minimax/minimax-m3MiniMax M3Long-context agentic coding
xiaomi/mimo-v2.5-proMiMo V2.5 ProAgent-focused Xiaomi model
moonshotai/kimi-k2.6:freeKimi K2.6Multimodal coding model
Set the default model under Settings > Defaults or per-user in Account settings. Each workspace remembers the model used on its Opencode chat tab. Thinking levels use Opencode’s native model variants when the selected model exposes a matching variant. Models without a matching variant use Opencode’s model default.

Using Opencode in Workspaces

Every workspace can have multiple chats, one per agent. Open the Opencode chat tab to start or continue an Opencode session. Opencode agents can:
  • Read and edit files in the cloned repository
  • Run shell commands in the workspace VM
  • Use environment MCP servers
  • Create branches, commits, and pull requests
  • Use Plan Mode to propose a plan before changing code
  • Load repository skills when the runtime can discover them
Replicas pre-approves Opencode tool permissions inside disposable workspace VMs, so these actions do not pause for per-command approval. Opencode does not support Fast Mode or Codex goal mode (/goal).

Plan Mode

Start a message with /plan or toggle plan mode in the composer. Opencode runs in plan mode and returns a structured plan you can review in the Canvas panel before asking it to implement.

Chat history

Opencode chat history persists across turns and survives workspace sleep. Use replicas read from the CLI to inspect transcript history from your terminal.

Programmatic Use

Select Opencode anywhere Replicas accepts a coding agent:
SurfaceHow to choose Opencode
CLI-a opencode on replicas create and replicas send
API"coding_agent": "opencode" on create and message requests
MCP"coding_agent": "opencode" on create_replica and send_replica_message
AutomationsSet Coding agent to Opencode in the automation editor
Slack, Linear, GitHub, GitLabSet Opencode as the default coding agent
Example CLI:
replicas create fix-tests \
  -e backend \
  -a opencode \
  -m "Fix the failing test suite"
Example API:
curl -X POST "https://api.tryreplicas.com/v1/replica" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "fix-tests",
    "environment_id": "ENVIRONMENT_UUID",
    "message": "Fix the failing test suite",
    "coding_agent": "opencode",
    "model": "z-ai/glm-5.2"
  }'

When to Use Opencode

Opencode is a strong fit when:
  • You want OpenRouter-backed model routing inside Replicas workspaces
  • You want to compare GLM 5.2, MiniMax M3, MiMo V2.5 Pro, and Kimi K2.6 on the same repository
  • You prefer API-key auth over OAuth for automated or shared workflows
  • You want a non-Claude, non-OpenAI model family for implementation and iteration
Claude Code, Codex, and Cursor remain better choices when you need provider-specific features like Claude background tasks, Codex goal mode, Cursor Composer, or Fast Mode.