@dorokuma/magpie-gemini-web 0.0.0-stage → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/LICENSE +21 -0
  3. package/LICENSE-AISTUDIO +21 -0
  4. package/LICENSE-UPSTREAM +21 -0
  5. package/README.en.md +262 -0
  6. package/README.md +265 -2
  7. package/docs/backend-release.md +62 -0
  8. package/docs/logo.svg +16 -0
  9. package/docs/studio-release.md +312 -0
  10. package/index.mjs +285 -0
  11. package/lib/backend-release.json +31 -0
  12. package/lib/backend.mjs +731 -0
  13. package/lib/cite.mjs +166 -0
  14. package/lib/cleanup-detached.cjs +69 -0
  15. package/lib/cleanup.mjs +515 -0
  16. package/lib/native.mjs +734 -0
  17. package/lib/setup.mjs +261 -0
  18. package/lib/studio-connect-legacy.mjs +273 -0
  19. package/lib/studio-connect.mjs +269 -0
  20. package/lib/studio-native.mjs +2543 -0
  21. package/lib/studio-page.mjs +173 -0
  22. package/lib/studio-release.json +122 -0
  23. package/lib/studio-updates.mjs +320 -0
  24. package/lib/studio-upstream.mjs +135 -0
  25. package/lib/studio.mjs +1170 -0
  26. package/lib/usage.mjs +322 -0
  27. package/package.json +96 -4
  28. package/patches/studio-0.2.17-preserve-request-bodies.patch +190 -0
  29. package/patches/studio-0.2.19-managed-config.patch +121 -0
  30. package/patches/studio-0.3.4-magpie-signin.patch +676 -0
  31. package/patches/studio-0.3.5-signin-reauth.patch +25 -0
  32. package/patches/studio-0.3.7-magpie-signin.patch +676 -0
  33. package/patches/studio-0.3.7-managed-config.patch +121 -0
  34. package/patches/studio-0.3.7-signin-reauth.patch +25 -0
  35. package/scripts/backend-smoke.mjs +123 -0
  36. package/scripts/backend.mjs +57 -0
  37. package/scripts/studio-archive.go +92 -0
  38. package/scripts/studio-auto-update-smoke.mjs +116 -0
  39. package/scripts/studio-lifecycle-smoke.mjs +149 -0
  40. package/scripts/studio-managed-smoke.mjs +198 -0
  41. package/scripts/studio-official-smoke.mjs +12 -0
  42. package/scripts/studio-pins.mjs +52 -0
  43. package/scripts/studio-regzip.go +75 -0
  44. package/scripts/studio-release.mjs +287 -0
  45. package/scripts/studio-signin-candidate.json +102 -0
  46. package/scripts/studio-smoke.mjs +195 -0
  47. package/scripts/studio-update-smoke.mjs +82 -0
  48. package/scripts/studio-user-smoke.mjs +206 -0
  49. package/scripts/studio.mjs +468 -0
  50. package/scripts/sync-backend-pins.mjs +217 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,180 @@
1
+ # 更新日志
2
+
3
+ 本文件按版本倒序记录 `magpie-gemini-web`(0.15.0 起为 `@dorokuma/magpie-gemini-web`)的全部已发布与待发变更,依据本仓 `git log` 与 tag 事实编写。
4
+
5
+ ## 0.15.1
6
+
7
+ ### 修复
8
+ - AI Studio 代理优先级收口:插件配置 `studio.proxy`(及传入 `options.proxy` 的 `install` / `prepare-browser` `--proxy`)显式设为空串 `""` 时在服务运行态与安装/自动更新下载态一致地跳过 `AI_STUDIO_PROXY` 与管理页 `.env`/`config.json` 保存的代理(运行态注入 `PROXY=""`;macOS/Windows 上后端自身的系统代理自动检测仍可能生效;CLI `start --proxy ""` 保持清空 `.env` 保存值的既有语义),未设置(缺省 `undefined`)时仍按原顺序回退。
9
+ - 自动更新锁原子发布与自愈:维护门与使用租约改为写满 .pending-record.*.tmp 后经 renameSync 原子发布,消除活写者暴露半截锁文件的竞态窗口;同时对历史/极端断电遗留超过 10 秒宽限窗的 0 字节/损坏锁及孤儿暂存文件自动清理(二次读取发现内容已变更时保持占用语义),不再永久自锁。
10
+
11
+ ### 文档
12
+ - `AGENTS.md` 铁律补入无作用域旧包 `magpie-gemini-web` 迁移期双包名卸载清理红线。
13
+
14
+ ## 0.15.0
15
+
16
+ ### 变更
17
+ - npm 包名切换为作用域包 **`@dorokuma/magpie-gemini-web`**;卸载清理的 `plugins.json` 匹配同时接受新包名与历史包名 `magpie-gemini-web`(精确名、`@version`、git/URL spec、本地目录 `package.json` 的 `name`),迁移期双名并存不误判。
18
+ - Gemini Web 后端固定使用 **`dorokuma/gemini-web2api-go` `v5.0.0`** 官方预编译二进制:默认通道直接按 `lib/backend-release.json` 中 6 平台(macOS arm64/x64、Linux x64/arm64、Windows x64/arm64)的 SHA-256 pin 从后端仓 Release 下载校验,一仓一制品,插件仓不再重编。
19
+ - 退役 `patches/argon.patch` 打补丁重编流水线:删除 `patches/argon.patch`、`scripts/backend-release.mjs`、`scripts/backend-argon.mjs` 与 `publish-backend.yml`,`backend:release:build`、`backend:build:argon`、`backend:install:argon`、`backend:start:argon` 命令随之移除。历史本机 `argon-build.json` 记录仍被信任与清理,存量自定义构建不受影响。
20
+ - 守护进程跨版本平滑接管:卸载清理 watcher 的 pidfile 升级为 JSON `{ pid, pluginRoot, version }`,兼容读取旧版纯数字 pidfile;检测到存活的旧格式或旧插件实例 watcher 时,经 watcher 进程身份核验后先安全终止旧进程再拉起新 watcher,且退出清理只删除 `pid === process.pid` 的 pidfile,避免旧进程退出误删新记录。
21
+ - `magpie plugin options` 报错提示中的插件名更新为 `@dorokuma/magpie-gemini-web`。
22
+
23
+ ### 新增
24
+ - `scripts/sync-backend-pins.mjs`:`--write-pins --tag=vX.Y.Z` 从后端仓 Release 的 `SHA256SUMS.txt` 单向同步 6 平台 pin(原子写入、严格校验 SemVer/仓库/资产名/哈希,且拒绝与上游回滚哈希重复);`--verify` 离线校验清单结构后联网比对已发布 `SHA256SUMS.txt` 并确认 6 个资产可达;`--verify-schema` 纯离线校验。对应命令 `backend:pins:verify`、`backend:pins:sync`、`backend:smoke`。
25
+ - `scripts/backend-smoke.mjs` 支持 `--binary=<path>` 冒烟本地二进制,`--download`(或解包 tarball 后默认)从 pin 的 Release URL 下载校验后端。
26
+ - `Makefile`:`make check`(npm test + pin 离线校验 + `npm pack --dry-run`)与 `make release-check TAG=vX.Y.Z`(TAG 单行 SemVer、`package.json` 名版本匹配、pin 结构、CHANGELOG 章节实质内容、已有同名 tag 必须为 annotated tag 且指向当前 `HEAD`)。
27
+
28
+ ### CI
29
+ - `backend.yml`:增加 `concurrency` 防抖;`plugin` 作业跑 `make check`、`sync-backend-pins.mjs --verify`,并以 Go 1.27.1 从 pin 的源码 tag 重建 `linux-x64` 比对 SHA-256 做可复现溯源;6 平台矩阵直接 `backend-smoke.mjs --download` 冒烟真实发布二进制。
30
+ - `publish-package.yml`:修复作用域包 tarball 名(`dorokuma-magpie-gemini-web-X.Y.Z.tgz`);发版与重跑复用 tarball 时无条件执行 `make check` 与 `make release-check TAG=<tag>`,并支持远端附注 tag 剥离锁定提交 SHA。
31
+ - `verify-package.yml`:跑 `make check`;packument 一次请求同时校验版本条目与 `dist-tags.latest`,URL 按 `encodeURIComponent` 编码作用域名。
32
+ - `studio.yml` / `studio-official.yml`:POSIX 分支以 `make check` 替换 `npm test`(Windows runner 保持原样)。
33
+ - 仓库档位升为 L2。
34
+
35
+ ### 迁移提示
36
+ - 已安装旧无作用域包 `magpie-gemini-web` 的用户:在 Magpie 中删除旧插件条目,重新安装 `@dorokuma/magpie-gemini-web`;本地数据目录 `~/.local/share/magpie-gemini-web`、账号、Cookie、数据库与凭据不变,双包名兼容期卸载清理不会误判新插件为已卸载。
37
+
38
+ ## 0.14.1(同步上游 0.14.0 与后端 v4.28.0-magpie.5)
39
+
40
+ - 后端升级至 `v4.28.0-magpie.5`(自托管 `dorokuma` fork 重建,上游基线 `v4.28.0`);同步上游 `v0.14.0`。
41
+ - AI Studio 默认自动跟随官方 Mag1cFall/AIStudio2API 最新稳定版:后台检查更新、空闲窗口下载校验后自动更新并保留账号/端口/凭据,可 `studio:updates auto|manual` 控制;旧 `-magpie` 构建可自动替换为官方包。
42
+ - 新增官方安装、生命周期、自动更新、用户自备路径等冒烟脚本与 `studio-official.yml` 五平台可复用验证工作流;`publish-package.yml` 增加发布 tarball 校验与上传。
43
+ - README 与包描述更新至 Gemini 4 Carbon / Hydrogen 模型说明;`backend-release.json` 记录 `upstream.commit` 与 Go `1.27.1`。
44
+
45
+ ## 0.13.2(v0.13.1 + 补丁同步)
46
+
47
+ - `argon.patch` 与上游 main 同步,后端发布 `v4.28.0-magpie.3`。
48
+
49
+ ## 0.13.1(v0.13.0 + 自托管 fork)
50
+
51
+ - 仓库迁移至 `dorokuma/magpie-gemini-web`;后端切换为自托管 fork 构建并发布 `v4.28.0-magpie.2`;仓库建立 L1 基线。
52
+ - 移除已退役的 macOS native Task 登录桥。
53
+
54
+ ## 0.13.0
55
+
56
+ - AI Studio 升级至 `0.3.5-magpie.1`;修复 #53 多账号索引漏传(Gemini 账号索引修复)。
57
+ - 自动衔接上游账号导入与 Magpie 登录(#54)。
58
+ - 完善发布元数据与包 tarball 上传工作流。
59
+
60
+ ## 0.12.0
61
+
62
+ - AI Studio `0.3.4-magpie.1`,Gemini Web 后端 `4.28.0-magpie.1`。
63
+ - 管理页界面重构适配;`strict_model` 槽位校验兼容显示名家族互认。
64
+
65
+ ## 0.11.0
66
+
67
+ - AI Studio `0.3.2-magpie.1`,Gemini Web 后端 `4.27.1-magpie.1`。
68
+
69
+ ## 0.10.0
70
+
71
+ - AI Studio `0.3.0-magpie.1`(账号异步任务流、Chrome/Cookie/CDP 导入、SpiderMonkey 默认生成后端),Gemini Web 后端 `4.27.0-magpie.2`。
72
+ - 新增 `/v1/chat/completions` 上的 Deep Research 模型(#45/#46)。
73
+ - 新增卸载清理:在 Magpie 中删除插件自动停止并清理已下载后端与 Camoufox,保留账号与配置(#44)。
74
+ - 账号索引(authuser)变化后重新读取用量;`web_channel` 被忽略时仅提示一次(#43)。
75
+
76
+ ## 0.9.0
77
+
78
+ - AI Studio 升级至 `0.2.19` 并保留已保存设置(#39)。
79
+ - AI Studio 服务信息卡片不再显示额度读数(#38)。
80
+ - Gemini Web 后端升级 `4.27.0-magpie.1`;图片输入默认开启(#41)。
81
+
82
+ ## 0.8.1
83
+
84
+ - Gemini Web 后端 `4.26.0-magpie.2`:排队请求按上游沉默计时等待出字而非固定超时(#36)。
85
+ - 修复刷新显示 Gemini Web 当前用量(#35)。
86
+
87
+ ## 0.8.0
88
+
89
+ - AI Studio `0.2.18-magpie.1`:WAA 后端迁移至 SpiderMonkey(CGO)。
90
+ - AI Studio 图片输入默认开启(#30);Nano Banana 图片模型接入 Magpie 出图(#28)。
91
+
92
+ ## 0.7.0
93
+
94
+ - AI Studio `0.2.17-magpie.1`:CGO SQLite 构建与请求正文安全迁移补丁。
95
+ - 新增 Twin Sparkles 插件图标(#25/#26);README 增加 Star 趋势图。
96
+
97
+ ## 0.6.0
98
+
99
+ - 后端 `4.26.0-magpie.1`、AI Studio `0.2.16-magpie.1`;新增 Gemini Web 登录代理支持(#24)。
100
+ - 修复慢速下载、长等待与非 ASCII/相对路径下的安装与登录(#23)。
101
+
102
+ ## 0.5.6
103
+
104
+ - 兼容 Bun `ConnectionRefused` 探测本地 AI Studio 端口(#22)。
105
+
106
+ ## 0.5.5
107
+
108
+ - AI Studio 登录进度独立页面,在 Magpie 超时前结束展示;补充 PowerShell 5.1 插件选项写法文档。
109
+ - 托管服务启动不再借用 Magpie 代理,旧服务检测代理来源提示。
110
+
111
+ ## 0.5.4
112
+
113
+ - AI Studio 升级至 `v0.2.14`(无补丁官方版)。
114
+
115
+ ## 0.5.3
116
+
117
+ - AI Studio 代理设置改由管理页持有并显示来源。
118
+
119
+ ## 0.5.2
120
+
121
+ - AI Studio `v0.2.13` 托管构建并禁用其在线更新;每个 AI Studio 账号独立登录;README 重构为对比表与折叠进阶章节。
122
+
123
+ ## 0.5.1
124
+
125
+ - AI Studio 每个 Google 账号恢复为独立登录项(Magpie 账号列表按邮箱显示),0.5.0 的池化登录保留其卡片。
126
+ - AI Studio 登录入口合并为单一路径:新装即完成托管服务部署并打开登录窗;已有账号先列新增、再列本地服务账号,过期的可直接重登;自备 AIStudio2API 仍为独立入口。
127
+ - 登录步骤明确提示首次登录将下载 Camoufox(约 300 MB)。
128
+
129
+ ## 0.5.0
130
+
131
+ - 新增 Google AI Studio Provider,由托管 AIStudio2API 支撑。
132
+ - Cookie 校验超时报后端无法连接 Google;发布流水线增加 npm/GitHub 包与真实下载校验、CI 上传私有 draft 资产。
133
+
134
+ ## 0.4.1
135
+
136
+ - 默认安装切换为优化版后端发行物(`-magpie` 构建):新增 `lib/backend-release.json` 平台 pin 清单与 optimized/upstream 双通道(`backend-channel.json`),配套 `backend-release.mjs` 发布、`backend-smoke.mjs` 冒烟与 `backend.yml` 发布工作流。
137
+ - 后端源码归档兼容 Windows tar;CI 支持上传已校验后端二进制到私有 release 草稿并经 release 列表解析草稿资产。
138
+ - 文档补充 macOS native Task 登录实测说明与付费 Google AI Pro 可用 `gemini-4-argon` 的说明。
139
+
140
+ ## 0.4.0
141
+
142
+ - 工具调用默认开启,并在后端返回 400 时提示开启方式。
143
+ - macOS 提供 Gemini.app native Task 实验性登录(后续版本已退役)。
144
+
145
+ ## 0.3.3
146
+
147
+ - Argon 直连请求携带 Chrome 请求头降低特征;Cookie 轮换后不再每次抓取 app 页面;用量按后端实际通路读取且仅在变化时刷新。
148
+
149
+ ## 0.3.2
150
+
151
+ - 默认声明 1M token 上下文窗口。
152
+
153
+ ## 0.3.1
154
+
155
+ - 移除回复中的 Gemini 引用标记(`[cite: n]` 等)。
156
+
157
+ ## 0.3.0
158
+
159
+ - 在 Magpie 中展示每个 Google 账号的 5 小时与每周额度;要求用无痕窗口取 Cookie;README 中英双版本重写。
160
+
161
+ ## 0.2.0
162
+
163
+ - 新增一键本地配置:从 Magpie 内安装、启动并登录(#9)。
164
+
165
+ ## 0.1.3
166
+
167
+ - 提供 low/high 思考档位,路由至 `-thinking` 模型(#8)。
168
+
169
+ ## 0.1.2
170
+
171
+ - 后端迁移至上游 `v4.22.0`,Argon 补丁重打为 `4.22.0-argon.1`;文档记录后端 API key 与 admin token 存放位置。
172
+
173
+ ## 0.1.1
174
+
175
+ - 登录时持久化解析后的 baseURL,空提示不再保存为空串。
176
+ - Argon 后端补丁升级至 `4.21.0-argon.2`,降低首 token 与工具调用延迟(#1)。
177
+
178
+ ## 0.1.0
179
+
180
+ - 首个版本:Gemini Web Provider,携带 Argon 后端补丁(`4.21.0-argon.1`)。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 magpie-gemini-web contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mag1cFall
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 gemini-web2api-go contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,262 @@
1
+ # <img src="docs/logo.svg" width="28" height="28" align="top" alt="" /> magpie-gemini-web
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@dorokuma/magpie-gemini-web?style=flat-square&logo=npm&color=4f46e5)](https://www.npmjs.com/package/@dorokuma/magpie-gemini-web) [![npm downloads](https://img.shields.io/npm/dw/@dorokuma/magpie-gemini-web?style=flat-square&color=06b6d4)](https://www.npmjs.com/package/@dorokuma/magpie-gemini-web) [![Magpie Plugin](https://img.shields.io/badge/Magpie-Plugin-3b82f6?style=flat-square)](https://usemagpie.ai/) [![Node.js >= 22](https://img.shields.io/badge/node-%3E%3D22-8b5cf6?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org/) [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-6366f1?style=flat-square)](https://github.com/dorokuma/magpie-gemini-web) [![License: MIT](https://img.shields.io/badge/license-MIT-10b981?style=flat-square)](LICENSE)
4
+
5
+ [中文](README.md) | English
6
+
7
+ Use **Google AI Studio** and **Gemini on the web** through your Google account in [Magpie](https://usemagpie.ai/). The plugin runs [AIStudio2API](https://github.com/Mag1cFall/AIStudio2API) and [gemini-web2api-go](https://github.com/zexadev/gemini-web2api-go) locally, providing chat, native function calling, Nano Banana image generation, and Deep Research through OpenAI-compatible and Gemini APIs.
8
+
9
+ > **New model support:** **Google AI Studio (`ai-studio`)** automatically follows official stable backend releases and supports **`gemini-4-hydrogen`** (including the `xhigh` thinking tier), **`gemini-4-carbon`** (requires an eligible account tier such as Google AI Ultra), and **`gemini-4-argon`**. **Gemini Web (`gemini-web`)** is backed by [`dorokuma/gemini-web2api-go` `v5.0.0`](https://github.com/dorokuma/gemini-web2api-go/releases/tag/v5.0.0), which natively supports dedicated `gemini-4-carbon` / `gemini-4-hydrogen` model IDs (including `-thinking` variants) and mutually recognizes slot upgrades/downgrades under `strict_model`; signed-in `gemini-4-argon` still has a known hang issue in [#53](https://github.com/dorokuma/magpie-gemini-web/issues/53), so `ai-studio` is recommended.
10
+
11
+ ## Which Provider Should I Choose?
12
+
13
+ The plugin provides two independent providers that can be used individually or together:
14
+
15
+ | Feature | Google AI Studio (`ai-studio`) | Gemini Web (`gemini-web`) |
16
+ | :--- | :--- | :--- |
17
+ | **Best for** | **Primary use & coding agents (recommended)** | General chat & web quota |
18
+ | **Key models** | `gemini-4-carbon` (Ultra / eligible accounts), `gemini-4-hydrogen`, `gemini-4-argon`, `gemini-3.1-pro`, Flash series, Deep Research | `gemini-4-carbon` / `gemini-4-hydrogen` (including `-thinking` variants), `gemini-3.8-flash`, `gemini-3.6-flash`, `gemini-3.5-flash-lite`, `gemini-3.1-pro`, `gemini-4-argon` (see [#53](https://github.com/dorokuma/magpie-gemini-web/issues/53)) |
19
+ | **Tool calling** | **Native Function Calling**, reliable | Prompt-emulated (experimental; Flash often skips tools) |
20
+ | **Thinking levels** | Supported levels from the model catalog: `minimal` / `low` / `medium` / `high` / `xhigh` (Hydrogen) | `low` (base) / `medium` (`-thinking-medium`, `gemini-4-argon` only) / `high` (`-thinking` extended thinking) |
21
+ | **Image input** | On by default; chat models read images | On by default; chat models read images (needs a signed-in cookie) |
22
+ | **Image generation** | Nano Banana models, for Magpie's image generation (Magpie v0.1.2075+, see below) | Not supported |
23
+ | **Sign-in method** | Automatic official installation; confirm an imported account | Copy `cookie` from a private/incognito window |
24
+ | **Usage cards** | Shows models currently on cooldown and recovery times | Syncs **5-hour** & **weekly** usage and reset times from the web |
25
+ | **Local backend** | AIStudio2API (automatic installation and stable updates) | gemini-web2api-go (`v5.0.0` pinned binary) |
26
+
27
+ ---
28
+
29
+ ## Quick Start
30
+
31
+ Install **@dorokuma/magpie-gemini-web** from the Magpie plugin market, then sign in to either (or both) providers below. By default, the plugin downloads the backend, verifies its SHA-256 checksum, and runs it in the background, with no Go installation required.
32
+
33
+ > **Migrating from the legacy package:** since `0.15.0` the npm package is the scoped `@dorokuma/magpie-gemini-web` (previously the unscoped `magpie-gemini-web`). If you installed the old package, remove `magpie-gemini-web` from the Magpie plugin market and install the new one. The local data directory `~/.local/share/magpie-gemini-web`, saved Google accounts, cookies, database and credentials are all preserved—no sign-in or cookie re-import is needed. During the transition, uninstall cleanup recognizes both package names and never mistakes the new plugin for removed. AI Studio automatically follows official stable releases by default. You can disable automatic updates, select your own executable or connect an independent service.
34
+
35
+ ### Option 1: Google AI Studio (`ai-studio`)
36
+
37
+ 1. Sign in to **Google AI Studio** in Magpie and choose **「添加账号并连接(推荐)」** (Add an account and connect).
38
+ 2. On first use, the plugin **automatically downloads, verifies and starts the latest stable official AIStudio2API backend**. No manual download, executable path, API key copying or administrator credentials are needed.
39
+ 3. Click **「打开账号管理页」** (Open account management) on the connection page, then add a Google account using Chrome import, cookie import or browser login.
40
+ 4. Return to the connection page, select the account and click **「连接到 Magpie」** (Connect to Magpie). The existing `ai-studio` provider, models, image generation and usage cards remain available. Repeat sign-in to add more accounts.
41
+
42
+ If an existing account needs to sign in again, select that account in Magpie, use its **Re-login** action in account management, then return to confirm the connection.
43
+
44
+ Subsequent starts reuse the installed executable. **Automatic stable updates are enabled by default:** while Magpie is running, the plugin checks in the background, caching successful release checks for an hour. After downloading and verifying an update, it waits for generation requests (including streams), account login and browser preparation to finish before upgrading and restarting. Accounts, port, credentials and settings remain in place; no new plugin release is needed. Failed checks or downloads leave the current version running. A failed new executable triggers an attempted rollback and blocks repeated attempts to install that archive.
45
+
46
+ Use `npm run studio:updates -- manual` to manage versions yourself, or `npm run studio:updates -- auto` to resume automatic updates. Custom executables and independent services remain user-managed.
47
+
48
+ Browser login downloads Camoufox (about 1.3 GB with v0.3.7+); Chrome / cookie import can use existing sessions. Magpie limits each connection attempt to 10 minutes. On slow connections, finish preparation in the official account management page: its background download and login tasks continue after Magpie times out. Then start a new connection in Magpie and select the imported account. Alternatively, run `npm run studio:prepare-browser` from the plugin directory before signing in. It waits up to an hour; closing the command does not cancel the backend download. Set `studio.proxy` or `AI_STUDIO_PROXY` if GitHub is unreachable. **「直接打开 Google 登录窗口」** still opens an isolated browser login window. Existing backends with Magpie task correlation can still complete the account connection automatically.
49
+
50
+ Automatic installation supports macOS / Linux x64 and arm64, and Windows x64. macOS / Linux use official CLI archives. The official Windows archive contains a desktop executable, installed beside `.env` and `runtime/` in the data directory to retain its settings. Windows arm64 currently needs a compatible executable selected through the advanced path option (for example, an x64 executable supported by the system), or an independent backend. Unsupported targets receive guidance before a release lookup.
51
+
52
+ **Existing installations and version selection:**
53
+
54
+ - Accounts, port, credentials and Magpie cards are preserved. The plugin can also automatically replace an older `-magpie` build in the default directory with a newer official stable release. Its compiled updater restriction does not prevent this. Automatic replacement is deferred if an older backend lacks the APIs needed to confirm idle status. To switch immediately, quit Magpie, run these commands from the plugin directory, then reopen Magpie:
55
+
56
+ ```bash
57
+ npm run studio:stop
58
+ npm run studio:install # Current official stable release
59
+ npm run studio:start
60
+ ```
61
+
62
+ - To choose an official version, stop the service and run `npm run studio:install -- --version v0.3.7`. This verifies the official SHA-256 and selects manual updates to preserve your choice. Run `npm run studio:updates -- auto` to follow stable releases again. Historical installation hashes do not force file restoration, and automatic updates never downgrade a newer running version. Back up the entire data directory before downgrading: older versions may not read data migrated by newer ones.
63
+ - **Advanced option:** Select 「指定 AIStudio2API 程序路径(高级)」 (Specify executable path) or run `npm run studio:use -- "/absolute/path/to/aistudio2api"`. Use an executable extracted from an [official archive](https://github.com/Mag1cFall/AIStudio2API/releases), outside the plugin and AI Studio data directories; stop the old service before switching. A missing custom executable produces an error and is never replaced by a download. `studio:use-default` returns to the default directory, reusing its executable or installing the official CLI if absent.
64
+ - Existing configurations receive a one-time migration of missing legacy defaults: `SEARCH_MODEL_ALIASES=false`, per-account concurrency / warm worker limit / maximum workers / warm startup concurrency all `1`, `ROUTING_STRATEGY=fill-first`, and `REQUEST_TIMEOUT=30m`, along with the earlier disabled hedging policy. Explicit settings and unknown keys remain intact. Later admin choices, including defaults omitted by upstream Save, are not seeded again.
65
+ - Fresh installations follow upstream defaults. With v0.3.7+ this enables search model aliases, per-account concurrency 2, 10 warm / 20 maximum workers, round-robin routing, and SpiderMonkey generation. A future version changing the `WAA_BACKEND` default could also require Camoufox or other browser components for generation; choose explicit settings in the admin page if needed.
66
+ - The plugin maintains the local connection and account access. Other settings belong to the backend, including future configuration keys. Uninstall or `studio:clean` removes downloaded programs from the default directory while retaining accounts and settings. With a custom path, the process, executable and entire data directory are preserved; use `studio:stop` to stop it.
67
+
68
+ For an independently running service, choose **Connect an existing AIStudio2API (URL + API key)**. With official v0.3.7+, Hydrogen Extra High maps to Magpie's `xhigh` variant.
69
+
70
+ ### Option 2: Gemini Web (`gemini-web`)
71
+
72
+ 1. Sign in to **Gemini Web** in Magpie and choose **「一键配置本地 Gemini Web(推荐)」** (One-click local setup). If you need a proxy to reach Google, enter its URL (e.g. `http://127.0.0.1:7890`) when prompted at the start of sign-in, or leave it blank for direct connection / existing proxy pool.
73
+ 2. Enter the **Google account index** when prompted: for `/u/4/app` in the same window you copy cookies from, enter `4`; leave it blank for a single-account session (`0`). Private windows may assign different indices from your regular browser. Copy your cookie using a **private / incognito window** (Firefox recommended):
74
+ 1. Open <https://gemini.google.com/app> in the private window and sign in to your Google account.
75
+ 2. Press `F12` (`⌥⌘I` on macOS), switch to the **Network** tab, and reload the page.
76
+ 3. Click any `gemini.google.com` request → **Headers** → **Request Headers**, copy the `cookie` value, and paste it into Magpie.
77
+ 4. **Close the private window directly—do not sign out** (signing out invalidates the cookie).
78
+ 3. The plugin verifies the account and completes sign-in. Repeat the steps above to add more accounts.
79
+
80
+ > **Backend upgrade required during sign-in?** An older background process may still be running. Exit Magpie, stop the matching `gemini-web2api-go` process (Windows: Task Manager → Details → `gemini-web2api-go.exe`), then run the full installation command shown in the error. It preserves accounts and configuration and selects the plugin's managed backend. Set `GEMINI_WEB_PROXY` first if the download needs a proxy. Reopen Magpie and sign in after installation.
81
+
82
+ > **Why is a private window required?** The backend periodically refreshes this session to keep it alive. If it shares a session with your daily browser, Google will revoke the session and sign your browser out of all Google services. A private window (or a dedicated secondary Google account) gives the backend an isolated session.
83
+
84
+ ---
85
+
86
+ ## Multiple Accounts & Usage Cards
87
+
88
+ - **Account usage cards:** Individual accounts use their email address. An AI Studio batch gets a separate group card; importing the same group in a different order keeps its identity.
89
+ - *Migrating older Gemini Web accounts:* For accounts added in earlier versions, add a Gemini Web account in Magpie and choose **「添加本地后端里已有的 Google 账号」** (Add an existing Google account from the local backend) to create individual cards, then remove the old pooled `API key …` card.
90
+ - **Automatic account rotation:** The local backend selects which Google account serves each request (Gemini Web rotates across the pool; AI Studio uses one account until cooldown and switches to the next, with optional account priority order and per-model account bindings configurable in the admin page or via `studio.accountOrder` and `studio.modelAccounts`). Switching cards in Magpie does not change which account the backend picks.
91
+ - **Usage reporting:**
92
+ - `gemini-web`: Available only with the one-click local backend. Usage is read from Google again whenever Magpie asks for it (at most once every 30 seconds per account), so pressing refresh shows the current allowance, including usage from the Gemini app, the website or other devices. On its own, Magpie asks about once a minute while the Usage page or the menu bar's allowances panel is open, whenever it updates allowances shown in the menu bar (every 3 minutes by default), and at most once a minute while it routes requests among accounts; otherwise it doesn't ask. A failed read isn't retried on its own for 10 minutes; pressing refresh in that time retries it at once (press it again if the first press doesn't).
93
+ - `ai-studio`: AI Studio does not report remaining total quota; cards display models currently on cooldown and their recovery times, or prompt when re-authentication is needed.
94
+
95
+ ---
96
+
97
+ ## Image Generation (AI Studio)
98
+
99
+ `ai-studio` lists the Nano Banana image models your account can use (such as `gemini-3.1-flash-image` and `gemini-3-pro-image`), for Magpie's image generation. **This needs Magpie v0.1.2075 or later**, the first to take a plugin's Gemini image models as models that draw.
100
+
101
+ **Drawing from an agent** (pi, Claude Code, Codex and the rest alike):
102
+
103
+ 1. **Pick the model to draw with:** Magpie's Settings list these models under **Images → Image generation**. Pick one (such as `ai-studio/gemini-nano-banana-2.1`), or leave it on Automatic. There's no need to tick them in any model list.
104
+ 2. **Give the agent the drawing tool:** click **Give agents Magpie Image…** under that row, tick the agents that should draw in the Library it opens, then start a new session in the agent. With the Library turned off, the row says **Turn on the Library** instead: click that first. From the command line: `magpie library mcp add magpie-image magpie mcp image agents=pi` (several agents separated by commas, as in `agents=pi,claude`).
105
+ 3. **Chat as usual:** keep the agent on its usual chat model and ask it to draw something. It calls the `generate_image` tool, which draws with the model from step 1 and saves the image in the project's `generated-images/` folder; reference images make it an edit.
106
+
107
+ - **Don't pick an image model as the chat model:** Magpie still keeps a plugin's models that draw in its chat model lists ([yetone/magpie#2792](https://github.com/yetone/magpie/issues/2792)). Picked there, they show no picture: an agent such as pi has no place for an image in the model's reply, so the image the model draws is dropped, while the model believes it was shown. They take no tool calls either, and have 32K–128K context windows.
108
+ - **Drawing from the command line:** `magpie tool generate_image "a magpie on a branch, watercolour" --size 16:9 -o magpie.png`; add `--model ai-studio/gemini-3-pro-image` to draw with another model this once. If the terminal can't find the `magpie` command (step 2's command too), click **Add to PATH** on the **Command line** row of Magpie's Settings, then open a new terminal.
109
+ - **Size:** `size` gives the aspect ratio. A ratio (such as `16:9` or `1:4`) is used as it is when the model takes it, else the nearest one it does; a size such as `1536x1024` is made the nearest usual ratio by Magpie first. `quality` makes no difference for these models.
110
+ - If you don't want the image models, turn them off with `studio.imageModels` (see the options below).
111
+
112
+ ---
113
+
114
+ ## Configuration & Advanced Usage
115
+
116
+ <details>
117
+ <summary><b>⚙️ Plugin Options & Proxy Setup</b> (image input, proxy configuration, custom backends)</summary>
118
+
119
+ <br>
120
+
121
+ Tool calling and image input are enabled by default. Configure plugin options via the CLI:
122
+
123
+ ```bash
124
+ # Turn image input off only for Gemini Web, keeping it on for AI Studio
125
+ magpie plugin options @dorokuma/magpie-gemini-web '{"allowImages":false,"studio":{"allowImages":true}}'
126
+
127
+ # Turn image input off for AI Studio
128
+ magpie plugin options @dorokuma/magpie-gemini-web '{"studio":{"allowImages":false}}'
129
+
130
+ # Configure a proxy for AI Studio
131
+ magpie plugin options @dorokuma/magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:7890"}}'
132
+ ```
133
+
134
+ > **Windows PowerShell**: `magpie` runs the `magpie.cmd` wrapper, which loses the double quotes inside the JSON when it passes the arguments on. Call the program behind it directly instead: it is in the same folder as `magpie.cmd` (which `where.exe magpie` finds), named something like `magpie-windows-amd64.exe`, and Magpie's Settings > Command line shows it too. How to write it depends on the PowerShell version (`$PSVersionTable.PSVersion` shows it):
135
+ > - PowerShell 7.3 or later, default settings: `& "<full path to the program>" plugin options @dorokuma/magpie-gemini-web '{"allowImages":true}'`
136
+ > - Windows PowerShell 5.1 (built into Windows): it doesn't escape the double quotes in an argument for you, so write them as `\"`: `& "<full path to the program>" plugin options @dorokuma/magpie-gemini-web '{\"allowImages\":true}'`
137
+
138
+ | Option | Default | Scope | Description |
139
+ | :--- | :--- | :--- | :--- |
140
+ | `allowTools` | `true` | Shared (override via `studio.allowTools`) | Allow tool calls. When `false`, requests with tools return 400 |
141
+ | `allowImages` | `true` | Shared (override via `studio.allowImages`) | Allow image input in a chat (an image model's reference images don't need it). Gemini Web reads images only when signed in and returns 400 otherwise |
142
+ | `requestTimeoutMs` / `modelTimeoutMs` | Web: `570000` / `10000`; Studio: `1800000` / `10000` | Shared (override via `studio.*`) | Timeout (ms) per backend wait or model list fetch; resets on stream data, explicit settings take precedence |
143
+ | `stripCitations` | `true` | `gemini-web` only | Strip `[cite: 1]` and `[cite_start]` markers from replies and tool arguments (not supported on AI Studio) |
144
+ | `proxy` | none | `gemini-web` only | Proxy for the managed Gemini Web backend to reach Google (`http` / `https` / `socks5` / `socks5h`), or set `GEMINI_WEB_PROXY` env var / enter during sign-in |
145
+ | `baseURL` | `http://127.0.0.1:8083/v1` | `gemini-web` only | Default Gemini Web backend URL |
146
+ | `contextLimit` / `outputLimit` | `1000000` / `8192` | `gemini-web` only | Context and output limits reported to clients |
147
+ | `studio.proxy` | none | `ai-studio` only | Proxy for reaching Google (`http` / `https` / `socks5`), or set `AI_STUDIO_PROXY` env var; when set, it takes precedence over the proxy saved in the admin page. When omitted, falls back to AI_STUDIO_PROXY or the proxy saved in the admin page; setting "" disables both (the backend's own system-proxy detection on macOS/Windows may still apply) |
148
+ | `studio.accountOrder` | none | `ai-studio` only | Account priority order (comma-separated string or string array, e.g. `["b@gmail.com","a@gmail.com"]`); seeds `ACCOUNT_ORDER` in `.env` when unset, while preserving any non-empty value saved in the admin page |
149
+ | `studio.modelAccounts` | none | `ai-studio` only | Per-model account bindings (`"model:acc1|acc2"` string or `{ "gemini-3.1-pro-preview": ["acc1", "acc2"] }` object); seeds `MODEL_ACCOUNTS` in `.env` when unset, while preserving any non-empty value saved in the admin page |
150
+ | `studio.baseURL` | `http://127.0.0.1:2048/v1` | `ai-studio` only | Default URL when connecting an existing AIStudio2API instance |
151
+ | `studio.contextLimit` / `studio.outputLimit` | Model catalog defaults | `ai-studio` only | Limits reported to clients (can only lower the catalog defaults) |
152
+ | `studio.imageModels` | `true` | `ai-studio` only | List the Nano Banana image models, for Magpie's image generation; `false` lists text models only |
153
+
154
+ **Using a proxy to reach Google:**
155
+ - **AI Studio:** Preferably set it in the local admin page. Choose 「添加账号并连接(推荐)」 in Magpie, select the new-account option, and open the authenticated account management page from the connection page. Save the proxy, then restart the service from the admin page. The plugin keeps the saved value when it restarts the backend. Usage cards show the management address without administrator details, credential file locations or executable paths.
156
+ - Alternatively, `studio.proxy` or `AI_STUDIO_PROXY` take precedence over the saved proxy. A change applies after the local service restarts (`npm run studio:stop`; the next request starts it again).
157
+ - With none set, the backend goes out directly, or through the system proxy on macOS and Windows.
158
+ - **The backend uses neither Magpie's proxies (including the provider proxy set for `ai-studio`) nor `HTTPS_PROXY` and similar variables**: it keeps running after Magpie quits, when a proxy borrowed from Magpie may be gone. Use one of the options above. A backend started by a plugin version from before this fix may still be using a proxy from the environment it was started in (Magpie's, for example); the "代理出口" line marks it and says what a restart changes.
159
+ - The usage card's "代理出口" (proxy) line, the Google sign-in instructions and failure messages, and `npm run studio:status` show the proxy the backend actually uses, where it comes from, and whether a new setting still needs a restart.
160
+ - The listen address, API key and admin credentials are managed by the plugin; changing them in the admin page has no effect.
161
+ - **Gemini Web:** The backend ignores system proxies and `HTTP_PROXY`. Enter your proxy URL when prompted at the start of "One-click local setup", set the `proxy` plugin option or `GEMINI_WEB_PROXY` environment variable, or add it to the proxy pool in the local admin panel at `http://127.0.0.1:8083/admin` (password is `adminToken` in `secrets.json` inside the data directory).
162
+ - *Note:* When using a proxy pool, send one request with a newly added account so the backend binds it to a proxy, then re-add it via "Add an existing Google account from the local backend" to load its email and usage (SOCKS proxies are not supported for usage reads).
163
+
164
+ **Connecting a self-hosted backend:**
165
+ If you already run `gemini-web2api-go` or `AIStudio2API` yourself, select **Connect an existing backend / AIStudio2API** during sign-in and provide its `/v1` URL and API key.
166
+
167
+ **Refreshing the model list:**
168
+ After upgrading the plugin, run `magpie provider models gemini-web` to refresh available models.
169
+
170
+ </details>
171
+
172
+ <details>
173
+ <summary><b>🛠️ AI Studio CLI Commands</b> (service status, browser preparation, version management)</summary>
174
+
175
+ <br>
176
+
177
+ **When the local service starts and stops:**
178
+ - It starts in the background when the plugin loads (when Magpie opens, for example); after that, a request or a usage card refresh starts it again if it isn't running.
179
+ - It is a process of its own: **quitting Magpie doesn't stop it**, and Magpie picks it up again the next time it opens.
180
+ - To stop it, use `studio:stop` below (or the full command an error gives). A stop lasts until the next request, which starts it again.
181
+
182
+ When a plugin error asks you to run a command, it includes the full ready-to-copy path. From the plugin directory, you can also run:
183
+
184
+ | Command | Description |
185
+ | :--- | :--- |
186
+ | `npm run studio:status` | Show local service and account status |
187
+ | `npm run studio:start` / `studio:stop` | Start / stop the local service |
188
+ | `npm run studio:clean` | Clean downloaded programs in the default directory, keeping accounts/config; skipped for custom paths |
189
+ | `npm run studio:use -- <executable>` | Select an official or custom executable; stop the current service before switching |
190
+ | `npm run studio:use-default` | Return to the default directory; reuse its executable or install the official CLI if absent |
191
+ | `npm run studio:login` | Add a Google account |
192
+ | `npm run studio:prepare-browser` | Prepare the login browser before signing in; closing the command leaves the backend download running |
193
+ | `npm run studio:relogin -- [<account>]` | Re-authenticate an expired account (argument optional if only one) |
194
+ | `npm run studio:install -- [--version v0.3.7]` | Install the latest or specified official release after stopping; keep accounts and settings |
195
+ | `npm run studio:install -- --version v0.3.7 --archive <file>` | Install a local official archive; still fetch its checksum from GitHub |
196
+ | `npm run studio:official:smoke` | Check installation, account paths, connection and live file replacement in disposable data, without real Google credentials |
197
+ | `npm run studio:updates -- auto` / `manual` | Enable or disable automatic updates for the default backend; omit the argument to show the policy |
198
+ | `npm run studio:auto-update:smoke` | Verify background upgrades, retained data and executable rollback in a disposable directory |
199
+ | `npm run studio:update:smoke -- v0.3.6` | Explicitly update an isolated older official backend to the latest release and verify restart |
200
+ | `node scripts/studio.mjs import <dir>` | Import existing accounts while the service is stopped |
201
+ | `npm run studio:smoke` | Run a live acceptance check (consumes account quota) |
202
+
203
+ </details>
204
+
205
+ <details>
206
+ <summary><b>🔒 Security, Data Directories & Backend Version Management</b> (logs, rollback)</summary>
207
+
208
+ <br>
209
+
210
+ **Security & data directories:**
211
+ - Both backends listen on `127.0.0.1` only. Cookies and sessions remain on your machine; Magpie stores only a locally generated API key.
212
+ - **Gemini Web data directory:** `~/.local/share/magpie-gemini-web` (override with `GEMINI_WEB_DATA_DIR`), logs at `backend.log`. Supports macOS, Linux, and Windows (x64 / arm64).
213
+ - **AI Studio data directory:** `~/.local/share/magpie-ai-studio` (override with `AI_STUDIO_DATA_DIR`), logs at `backend.log` (rotated on next start after exceeding 10 MB). Uses port 2048 by default (or picks a free port and saves it in `config.json`). Supports macOS, Linux (x64 / arm64), and Windows x64.
214
+ - **Uninstalling & cleaning downloaded assets:** Removing the plugin in Magpie (or running `npm run studio:clean` / `npm run backend:clean`) stops plugin-managed services and removes their downloaded binaries and archives. **User-managed AIStudio2API processes, executables and data directories are preserved**, for the user to stop and clean.
215
+ - `auth/`, `gemini.db`, `config.json`, `.env`, and `secrets.json` are kept so reinstalling the plugin or sending a new request restores the backend on demand without signing in or importing cookies again; to prevent automatic reinstallation permanently, remove the sign-in in Magpie or delete `config.json` / `secrets.json`.
216
+ - Default data directories are shared per OS user; set separate `AI_STUDIO_DATA_DIR` and `GEMINI_WEB_DATA_DIR` when running multiple isolated Magpie config directories so removing the plugin in one does not clean another's shared binaries.
217
+ - Gemini Web takes at most 2 requests at once per sign-in (AI Studio 1), adjustable in Magpie's provider settings. Google account rate-limiting or flagging cannot be completely ruled out—use at your own risk.
218
+
219
+ **AI Studio upgrades and model selection:**
220
+ - Installation and automatic updates use the latest stable official release for macOS / Linux x64 or arm64, or Windows x64. Release metadata must identify the correct platform archive and SHA-256. Publishing the plugin does not require a custom backend build or pinned Studio artifacts.
221
+ - With 0.3.7+, `MAX_ACCOUNT_SWITCHES`, `DISCOVER_HIDDEN_MODELS`, account order, model bindings and all other valid `.env` keys are preserved. Explicit saved values remain in effect; omitted values use upstream defaults. The plugin no longer seeds fixed worker, hedge-request or generation-backend settings.
222
+ - The default executable is `package/aistudio2api` in the data directory, or `aistudio2api.exe` at its root on Windows. Older managed builds retain their accounts and data and can be automatically replaced with official packages. Historical builds and the 0.3.7 candidate patches remain documented in [docs/studio-release.md](docs/studio-release.md); they do not select the default install or update version.
223
+ - Stop discovers replacement PIDs and checks executable identity. Custom paths also check the account-directory argument to distinguish instances sharing a program. Unverified processes are never signaled; a live process with HTTP down blocks installation and duplicate startup.
224
+ - A missing default executable is installed automatically; an existing one is updated in the background when idle. A missing custom path produces an error. Executable rollback does not undo the backend's own data migrations. Back up the entire data directory, including `auth/` and `runtime/requests.db`, before a manual downgrade.
225
+ - The plugin's default response/stream-idle timeout is 30 minutes, adjustable with `studio.requestTimeoutMs`. Backend deadlines and concurrency follow its defaults or admin settings. Shorter limits can interrupt long replies; the selected backend controls automatic continuation deadlines.
226
+ - Source review of the locally installed Magpie `v0.1.1285` (`d783df46`) found no shorter fixed total timeout on this plugin's generation path: `Provider.Do → plugin.Fetch → loader.fetch` bypasses the ordinary HTTP transport's 10-minute response-header timeout. The gateway's 5-minute `IdleTimeout` applies between requests. Clients or reverse proxies can impose shorter limits; this was not a 30-minute end-to-end waiting test.
227
+ - `gemini-4-hydrogen` and `gemini-4-carbon` are supported through official v0.3.5–v0.3.8+ catalogs: `gemini-4-hydrogen`'s `extra_high` thinking level maps to Magpie's `xhigh` variant, while `gemini-4-carbon` appears when at least one signed-in account has an eligible tier (such as Google AI Ultra) and is omitted otherwise to avoid 403 errors (enable `DISCOVER_HIDDEN_MODELS` in the admin page to probe frontend-configured models not yet listed publicly).
228
+ - Deep Research models (`deep-research-preview-04-2026`, `deep-research-max-preview-04-2026`) are supported: listed when signed in with a Google AI Pro / Ultra account; the backend adapts asynchronous Interactions tasks onto `/v1/chat/completions` streaming (including reasoning and built-in server-side search), without client `tool_call` (Function Calling) or `temperature`.
229
+ - Models with `-build` or `assistant_route` are filtered out: they inject the Build coding assistant's own system prompt and are not offered as ordinary Agent models. Refresh with `magpie provider models ai-studio` after upgrading.
230
+
231
+ **Gemini Web optimized backend upgrades & rollback:**
232
+ - The missing multi-account index in [#53](https://github.com/dorokuma/magpie-gemini-web/issues/53) is fixed. Reimport affected cookies or correct the index in backend account management. A successful account check does not guarantee generation; signed-in `gemini-4-argon` hangs remain unresolved upstream (this build still uses StreamGenerate and logs that `web_channel` is ignored when enabled), so prefer `ai-studio` for Argon. Backend [`dorokuma/gemini-web2api-go` `v5.0.0`](https://github.com/dorokuma/gemini-web2api-go/releases/tag/v5.0.0) natively exposes dedicated `gemini-4-carbon` and `gemini-4-hydrogen` model IDs (including `-thinking` variants); its `strict_model` slot check mutually recognizes display-name upgrades/downgrades, so paid accounts whose `gemini-3.8-flash` calls are routed to `4 Hydrogen` are identified correctly instead of failing with `429 model_downgraded`.
233
+ - One-click setup pins the prebuilt [v5.0.0](https://github.com/dorokuma/gemini-web2api-go/releases/tag/v5.0.0) binaries from the backend repository by default (one repo, one artifact: six-platform SHA-256 pins live in `lib/backend-release.json`; the plugin no longer patches and rebuilds the backend). Chat requests are timed by silence: while Google queues a request it sends a heartbeat every 60 s, and the backend waits through it for the first words. A try is given up, and retried, only after Google has sent nothing for `request_timeout_sec` (180 s by default), so a long reply that keeps coming is never cut off either.
234
+ - **Upgrading:** Running backends are not interrupted automatically. Stop the existing process (PID in `backend.pid` inside the data directory); the next Magpie launch or request will upgrade the binary while preserving config and cookies.
235
+ - **Rollback to upstream / restore the pinned build** (run in the plugin directory after stopping the backend):
236
+ ```bash
237
+ npm run backend:install:upstream # Roll back and pin to upstream zexadev v4.28.0
238
+ npm run backend:install # Restore the default pinned v5.0.0
239
+ ```
240
+ - For pin sync, verification and smoke procedures, see [docs/backend-release.md](docs/backend-release.md).
241
+
242
+ </details>
243
+
244
+ ---
245
+
246
+ ## License
247
+
248
+ MIT. The upstream `gemini-web2api-go` project is also MIT (see `LICENSE-UPSTREAM`).
249
+
250
+ ---
251
+
252
+ ## Star History
253
+
254
+ <p align="center">
255
+ <a href="https://www.star-history.com/#dorokuma/magpie-gemini-web&amp;Date">
256
+ <picture>
257
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=dorokuma/magpie-gemini-web&amp;type=Date&amp;theme=dark" />
258
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=dorokuma/magpie-gemini-web&amp;type=Date" />
259
+ <img alt="GitHub star history for magpie-gemini-web" src="https://api.star-history.com/svg?repos=dorokuma/magpie-gemini-web&amp;type=Date" width="800" />
260
+ </picture>
261
+ </a>
262
+ </p>