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,
},
});
FieldTypeRequiredDefaultDescription
usernamestringnoopencodeHTTP Basic auth username
FieldTypeRequiredDefaultDescription
agentType"opencode"yesSelects the OpenCode agent
integrationIdstringyesThe OpenCode integration’s id
endpointstring (URL)yesBase URL of the OpenCode server
openCodeModel.providerIDstringnoserver defaultProvider id, e.g. anthropic
openCodeModel.modelIDstringnoserver defaultModel 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.

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.