opencode-cursor-auth
v1.0.16
Published
Authentication provider for Cursor, extracting credentials from local environment or agent.
Readme
opencode-cursor-auth
Cursor authentication + local Cursor Agent backend for OpenCode.
This plugin lets you use cursor-agent as an OpenAI-compatible provider inside OpenCode (no Cursor IDE required).
Requirements
cursor-agentinstalled (curl -fsSL https://cursor.com/install | bash)- Logged in once (the plugin can trigger
cursor-agent login)
Install
Add the plugin to your OpenCode config (~/.config/opencode/opencode.json):
{
"plugin": [
"[email protected]",
"opencode-gemini-auth",
"[email protected]"
],
"provider": {
"cursor": {
"npm": "@ai-sdk/openai-compatible",
"name": "Cursor Agent (local)",
"options": {
"baseURL": "http://127.0.0.1:32123/v1"
},
"models": {
"auto": { "name": "Cursor Agent Auto" },
"gpt-5": { "name": "Cursor Agent GPT-5 (alias → gpt-5.2)" },
"gpt-5.2": { "name": "Cursor Agent GPT-5.2" },
"gpt-5.1": { "name": "Cursor Agent GPT-5.1" },
"gpt-5.1-codex": { "name": "Cursor Agent GPT-5.1 Codex" },
"sonnet-4": { "name": "Cursor Agent Sonnet 4 (alias → sonnet-4.5)" },
"sonnet-4.5": { "name": "Cursor Agent Sonnet 4.5" },
"sonnet-4.5-thinking": { "name": "Cursor Agent Sonnet 4.5 Thinking" }
}
}
}
}Login
opencode auth login- Select provider:
Other - Provider id:
cursor - Method:
Login via cursor-agent (opens browser)
Run
opencode run "decime hola" --model cursor/gpt-5
opencode run "decime hola" --model cursor/gpt-5.2How It Works
- On startup, the plugin starts a local HTTP proxy on
127.0.0.1:32123. - OpenCode uses
@ai-sdk/openai-compatibleagainsthttp://127.0.0.1:32123/v1. - The proxy translates
/v1/chat/completionsinto acursor-agentCLI call.
Current Limitations
This integration is intentionally minimal and works well for plain chat/completions, but it does not currently provide:
- OpenCode tool-calling (LSP/TODO/tools):
cursor-agentis a CLI agent and does not speak OpenAI tool-calls, so OpenCode can’t route tool calls. - Token usage / cost accounting:
cursor-agentdoes not expose token counts per request in a way OpenCode can consume. - “Thinking” UI sections: we only stream assistant text; there’s no separate reasoning payload.
Troubleshooting
Unauthorized: cursor-agent failed.: your model name is not supported by yourcursor-agent. Trycursor/gpt-5.2orcursor/auto.Unable to connect: anotheropencodeinstance might not have the proxy running, or the port32123is taken by something else. Try closing otheropencodesessions, or change the port in both the plugin andopencode.json.
License
ISC
