Skip to content

Connect OpenCode

OpenCode may have several model providers. CMX routes the one you select. Sign in through OpenCode and choose a model there first:

Terminal window
opencode auth login
cmx setup --ask-connect-ready
cmx providers opencode list

The list shows provider IDs, credential readiness, and whether each route is native or connected to CMX. Listing is read only. Connect one of the IDs shown:

Terminal window
cmx providers opencode connect <provider-id>

For example, the ID might be opencode, opencode-go, or a provider you configured in OpenCode. Some custom providers need a direct HTTPS endpoint in OpenCode before CMX can connect them. CMX preserves native options and authentication while adding its local route. It supports OpenCode JSON and JSONC configuration and the OPENCODE_CONFIG override.

Restart OpenCode, send a request, then check cmx stats and cmx harness verify.

Terminal window
cmx providers opencode disconnect <provider-id>

This restores that provider’s native route and retains unrelated OpenCode edits made while routed. To remove all CMX routing from OpenCode, use cmx harness disable opencode. Restart OpenCode afterward. If restoration reports a conflict, keep CMX installed and follow Troubleshooting; do not delete its backup files manually.