Cursor models inside OpenCode — browser OAuth, live catalog discovery,
and a local OpenAI-compatible proxy tuned for agent loops.
Quick start · Authenticate · Why this plugin · Architecture · Troubleshooting · Changelog
Use every model on your Cursor subscription from OpenCode: Claude, GPT, Gemini, Grok, Composer, and Cursor Auto — with thinking, effort variants, streaming, and tool calls that actually finish.
No cursor-agent binary. No SDK child-process gymnastics. Direct Cursor API over HTTP/2.
1. Install the plugin
npm install -g @otto-assistant/opencode-cursor-oauth2. Register it in OpenCode
Add (or merge) this into ~/.config/opencode/opencode.json:
3. Sign in with Cursor (browser OAuth — not an API key)
opencode auth login --provider cursorA browser window opens. Approve access. Tokens land in ~/.local/share/opencode/auth.json and refresh automatically.
4. Use a Cursor model
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/otto-assistant/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 |
If you use OpenChamber and never see an OAuth button, the plugin still prints a login URL and embeds it in the placeholder model name — open that URL, then reload.
You do not need a Cursor API key. Browser OAuth is the only supported path.
| Direct API | Talks to Cursor over HTTP/2. No cursor-agent install, no brittle CLI wrapper. |
| Native OAuth | opencode auth login — PKCE browser flow with automatic token refresh. |
| Live models | Discovers your account's catalog, including Thinking, Fast, 1M context, and effort levels. |
| Agent-grade streaming | Tool calls continue correctly; parked bridges resume with results instead of restating forever. |
| Phase-aware stalls | Reasoning gets time to think; silent post-tool hangs recover in ~90s, not minutes. |
| Measured speed | v2.2: first message −39% to −44% TTFB vs prior release (cold start + H2 pre-connect). |
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 for the proxy so Cursor receives the exact RequestedModel parameters your account supports.
From the v2.2.0 release:
| Scenario | Before | After |
|---|---|---|
First message, gpt-5.4-nano |
8.5s | 4.8s |
First message, cursor/default |
6.1s | 3.7s |
| Post-tool silent stall budget | 180s | 90s |
Knobs (optional): 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.
- OpenCode
- Active Cursor subscription
- Bun (plugin runtime) · Node.js ≥ 18 (HTTP/2 bridge)
bun install
bun run build
bun run test| Symptom | Fix |
|---|---|
| Cursor missing from provider list | Confirm plugin includes @otto-assistant/opencode-cursor-oauth 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 latest plugin — post-tool resume + phase-aware stalls are required |
Do I need to clone the repo?
No. Configure the npm package in opencode.json and OpenCode installs it.
Is this the same as cursor-agent bridges?
No. This plugin authenticates with Cursor OAuth and proxies the Cursor API directly. You do not need the cursor-agent CLI.
Where are releases?
GitHub Releases · npm · Changelog
{ "$schema": "https://opencode.ai/config.json", "plugin": ["@otto-assistant/opencode-cursor-oauth"], "provider": { "cursor": { "name": "Cursor" } } }