Go to file
王性驊 bef521504e feat: Add debug mode with screenshot and page analysis
Features:
- Wait for user ENTER in visible mode (GEMINI_BROWSER_VISIBLE=true)
- Save screenshot to /tmp/gemini-debug.png
- Save HTML to /tmp/gemini-debug.html
- JavaScript-based element detection
- Multi-strategy wait (A: selectors, B: time, C: JS, D: debug)
- Detailed logging of each strategy attempt
- Page structure dump in debug mode

This helps identify why input field is not found
2026-04-03 01:31:37 +08:00
cmd feat: Add Gemini provider env vars to Makefile and CLI options 2026-04-02 22:53:41 +08:00
internal feat: Add debug mode with screenshot and page analysis 2026-04-03 01:31:37 +08:00
scripts fix: Improve Gemini Web DOM selectors and add debug output 2026-04-03 00:40:57 +08:00
.env.example add docker file and claude flow output 2026-04-01 04:32:17 +00:00
.gitignore add ignore 2026-04-01 22:17:15 +08:00
Dockerfile add docker build 2026-04-01 21:48:17 +08:00
Makefile feat: Add provider display in startup logs and OpenCode gemini-web config 2026-04-03 00:29:22 +08:00
README.md fix readme 2026-04-01 22:18:24 +08:00
detect-gemini-dom fix: Improve Gemini Web DOM selectors and add debug output 2026-04-03 00:40:57 +08:00
docker-compose.yml add docker file and claude flow output 2026-04-01 04:32:17 +00:00
gemini-login feat: Add Gemini provider env vars to Makefile and CLI options 2026-04-02 22:53:41 +08:00
go.mod feat: Switch to playwright-go for better DOM automation 2026-04-03 01:20:42 +08:00
go.sum feat: Switch to playwright-go for better DOM automation 2026-04-03 01:20:42 +08:00
main.go first commit 2026-03-30 14:09:15 +00:00

README.md

Cursor API Proxy

一個代理伺服器,讓你用標準 OpenAI / Anthropic API 存取 Cursor CLI 模型。

可接入:

  • Claude Code
  • OpenCode
  • 任何支援 OpenAI / Anthropic API 的工具

功能

  • API 相容OpenAI / Anthropic
  • 多帳號管理
  • 模型自動對映(轉成 claude-*
  • 支援區網存取0.0.0.0
  • 連線池優化

快速開始(本機)

看幫助

    make help 

安裝依賴

curl https://cursor.com/install -fsS | bash
curl -fsSL https://claude.ai/install.sh | bash

下載與建置

git clone https://code.30cm.net/daniel.w/opencode-cursor-agent.git
cd cursor-api-proxy-go
go build -o cursor-api-proxy .

登入

./cursor-api-proxy login myaccount

啟動

make env PORT=8766 API_KEY=mysecret
make pm2

Claude Code 設定

make claude-settings PORT=8766
make claude-onboarding
claude

OpenCode 設定

編輯:

~/.config/opencode/opencode.json

{
  "provider": {
    "cursor": {
      "options": {
        "baseURL": "http://127.0.0.1:8766/v1"
      }
    }
  }
}

Docker簡化版

make docker-setup
vim .env
make docker-setup

檢查:

curl http://localhost:8766/health

常用指令

make docker-up
make docker-down
make docker-logs
make docker-restart

API

路徑 方法
/v1/chat/completions POST
/v1/messages POST
/v1/models GET
/health GET

環境變數(核心)

變數 預設
CURSOR_BRIDGE_HOST 127.0.0.1
CURSOR_BRIDGE_PORT 8766
CURSOR_BRIDGE_TIMEOUT_MS 3600000

帳號操作

./cursor-api-proxy login myaccount
./cursor-api-proxy accounts
./cursor-api-proxy logout myaccount
./cursor-api-proxy reset-hwid

備註

  • Docker 預設開放區網0.0.0.0
  • 模型自動同步
  • 支援多模型切換