opencode-cursor is the OpenCode plugin for running Cursor models — Claude, GPT, Gemini, Grok, Composer, and Cursor Auto — with thinking, effort variants, streaming, and tool calls that finish.
Use the models on your Cursor subscription from OpenCode and OpenChamber without a cursor-agent binary or an API key. The plugin authenticates in the browser, discovers the live catalog, and proxies the Cursor API over HTTP/2.
opencode auth login --provider cursor opens a PKCE browser flow. Tokens land in ~/.local/share/opencode/auth.json and refresh automatically. In OpenChamber, if no OAuth button appears, the plugin still prints a login URL — open it, then reload.
The plugin discovers Cursor’s catalog for your subscription, including Thinking, Fast, 1M context, and effort levels, and maps them to OpenCode-native choices.
Streaming, tool calls, and parked bridges are tuned for OpenCode agent turns. Reasoning gets time to think; silent post-tool hangs recover in about 90 seconds instead of stalling for minutes.
No cursor-agent install and no SDK child process. OpenCode talks to a local OpenAI-compatible proxy, which talks to Cursor over a persistent HTTP/2 bridge.
npm install -g @openchamber/opencode-cursorAdd (or merge) this into ~/.config/opencode/opencode.json:
opencode auth login --provider cursorA browser window opens. Approve access. You do not need a Cursor API key.
opencode run "Summarise this repository in five bullets." --model cursor/defaultIn the TUI, pick provider cursor, then a model (including Thinking / Fast / effort variants when Cursor exposes them).
git clone https://github.com/openchamber/opencode-cursor.git
cd opencode-cursor
bun install && bun run build
npm install -g .| Step | What happens |
|---|---|
opencode auth login --provider cursor |
Starts PKCE browser OAuth |
| You approve in the browser | Cursor returns access + refresh tokens |
| Plugin stores credentials | ~/.local/share/opencode/auth.json |
| Access expires | Plugin refreshes silently; permanent 4xx → re-login |
Browser OAuth is the only supported path. You do not need a Cursor API key.
OpenCode
└─ /v1/chat/completions
└─ Local OpenAI-compatible proxy
└─ Node HTTP/2 bridge
└─ Cursor API (api2.cursor.sh)
| Layer | Responsibility |
|---|---|
| Plugin hooks | OAuth, provider config, model catalog, selection headers |
| Proxy | OpenAI ↔ Cursor protocol, tool loops, stalls, checkpoints |
| Transport | Persistent / one-shot HTTP/2 bridges to Cursor |
Model listings map Cursor’s variant catalog into OpenCode-native choices (Opus 4.8, Opus 4.8 Thinking, effort low→max, Fast, …). Selection is encoded so Cursor receives the exact RequestedModel parameters your account supports.
- OpenCode
- Active Cursor subscription
- Bun (plugin runtime) · Node.js ≥ 18 (HTTP/2 bridge)
bun install
bun run build
bun run testOptional knobs: OPENCODE_CURSOR_PRE_OUTPUT_STALL_TIMEOUT_MS, OPENCODE_CURSOR_POST_TOOL_PRE_OUTPUT_STALL_TIMEOUT_MS, OPENCODE_CURSOR_TOOL_DEBOUNCE_MS.
Debug logs: OPENCODE_CURSOR_DEBUG=1.
| Symptom | Fix |
|---|---|
| Cursor missing from provider list | Confirm plugin includes @openchamber/opencode-cursor and restart OpenCode |
| "sign in required" / login URL in model name | Open the printed URL, approve OAuth, reload |
| Refresh rejected / re-login required | Run opencode auth login --provider cursor again |
| Model not found | Wait for live discovery after login; avoid relying on stale offline catalogs |
| Tool loop restates forever | Update to the latest plugin — post-tool resume and phase-aware stalls are required |
Issues and pull requests belong in this repository: openchamber/opencode-cursor.
bun install
bun run build
bun run testThis plugin started as community work around Cursor access in OpenCode. Special thanks to:
- OpenCode for the plugin API
- OpenChamber for the workspace that runs this plugin in production
- Contributors who shaped OAuth, model discovery, and the HTTP/2 proxy
{ "$schema": "https://opencode.ai/config.json", "plugin": ["@openchamber/opencode-cursor"], "provider": { "cursor": { "name": "Cursor" } } }