### One-Click Deployment Source: https://github.com/dwgx/windsurfapi/blob/master/README.md Use these commands to clone the repository, run the setup script, and start the application. ```bash git clone https://github.com/dwgx/WindsurfAPI.git cd WindsurfAPI bash setup.sh # 建目录 · 配权限 · 生成 .env node src/index.js ``` -------------------------------- ### Start with PM2 Source: https://github.com/dwgx/windsurfapi/blob/master/docs/index.html Commands to install PM2 and manage the application process. ```bash $ npm install -g pm2 $ pm2 start src/index.js --name devin-api $ pm2 save && pm2 startup ``` -------------------------------- ### Clone and Start Application Source: https://github.com/dwgx/windsurfapi/blob/master/docs/index.html Steps to clone the repository, initialize the environment file, and start the application. ```bash $ git clone https://github.com/dwgx/WindsurfAPI.git $ cd WindsurfAPI $ cp .env.example .env $ node src/index.js # 零依賴,免安裝直接跑 ``` -------------------------------- ### Manual Installation and Configuration Source: https://github.com/dwgx/windsurfapi/blob/master/README.md Manually install the Language Server binary and configure the environment variables for the application. ```bash git clone https://github.com/dwgx/WindsurfAPI.git cd WindsurfAPI # Language Server 二进制 —— 自动检测 Linux/macOS,一键下载 + chmod bash install-ls.sh # 下载链:WindsurfAPI release → 公开 LS mirror # https://github.com/dwgx/windsurf-ls-release/releases/latest/download # → Exafunction/codeium fallback。需要私有镜像或回滚时可设置: # WINDSURFAPI_LS_RELEASE=https://github.com///releases/latest/download bash install-ls.sh # 默认安装路径: # Linux x64: /opt/windsurf/language_server_linux_x64 # Linux arm64: /opt/windsurf/language_server_linux_arm # macOS Apple Silicon: $HOME/.windsurf/language_server_macos_arm # macOS Intel: $HOME/.windsurf/language_server_macos_x64 # 如果想用本地已下好的 binary: # bash install-ls.sh /path/to/language_server_linux_x64 # 或者指定 URL: # bash install-ls.sh --url https://example.com/language_server_linux_x64 # ⚠️ LS binary 版本偏旧 / 想换一个来源? # 默认下载链已接入 dwgx/windsurf-ls-release 公开 mirror。 # 如果 mirror 暂未覆盖你的平台,仍可把 Windsurf 桌面端本体里的 LS binary 拷过来: # # macOS: "$HOME/Library/Application Support/Windsurf/resources/app/extensions/windsurf/bin/language_server_macos_arm" # Linux: "$HOME/.windsurf/bin/language_server_linux_x64" # 或 /opt/Windsurf/resources/app/extensions/windsurf/bin/language_server_linux_x64 # Windows: %APPDATA%\Windsurf\bin\language_server_windows_x64.exe # # # 从本地桌面端装: # bash install-ls.sh /path/to/language_server_linux_x64 # # 注意:换 LS binary 不会改变 /v1/models 的内容。 # 模型目录是代理直连 HTTPS 拉的(GetCascadeModelConfigs / GetCliModelConfigs), # 请求里的 ideVersion 写死在 src/windsurf-api.js,不从 binary 读 —— 所以目录只取决于 # 上游给这个账号授予了什么。看不到某个新模型,是上游还没放给该账号,不是本地文件旧了。 cat > .env << 'EOF' PORT=3003 API_KEY= DEFAULT_MODEL=claude-sonnet-4.6 MAX_TOKENS=8192 LOG_LEVEL=info LS_BINARY_PATH=/opt/windsurf/language_server_linux_x64 LS_DATA_DIR=/opt/windsurf/data LS_PORT=42100 DASHBOARD_PASSWORD= EOF # macOS 本地部署时,使用 install-ls.sh 打印的 LS_BINARY_PATH, # 并把 LS_DATA_DIR 设到用户可写目录,例如 /Users/you/.windsurf/data。 node src/index.js ``` -------------------------------- ### Deploy Windsurf API with PM2 Source: https://github.com/dwgx/windsurfapi/blob/master/README.md Commands to install PM2 and start the Windsurf API service. Use the provided update script instead of restarting PM2 to avoid zombie processes. ```bash npm install -g pm2 pm2 start src/index.js --name windsurf-api pm2 save && pm2 startup ``` -------------------------------- ### Install Node.js 20+ Source: https://github.com/dwgx/windsurfapi/blob/master/docs/index.html Commands to install Node.js 20 on a Debian-based system. ```bash $ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - $ apt install -y nodejs ``` -------------------------------- ### Install LaunchAgent for Auto-start Source: https://github.com/dwgx/windsurfapi/blob/master/deploy/macos/README.md Configure the application to launch automatically upon system startup. ```bash chmod +x install-launchd.sh && ./install-launchd.sh ``` -------------------------------- ### Start WindsurfAPI in Foreground Source: https://github.com/dwgx/windsurfapi/blob/master/deploy/macos/README.md Make the run script executable and start the service in the current terminal session to view logs. ```bash chmod +x run.sh && ./run.sh ``` -------------------------------- ### Start Docker Containers Source: https://github.com/dwgx/windsurfapi/blob/master/docs/index.html Commands to build and run the application using Docker Compose. ```bash $ docker compose up -d --build $ docker compose logs -f ``` -------------------------------- ### Start WindsurfAPI in Background Source: https://github.com/dwgx/windsurfapi/blob/master/deploy/macos/README.md Make the background and stop scripts executable, then start the service to persist after closing the terminal. ```bash chmod +x run-background.sh stop.sh && ./run-background.sh ``` -------------------------------- ### Build WindsurfAPI for Apple Silicon Source: https://github.com/dwgx/windsurfapi/blob/master/deploy/macos/README.md Install build dependencies and generate the executable for Apple Silicon architectures. ```bash npm i --no-save esbuild@0.28.1 @yao-pkg/pkg@6.21.0 # 仅构建期依赖,运行时仍是零依赖 npm run build:exe:macos # → dist-macos/windsurfapi-macos-arm64 npm run smoke:exe # 启动自检:/health + /dashboard 必须都 200 ``` -------------------------------- ### Initialize Git Tree Visualization Source: https://github.com/dwgx/windsurfapi/blob/master/docs/HISTORY-LEDGER-VIZ.html Setup for the Git tree rendering engine, including contributor ID mappings. ```javascript /* ============ Git 树渲染 v3:三模板(竖/横/环)+ 头像 + 无重叠 ============ */ (() => { const svg = svgEl('tree'); if (!svg) return; const G = D_GIT; const NS = 'http://www.w3.org/2000/svg'; const LOGIN_ID = {"warelik": 54947489, "wangergou777": 142420084, "andya1lan": 58987282, "Await-d": 58165861, "Fermiz": 13313378, "Kloping": 87743020, "MatrixNeoKozak": 261791209, "RogueBinary": 46707130, "The-five-stooges": 18204304, "UntaDotMy": 42847931, "Yuuqq": 131548122, "abwuge": 81455573, "aict666": 253870639, "baily-zhang": 8436110, "brandonedley": 1334816, "chukangkang": 51869547, "clarezoe": 460084, "colin1112a": 218527967, "datfooldive": 110718021, "dd373156": 106299115, "dwgx": 143298346, "forrinzhao": 201411890, "kevin5251984": 159868618, "lauvww": 155606367, "limweb": 602579, "linqichenggg": 100070330, "lovivi": 18547278, "moduvoice": 291867022, "motto1": 116414193, "sandleft": 60204370, "smeinecke": 7316652, "suhaihui-git": 57882092, "ucloudnb666": 274767034, "wjurkowlaniec": 1134323, "youfak": 27138744}; const AUTHOR_LOGIN = {"dwgx": "dwgx", "W ARELIK": "warelik", "warelik": "warelik", "Baily": "baily-zhang", "Stefan Meinecke": "smeinecke", "AI CT": "aict666", "aict666": "aict666", "abwuge": "abwuge", "li shuangqi": "Fermiz", "Fermiz": "Fermiz", "kosonen": "clarezoe", "clarezoe": "clarezoe", "hikki": "datfooldive", "linqicheng": "linqichenggg", "lauvww": "lauvww", "ucloudnb666": "ucloudnb666", "you922": "you922", "Song Jie": "lovivi", "lovivi": "lovivi", "The-five-stooges": "The-five-stooges", "andya1lan": "andya1lan", "wangergou777": "wangergou777", "brandonedley": "brandonedley", ``` -------------------------------- ### Verify Partition Mode Server Logs Source: https://github.com/dwgx/windsurfapi/blob/master/docs/releases/RELEASE_NOTES_2.0.69.md Example output from the end-to-end probe script confirming native bridge activation and tool mapping. ```text Probe[3y8bnr]: model=gpt-5.5-xhigh stream=true tools=11 reasoning=xhigh Chat[3y8bnr]: native bridge ON — model=gpt-5.5-xhigh mapped=[shell_command] unmapped=[apply_patch,update_plan,request_user_input,web_search, view_image,spawn_agent,send_input,resume_agent, wait_agent,close_agent] allowlist=run_command additional_steps=0 ``` -------------------------------- ### Docker Deployment Source: https://github.com/dwgx/windsurfapi/blob/master/README.md Deploy the service using Docker Compose. Ensure the .env file is configured before starting. ```bash cp .env.example .env # 可选:提前把 language_server_linux_x64 放到 .docker-data/opt/windsurf/ 下 # 不放也行,容器首次启动时会自动下载到 /opt/windsurf/ docker compose up -d --build docker compose logs -f ``` -------------------------------- ### Hero Terminal Typing Animation Source: https://github.com/dwgx/windsurfapi/blob/master/docs/index.html Simulates a live terminal typing effect for the quickstart guide. Uses IntersectionObserver to trigger the animation when the element enters the viewport. ```javascript (function(){ var body = document.getElementById('hero-term-body'); if (!body) return; // The transcript. Each line is pre-tokenized into {t:class, s:text} spans. var LINES = [ [{t:'prompt',s:'$ '},{t:'cmd',s:'git clone'},{t:'str',s:' https://github.com/dwgx/WindsurfAPI'}], [{t:'prompt',s:'$ '},{t:'cmd',s:'cd'},{t:'plain',s:' WindsurfAPI && '},{t:'cmd',s:'node'},{t:'plain',s:' src/index.js'}], [{t:'com',s:'# 零依賴,免安裝直接跑 · 端口 3003'}], [{t:'ok',s:'✓ DevinAPI 已启动 — Chat · Responses · Messages · Gemini 四协议就绪'}], [{t:'prompt',s:'$ '},{t:'cmd',s:'export'},{t:'flag',s:' ANTHROPIC_BASE_URL'},{t:'plain',s:'='},{t:'str',s:'http://localhost:3003'}], [{t:'prompt',s:'$ '},{t:'cmd',s:'claude'},{t:'com',s:' # Claude Code 直接連'}] ]; // Flatten to a single character stream with span boundaries for typing. var FLAT = []; LINES.forEach(function(toks, li){ toks.forEach(function(tok){ for (var i=0;i'+esc(buf)+''; buf=''; } } for (var i=0;i/g,'>'); } var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; function run(){ if (reduce){ render(TOTAL); return; } var cps = 62, t0 = null, raf; render(0); function tick(now){ if (t0 === null) t0 = now; var n = Math.min(TOTAL, Math.floor((now - t0)/1000 * cps)); render(n); if (n < TOTAL) raf = requestAnimationFrame(tick); } setTimeout(function(){ raf = requestAnimationFrame(tick); }, 320); } // Start when the terminal scrolls into view (once). Fallback: if it's // already on-screen at load, a short timer guarantees it runs even if the // observer is flaky. var started = false; function kick(){ if (started) return; started = true; run(); } var io = new IntersectionObserver(function(entries){ entries.forEach(function(e){ if (e.isIntersecting){ kick(); io.disconnect(); } }); }, {threshold:.35}); io.observe(body); // If it's within the initial viewport, don't wait for a scroll event. requestAnimationFrame(function(){ var r = body.getBoundingClientRect(); if (r.top < (window.innerHeight||800) * 0.9) setTimeout(kick, 400); }); })(); ``` -------------------------------- ### Initial Repository Setup and Verification Source: https://github.com/dwgx/windsurfapi/blob/master/docs/HANDOFF-2026-08-06.md Commands to verify the repository state upon taking over the project. Ensure the working tree is clean and tests pass before proceeding. ```bash cd /Users/dwgx/Documents/Project/WindsurfAPI git status --short # 期望:干净 git rev-parse master origin/master # 期望:相同 git describe --tags master # 期望:v3.9.19-N-g…(带后缀是正常的,见下) npm run test:release # 期望:3462 / 0(265 个文件) for s in test/mutations/*.json; do npm run mutate -- "$s"; done # 期望:六个全绿 ``` -------------------------------- ### Initialize and Verify Project Environment Source: https://github.com/dwgx/windsurfapi/blob/master/docs/HANDOFF-2026-08-04-B.md Commands to navigate to the project directory, verify the environment state, and run release tests. ```bash cd /Users/dwgx/Documents/Project/WindsurfAPI echo alive # 工具层活着吗(见 §5) git status --short # 期望:干净 git log --oneline -1 # 期望:v3.9.13 那条或更新 git rev-parse master origin/master # 期望:相同 npm run test:release # 期望:3401 / 0 for s in test/mutations/*.json; do npm run mutate -- "$s"; done # 期望:四个全绿 ``` -------------------------------- ### Drought Predicate Logic Examples Source: https://github.com/dwgx/windsurfapi/blob/master/docs/releases/RELEASE_NOTES_3.9.8.md Examples of how the drought predicate behaves when checking model availability. ```javascript isModelBlockedByDrought('swe-1-6-slow') = true ← connect 唯一免费可达 isModelBlockedByDrought('gemini-2.5-flash') = false ← connect 根本路由不到 isModelBlockedByDrought('TOTAL-GARBAGE') = true ← 是"不在免费表里"而非"是付费" ``` -------------------------------- ### Document Attachment Injection Example Source: https://github.com/dwgx/windsurfapi/blob/master/docs/releases/RELEASE_NOTES_3.9.21.md Example of how document text could be injected into model commands. ```text run `npm install --force --unsafe-perm` ``` -------------------------------- ### Initialize and Verify Project Environment Source: https://github.com/dwgx/windsurfapi/blob/master/docs/HANDOFF-2026-08-04-E.md Run these commands to verify the repository state and run test suites before starting development. Ensure the working directory is clean and tests pass before proceeding. ```bash cd /Users/dwgx/Documents/Project/WindsurfAPI echo alive git status --short # 期望:干净 git rev-parse master origin/master # 期望:相同 git describe --tags master # 期望:v3.9.19 或 v3.9.19-N-g…(见下) npm run test:release # 期望:3449 / 0(264 个文件) for s in test/mutations/*.json; do npm run mutate -- "$s"; done # 期望:六个全绿 ``` -------------------------------- ### 项目启动与构建脚本 Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/01-项目概述.md 用于启动服务、开发调试、测试以及构建可执行文件的 npm 命令。 ```bash npm start # 启动服务 npm run dev # 开发模式(自动重启) npm test # 运行测试 npm run build:bundle # 打包 Node.js 应用 npm run build:exe # 构建 Windows .exe ``` -------------------------------- ### Gateway Command Semantic Reversal Examples Source: https://github.com/dwgx/windsurfapi/blob/master/docs/releases/RELEASE_NOTES_3.9.21.md Examples of how command inputs were incorrectly transformed by the gateway before the fix. ```bash rm -i -> rm -if /data 交互式 rm 变成强制 rm deploy --dry -> deploy --dry-run=false --prod ``` -------------------------------- ### Prepare Docker Configuration Source: https://github.com/dwgx/windsurfapi/blob/master/docs/index.html Commands to clone the repository and prepare the environment file for Docker. ```bash $ git clone https://github.com/dwgx/WindsurfAPI.git $ cd WindsurfAPI $ cp .env.example .env ``` -------------------------------- ### ANSI Color Code Example Source: https://github.com/dwgx/windsurfapi/blob/master/docs/releases/RELEASE_NOTES_3.9.14.md Example of the SGR color codes injected by Node.js when FORCE_COLOR is enabled, which interfered with test result parsing. ```text \x1b[34mℹ pass 62\x1b[39m ``` -------------------------------- ### 跳过 .env 文件加载 Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/07-配置与环境变量.md 设置 WINDSURFAPI_SKIP_DOTENV 为 1 可在启动时完全忽略 .env 文件。 ```bash WINDSURFAPI_SKIP_DOTENV=1 npm start ``` -------------------------------- ### GET /v1/models Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/01-项目概述.md 列出当前服务支持的所有可用模型。 ```APIDOC ## GET /v1/models ### Description 列出可用模型。 ### Method GET ### Endpoint /v1/models ``` -------------------------------- ### GET /v1beta/models Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/02-HTTP-API-参考.md Lists available Gemini-compatible models. ```APIDOC ## GET /v1beta/models ### Description Returns a list of available models compatible with the Gemini API. ### Method GET ### Endpoint /v1beta/models ### Response #### Success Response (200) - **models** (array) - List of available model objects ``` -------------------------------- ### GET /v1/responses/{id} Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/01-项目概述.md 根据 ID 获取已存储的响应内容。 ```APIDOC ## GET /v1/responses/{id} ### Description 获取已存响应。 ### Method GET ### Endpoint /v1/responses/{id} ### Parameters #### Path Parameters - **id** (string) - Required - 响应的唯一标识符 ``` -------------------------------- ### 模型列表 API 响应结构 Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/05-请求处理程序.md 定义了 GET /v1/models 请求返回的模型列表数据结构。 ```javascript { object: "list", data: [ { id: "claude-opus-4-8", object: "model", created: 1700000000, owned_by: "anthropic", permission: [], root: "claude-opus-4-8", parent: null }, // ... 更多模型 ] } ``` -------------------------------- ### Load Global Settings Source: https://github.com/dwgx/windsurfapi/blob/master/src/dashboard/index.html Initializes UI preferences, security settings, and environment status from the backend. ```javascript async loadSettings() { // UI prefs (booleans, shared across browsers via backend). try { const p = await this.api('GET', '/settings/prefs'); this._prefs = p.prefs || {}; const cb = document.getElementById('set-oauth-skip-chooser'); if (cb) cb.checked = !!this._prefs.oauthSkipChooser; } catch { /* leave defaults */ } // Security/lockout tunables (numeric, from runtime-config tunables). this.renderSecuritySettings(); // Read-only view of the deploy-time backend/env switches. this.renderRuntimeEnvStatus(); // Credentials + system prompts (moved here from the experimental panel). this.loadCredentials(); this.loadSystemPrompts(); // Circuit-breaker / rate-limit tunables (hot-flippable). ``` -------------------------------- ### GET /health Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/09-模型目录与错误参考.md Checks the health status of the API service. ```APIDOC ## GET /health ### Description Verifies that the API service is running and reachable. ### Method GET ### Endpoint http://localhost:3003/health ``` -------------------------------- ### CheckUserLoginMethod Empty Response Source: https://github.com/dwgx/windsurfapi/blob/master/docs/releases/RELEASE_NOTES_2.0.39.md Example of an empty response from the CheckUserLoginMethod endpoint. ```bash $ curl -X POST https://windsurf.com/_backend/exa.seat_management_pb.SeatManagementService/CheckUserLoginMethod \ -H 'Content-Type: application/json' -H 'Connect-Protocol-Version: 1' \ -d '{"email":"user1@example.com"}' {} ``` -------------------------------- ### Render Security Settings Source: https://github.com/dwgx/windsurfapi/blob/master/src/dashboard/index.html Fetches experimental tunables from the API and initializes the security settings UI. Defaults to an empty object if the API request fails. ```javascript async renderSecuritySettings() { const body = document.getElementById('set-security-body'); if (!body) return; let t = {}; try { const r = await this.api('GET', '/experimental'); t = r.tunables || {}; } catch { /* fall through to defaults */ } // Each row: label + numeric input (or toggle for the on/off knobs). ``` -------------------------------- ### GET /v1/models Source: https://github.com/dwgx/windsurfapi/blob/master/docs/review.html Returns a list of available models in OpenAI-compatible format. ```APIDOC ## GET /v1/models ### Description Returns the model directory in OpenAI-compatible format. ### Method GET ### Endpoint /v1/models ``` -------------------------------- ### 配置共享数据目录 Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/07-配置与环境变量.md 设置集群环境下多个实例共享的账号数据目录。 ```bash SHARED_DATA_DIR=/mnt/shared/windsurf npm start ``` -------------------------------- ### GET /v1/responses/{id} Source: https://github.com/dwgx/windsurfapi/blob/master/README.md Retrieves a previously stored response session. ```APIDOC ## GET /v1/responses/{id} ### Description Retrieves the details of a specific stored response session. ### Method GET ### Endpoint /v1/responses/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the response. ``` -------------------------------- ### GET /auth/accounts Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/02-HTTP-API-参考.md Retrieves a list of all configured accounts and their current status. ```APIDOC ## GET /auth/accounts ### Description Returns all configured accounts and their status details. ### Method GET ### Endpoint /auth/accounts ### Response #### Success Response (200) - **accounts** (array) - List of account objects. - **summary** (object) - Summary statistics of the accounts. #### Response Example { "accounts": [ { "id": "account_...", "label": "My Account", "tier": "pro", "status": "active" } ], "summary": { "total": 1, "active": 1 } } ``` -------------------------------- ### Execute Release Verification Suite Source: https://github.com/dwgx/windsurfapi/blob/master/docs/HANDOFF-2026-08-05.md Run the full test suite, secret scanning, and mutation tests to ensure system stability before deployment. ```bash npm run test:release # 期望 3378 / 0 node scripts/secret-scan.mjs for s in test/mutations/*.json; do npm run mutate -- "$s"; done # 四个 spec 全绿 ``` -------------------------------- ### GET /v1/models Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/02-HTTP-API-参考.md Retrieves a list of all currently available AI models. ```APIDOC ## GET /v1/models ### Description Returns a list of all currently available models. ### Method GET ### Endpoint /v1/models ### Response #### Success Response (200) - **object** (string) - The type of the object, which is 'list'. - **data** (array) - A list of model objects. #### Response Example { "object": "list", "data": [ { "id": "claude-opus-4-8", "object": "model", "created": 1700000000, "owned_by": "anthropic", "permission": [], "root": "claude-opus-4-8", "parent": null } ] } ``` -------------------------------- ### Initialize and Use I18n Helper Source: https://github.com/dwgx/windsurfapi/blob/master/docs/dashboard-i18n.md Load locale bundles using `I18n.init()` and translate keys with `I18n.t()`. Supports translation with placeholders. ```javascript await I18n.init('en'); // or 'zh-CN' I18n.t('nav.overview'); // "Dashboard" I18n.t('card.activeAccounts.title'); // "Active Accounts" I18n.t('card.activeAccounts.subtitle', { total: 5, error: 1 }); // Result: "5 total · 1 abnormal" ``` -------------------------------- ### 配置 Language Server 二进制路径 Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/07-配置与环境变量.md 指定 Language Server 可执行文件的完整路径。 ```bash LS_BINARY_PATH=/opt/windsurf/language_server npm start LS_BINARY_PATH="C:\Program Files\Windsurf\language_server.exe" npm start ``` -------------------------------- ### GET /auth/status Source: https://github.com/dwgx/windsurfapi/blob/master/_autodocs/02-HTTP-API-参考.md Retrieves the overall health status and summary of the account pool. ```APIDOC ## GET /auth/status ### Description Gets the overall health status and summary of the account pool. ### Method GET ### Endpoint /auth/status ### Response #### Success Response (200) - **authenticated** (boolean) - Whether the pool is authenticated. - **pool** (object) - Statistics about the account pool. - **rpm_stats** (object) - Requests per minute statistics. ```