在opencode中使用cursor的API

使用的操作系统为 Windows 11

  1. 先在opencode官网( https://opencode.ai/ )安装CLI版:
npm i -g opencode-ai
  1. 安装完成后修改文件C:\Users\zhengjinpeng\.config\opencode\opencode.json,增加cursor插件
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["cursor-opencode-provider"],
  "provider": {
    "cursor": {
      "npm": "cursor-opencode-provider",
      "name": "Cursor",
      "models": {}
    }
  }
}
  1. 打开cmd,输入opencode auth login --provider cursor

然后会提供两种鉴权方式:1. 手动点击连接跳转登录;2. 输入key

然后就能在opencode中使用了:

screenshot-20260728-155901

如果cursor的API额度用完,输入/model,可以选择auto

posted @ 2026-07-28 15:59  3039442  阅读(23)  评论(0)    收藏  举报