Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opencode-devin-provider

Use Devin as an OpenCode chat provider through the Codeium/Windsurf Cascade Connect protocol.

This plugin replicates the approach pioneered by oh-my-pi: it speaks Devin's internal protobuf + Connect streaming protocol directly, giving you first-class access to Devin's models (SWE-1, GPT-5.6 Sol/Luna/Terra, etc.) with streaming text, thinking/reasoning, and tool-call support — all from within OpenCode.

How it works

OpenCode chat message
    ↓
Devin CLI session token (from /connect or DEVIN_API_KEY)
    ↓
Normalize to devin-session-token$<token>
    ↓
Codeium/Windsurf GetUserJwt RPC
    ↓
Build protobuf Cascade request (chat history + tools + system prompt)
    ↓
POST Connect stream to server.codeium.com
    ↓
Decode thinking/text/tool-call protobuf deltas
    ↓
Translate into Vercel AI SDK stream parts
    ↓
OpenCode executes tools locally and sends results next turn

Devin supplies the model access and inference backend. OpenCode supplies the coding-agent loop, filesystem tools, shell execution, session handling, and UI.

Features

  • Real streaming via Connect protocol (not poll-based like the v3 REST API)
  • Thinking/reasoning support — reasoning deltas are streamed as text
  • Tool calls — Devin proposes tool calls, OpenCode executes them locally
  • Dynamic model discovery — calls GetCliModelConfigs to find account-specific models
  • Conversation threading — reuses Cascade conversation IDs across turns
  • PKCE OAuth support — helper functions for the Devin CLI OAuth flow

Prerequisites

  • A Devin account (any tier that includes CLI access).
  • A Devin CLI session token. Get one by running devin login in a terminal, or through the OAuth flow.

Installation

Add the plugin to your opencode.json:

{
  "plugin": ["opencode-devin-provider"]
}

Then run OpenCode and use /connect to authenticate with Devin. The plugin will prompt for your Devin CLI session token.

Alternatively, set an environment variable:

export DEVIN_API_KEY="your-devin-cli-token"

Or configure the provider manually:

{
  "plugin": ["opencode-devin-provider"],
  "provider": {
    "devin": {
      "options": {
        "apiKey": "your-devin-cli-token"
      }
    }
  }
}

Selecting a model

Pick a Devin model with /models or set it in config:

{
  "model": "devin/swe-1-6"
}

Available models are discovered dynamically from your account. If discovery fails, fallback models (SWE-1-6, GPT-5.6 Sol/Luna/Terra) are provided.

Architecture

Connect protocol

The provider serializes requests as protobuf, gzips them, and frames them with the Connect streaming envelope (1-byte flag + 4-byte big-endian length + payload). Responses are decoded frame-by-frame, with support for:

  • Gzip-compressed frames (flag 0x01)
  • End-of-stream JSON trailers (flag 0x02)
  • 16 MiB frame size cap (defensive against corrupt length prefixes)

Protobuf

The .proto files from Codeium/Windsurf's internal protocol are included in src/devin-gen/, with TypeScript schemas generated by protoc-gen-es (via @bufbuild/protobuf). Only the transitive subset needed by the chat flow is used at runtime.

Model discovery

When credentials are available, the plugin calls GetCliModelConfigs against the Codeium server to discover account-specific models. Each returned model configuration is normalized into OpenCode's model format with capabilities, limits, and reasoning detection.

Reasoning detection

The discovery endpoint doesn't always expose clean thinking metadata, so reasoning support is detected using:

  • modelFeatures.supportsThinking
  • Labels containing terms like "thinking", "high", "medium", "xhigh", "max", or "reasoning"
  • A "no thinking" exclusion pattern

Development

bun install
bun test
bun run lint
bun build src/index.ts src/devin.ts --outdir dist --target node --format esm

Credits

This project replicates the Devin integration approach from oh-my-pi by @can1357. The protobuf definitions and Connect protocol implementation are derived from that work.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages