Skip to content

OpenCode

OpenCode is a self-hosted AI coding agent. You run the OpenCode server on your own infrastructure; beeps connects to it over HTTP, creates a session per alert, and sends a prompt. OpenCode produces a file diff (it does not open a PR by itself).

  • A running OpenCode server reachable from beeps. See the OpenCode server docs for installation.
  • HTTP Basic auth credentials for the server.
  • The server’s URL.
  1. Install and run OpenCode following opencode.ai/docs/server.
  2. Configure HTTP Basic auth on your server. The password becomes apiKey in beeps; the username goes in metadata (default opencode).
  3. Note the server URL. You’ll pass it on the relay rule as endpoint.

Create the integration with the basic-auth password as apiKey:

const openCodeIntegration = await client.integration.create({
name: "OpenCode - internal",
provider: "opencode",
apiKey: process.env.OPENCODE_SERVER_PASSWORD,
metadata: {
username: "opencode",
},
});

Reference it from a relay rule. OpenCode needs an endpoint pointing at your server. The optional openCodeModel lets you pick which model the session runs:

await client.relay.rules.create(relayId, {
name: "OpenCode investigation",
ruleType: "agent",
config: {
agentType: "opencode",
integrationId: openCodeIntegration.id,
endpoint: "https://opencode.internal.corp:4096",
openCodeModel: {
providerID: "anthropic",
modelID: "claude-sonnet-4-20250514",
},
pollInterval: 15000,
maxPollAttempts: 200,
},
});
Field Type Required Default Description
username string no opencode HTTP Basic auth username
Field Type Required Default Description
agentType "opencode" yes Selects the OpenCode agent
integrationId string yes The OpenCode integration’s id
endpoint string (URL) yes Base URL of the OpenCode server
openCodeModel.providerID string no server default Provider id, e.g. anthropic
openCodeModel.modelID string no server default Model id, e.g. claude-sonnet-4-20250514

The shared polling and storm-control fields are documented in Relay Rules.

401 Unauthorized on session creation. Beeps sends Authorization: Basic <base64(username:apiKey)>. Confirm both the username (in metadata) and password (apiKey) match the server’s basic-auth config (OPENCODE_SERVER_USERNAME / OPENCODE_SERVER_PASSWORD).

Polling fails with 404 on /session/status. Beeps tracks completion through OpenCode’s GET /session/status endpoint. Upgrade your OpenCode server to a version that provides it.

Session completes but no PR is created. OpenCode produces a file diff, not a PR. Check the session’s diff endpoint on your server, or wire your own commit/PR step downstream.