5
近 30 天 +2
2,087
近 7 天 2.1k
50.0
生态多维模型
46 分钟前
2026-10-05
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@magpie-community/opencode-cursor-auth@0.1.9"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@magpie-community/opencode-cursor-auth@0.1.9"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @magpie-community/opencode-cursor-authOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCode provider plugins for coding-plan subscriptions, maintained by the community. Each package signs in to one subscription and makes its requests. The packages work in OpenCode and in magpie, which runs OpenCode's provider plugins.
| Package | Signs in to | Provider id |
|---|---|---|
| cline | Cline (cline.bot): usage-billed models, ClinePass's and Cline's free ones, with Cline's device sign-in or an API key | cline |
| commandcode | Command Code plans (Pro, GOAT, Max, Ultra, Go, Teams Pro) | commandcode-plan |
| cursor | Cursor subscriptions (Pro, Pro+, Ultra, Teams), on the API cursor-agent talks to | cursor |
| devin | Devin subscription (the devin CLI's account) | devin |
| factory | Factory (Droid) subscription | factory |
| grok | Grok (SuperGrok / X Premium+), through the Grok Build CLI's sign-in | grok |
| kiro | Kiro (Free, Pro, Pro+, Power), with Kiro's sign-in, kiro-cli's or the IDE's, or an API key | kiro |
| minimax | MiniMax Code (China): account credits and M Plan, with MiniMax Code's device sign-in | minimax-code |
| minimax | MiniMax Code (international): account credits and M Plan, with MiniMax Code's device sign-in | minimax-code-global |
| mimo | Xiaomi MiMo, with a Xiaomi account | mimo-app |
| qoder | Qoder subscription (qoder.com), with Qoder's device sign-in | qoder |
| qoder | Qoder CN subscription (qoder.cn), with Qoder CN's device sign-in | qoder-cn |
| trae | Trae CN (trae.cn) and Trae international (trae.ai), free tier included, with Trae's browser sign-in (experimental) | trae-cn, trae-global |
| workbuddy | WorkBuddy (China build, CodeBuddy plan) | workbuddy |
| workbuddy | WorkBuddy (international build) | workbuddy-ai |
| zcode | ZCode: Z.ai / BigModel (智谱) GLM Coding Plan, team seats, Start Plan | zcode |
| zed | Zed (Pro, Pro Trial, Student, Business): Anthropic, OpenAI, Google and xAI models hosted by Zed | zed |
Use
magpie:
magpie plugin add @magpie-community/opencode-<name>-auth
magpie plugin login <provider id>
In the app, the Plugins tab lists these packages: install one there, then sign in.
OpenCode, in opencode.json:
{ "plugin": ["@magpie-community/opencode-<name>-auth"] }
then opencode auth login.
Writing a package
Each package is a folder under packages/<name>/:
package.json- name:
@magpie-community/opencode-<name>-auth "type": "module","main": "./index.mjs"- version,
"license": "MIT" - no runtime dependencies unless one is really needed. Bun's and Node's
fetch,cryptoandfsusually cover it.
- name:
index.mjs- Exports one async plugin function, as OpenCode's
Plugintype describes. - Returns an
authhook:{ provider, loader, methods }.- A browser sign-in is
{ type: "oauth", label, prompts?, authorize }.authorizereturns{ url, instructions, method: "auto" | "code", callback }. - A key is
{ type: "api", label }. loader(getAuth, provider)returns what the AI SDK is given:baseURL,apiKey,headersand afetchthat signs each request and refreshes the token (saving it withclient.auth.set).
- A browser sign-in is
- A provider that models.dev doesn't list is declared in a
confighook that setsconfig.provider[<id>] = { name, npm, api, models }. The npm field names the AI SDK package the models speak:@ai-sdk/openai-compatible(chat completions),@ai-sdk/openai(Responses) or@ai-sdk/anthropic(Messages). - A list the account decides goes in the
provider: { id, models(provider, { auth }) }hook.
- Exports one async plugin function, as OpenCode's
README.md: what the package signs in to, how, where the sign-in is kept, and the models.
The provider id is the one magpie's built-in subscription has (grok,
zcode, workbuddy, commandcode-plan, …). While magpie still has the
built-in, the plugin's provider shows as <id>-plugin. Once the built-in
is gone, it takes over the same id, so an agent set to <id>/<model> keeps
working.
Checking a package
bun scripts/check.mjs [<name>] # loads each plugin and checks its hooks; signs in to nothing
MAGPIE=/path/to/magpie scripts/try.sh <name> [login <id> | provider test <id>-plugin]
try.sh runs magpie in a sandbox HOME (.sandbox/<name>), so your own
magpie, agents and sign-ins are left alone.
License
MIT
The market
registry.json is the list magpie's Plugins tab shows. The packages here
come first, then other OpenCode provider plugins worth knowing. magpie
fetches it every few hours and keeps a copy built into the app for when
it can't. To list a plugin, add an entry with its npm package, a
name, providers (the provider ids it signs in to), an icon and a
summary in English and Chinese ({"en": …, "zh": …}), and open a pull
request.
同类生态推荐
Cursor
@openchamber/opencode-cursor
Cursor models in OpenCode — native OAuth, live catalog discovery, agent-grade streaming. Direct API, no cursor-agent binary.
Herdr
opencode-herdr
Route OpenCode agents through Herdr panes as herdr/<adapter>/<model> (Cursor, Claude, Codex, OpenCode)
Cursor To Opencode
@0ct0s3c/cursor-to-opencode
Use Cursor .cursor/rules in OpenCode with dynamic rule injection, diagnostics, and stats.