Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PROXY=
# 单账户初始化超时
INIT_TIMEOUT=2m

# 普通请求最大执行时间
# 上游连续没有数据的最长时间,从请求开始到首个数据同样计入
REQUEST_TIMEOUT=30m

# 常驻预热账户数,未设置时 SpiderMonkey 后端为 10、Camoufox 后端为 5
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,13 @@ curl http://127.0.0.1:2048/v1/chat/completions \
4. API 密钥填写 `.env` 中的 `PROXY_API_KEY`
5. 从 `/v1/models` 获取模型,或手动添加 `gemini-3.8-flash`、`gemini-3.5-flash-lite`

[Claude Code](https://github.com/anthropics/claude-code) 使用 Anthropic 接口,子 Agent 按 opus、sonnet、haiku 档位选择模型,以下变量把它们映射到 AI Studio 模型;WebSearch 由 Google Search 执行:
[Claude Code](https://github.com/anthropics/claude-code) 使用 Anthropic 接口,子 Agent 按 fable、opus、sonnet、haiku 档位选择模型,以下变量把它们映射到 AI Studio 模型;WebSearch 由 Google Search 执行:

```powershell
$env:ANTHROPIC_BASE_URL = "http://127.0.0.1:2048"
$env:ANTHROPIC_API_KEY = "<PROXY_API_KEY>"
$env:ANTHROPIC_MODEL = "gemini-3.8-flash"
$env:ANTHROPIC_DEFAULT_FABLE_MODEL = "gemini-4-argon"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "gemini-3.1-pro-preview"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "gemini-3.8-flash"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "gemini-3.5-flash-lite"
Expand Down Expand Up @@ -672,7 +673,7 @@ cp .env.example .env
| `ADMIN_PASSWORD` | 空 | 管理员密码,开启登录时必填 |
| `PROXY` | 空 | Chrome 导入、登录和账户默认使用的 HTTP、HTTPS 或 SOCKS5 代理,多个代理用逗号分隔组成代理池;留空时使用系统代理 |
| `INIT_TIMEOUT` | `2m` | 单账户 WAA 初始化超时 |
| `REQUEST_TIMEOUT` | `30m` | 单次请求最大执行时间,自动续写的每一轮开始时重新计时 |
| `REQUEST_TIMEOUT` | `30m` | 上游连续没有数据的最长时间,从请求开始到首个数据同样计入;上游仍在输出的请求不受总时长限制 |
| `WARM_WORKER_LIMIT` | `10`,Camoufox 后端 `5` | 常驻预热账户数 |
| `MAX_ACTIVE_WORKERS` | `20`,Camoufox 后端 `10` | 高峰期最多同时运行的 Worker 数 |
| `WARM_STARTUP_CONCURRENCY` | `5` | 按需扩容时同时冷启动的 Camoufox Worker 数,预热逐个启动;`WAA_BACKEND=spidermonkey` 时不限制 |
Expand Down Expand Up @@ -806,7 +807,7 @@ API 试用页的 HTML 预览运行在 `PREVIEW_LISTEN_ADDR` 提供的独立来

权益与模型目录的读取:

- “刷新全部”立即读取全部启用账户的权益与模型目录,后台每 24 小时也会读取一次;请求的模型不在目录中且距上次读取超过 10 分钟时,服务先读取一次再处理该请求
- “刷新全部”立即读取全部启用账户的权益与模型目录,在服务端运行,关闭或刷新管理页后继续,重新打开时显示进度与排队的账户;后台每 24 小时也会读取一次;请求的模型不在目录中且距上次读取超过 10 分钟时,服务先读取一次再处理该请求
- 从未读取成功的账户权益显示为未知,并显示最近一次失败原因;已有目录的账户读取失败时照常使用,账户行显示“目录同步失败”与原因
- 读取报告 AI Studio 不支持当前出口地区时,已有目录的账户同样显示该原因

Expand Down
7 changes: 4 additions & 3 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,13 @@ For Cherry Studio:
4. Set the API key to `PROXY_API_KEY` from `.env`
5. Load models from `/v1/models`, or add `gemini-3.8-flash` and `gemini-3.5-flash-lite` manually

[Claude Code](https://github.com/anthropics/claude-code) uses the Anthropic endpoint. Subagents pick models by the opus, sonnet, and haiku tiers; the variables below map them to AI Studio models. WebSearch runs on Google Search:
[Claude Code](https://github.com/anthropics/claude-code) uses the Anthropic endpoint. Subagents pick models by the fable, opus, sonnet, and haiku tiers; the variables below map them to AI Studio models. WebSearch runs on Google Search:

```powershell
$env:ANTHROPIC_BASE_URL = "http://127.0.0.1:2048"
$env:ANTHROPIC_API_KEY = "<PROXY_API_KEY>"
$env:ANTHROPIC_MODEL = "gemini-3.8-flash"
$env:ANTHROPIC_DEFAULT_FABLE_MODEL = "gemini-4-argon"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "gemini-3.1-pro-preview"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "gemini-3.8-flash"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "gemini-3.5-flash-lite"
Expand Down Expand Up @@ -672,7 +673,7 @@ Process environment variables override the same keys in `.env`, and those settin
| `ADMIN_PASSWORD` | empty | Administrator password, required when login is enabled |
| `PROXY` | empty | HTTP, HTTPS, or SOCKS5 proxy used by Chrome import, login, and accounts without an override; separate several proxies with commas to form a proxy pool; the system proxy is used when empty |
| `INIT_TIMEOUT` | `2m` | Per-account WAA initialization timeout |
| `REQUEST_TIMEOUT` | `30m` | Maximum request execution time, restarted at the start of each auto-continuation round |
| `REQUEST_TIMEOUT` | `30m` | Longest time upstream may send no data, counted from the start of the request until the first data too; requests that upstream is still streaming have no total time limit |
| `WARM_WORKER_LIMIT` | `10`, `5` with Camoufox | Number of resident prewarmed accounts |
| `MAX_ACTIVE_WORKERS` | `20`, `10` with Camoufox | Maximum workers active during peak load |
| `WARM_STARTUP_CONCURRENCY` | `5` | Camoufox workers cold-started concurrently during on-demand scaling; prewarming starts workers one at a time; unlimited with `WAA_BACKEND=spidermonkey` |
Expand Down Expand Up @@ -805,7 +806,7 @@ Account actions depend on state. Click the state in an account row to set the ac

Reading the benefit tier and model catalog:

- Refresh all reads the benefit tier and model catalog of every enabled account immediately; the service also reads them every 24 hours, and when a request names a model missing from the catalog and the last read was more than 10 minutes ago, the service reads them first and then handles the request
- Refresh all reads the benefit tier and model catalog of every enabled account immediately; it runs on the server and keeps going after the console is closed or reloaded, and reopening the console shows its progress and the queued accounts; the service also reads them every 24 hours, and when a request names a model missing from the catalog and the last read was more than 10 minutes ago, the service reads them first and then handles the request
- An account whose catalog has never been read shows an unknown tier and the reason for the last failed read; an account with an existing catalog keeps working when a read fails, and its row shows "Model sync failed" with the reason
- When a read reports that AI Studio does not support the current egress region, accounts with an existing catalog show that reason as well

Expand Down
6 changes: 3 additions & 3 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ Camoufox 运行中与服务的 WebDriver BiDi 连接断开时,服务最多等
| `ADMIN_PASSWORD` | 管理员密码 | 空 |
| `PROXY` | 全局出口代理或代理池 | 空 |
| `INIT_TIMEOUT` | 单账户初始化超时 | `2m` |
| `REQUEST_TIMEOUT` | 单次请求最大执行时间 | `30m` |
| `REQUEST_TIMEOUT` | 上游连续没有数据的最长时间 | `30m` |
| `WARM_WORKER_LIMIT` | 常驻预热账户数 | `10`,Camoufox 后端 `5` |
| `MAX_ACTIVE_WORKERS` | 活动 Worker 容量上限 | `20`,Camoufox 后端 `10` |
| `WARM_STARTUP_CONCURRENCY` | 同时冷启动的 Camoufox Worker 数 | `5` |
Expand Down Expand Up @@ -373,7 +373,7 @@ Camoufox 运行中与服务的 WebDriver BiDi 连接断开时,服务最多等
- `LOG_MAX_TOTAL_MB`:超出时删除最旧的文件,不小于 20;保存后立即生效
- `ADMIN_PASSWORD`:开启登录时必填
- `PROXY`:setup 与未设置账户代理时使用的出口,多个代理用逗号分隔组成代理池;留空时生成服务使用系统代理
- `REQUEST_TIMEOUT`:自动续写的每一轮开始时重新计时
- `REQUEST_TIMEOUT`:从请求开始计时,每收到一次上游数据重新计时,上游仍在输出的请求不受总时长限制
- `MAX_ACTIVE_WORKERS`:必须不小于热池目标
- `WARM_STARTUP_CONCURRENCY`:限制按需扩容时的冷启动数,预热逐个启动;`WAA_BACKEND=spidermonkey` 时不限制
- `ROUTING_STRATEGY`:账户轮询 `round-robin` 或粘性优先 `fill-first`
Expand Down Expand Up @@ -730,7 +730,7 @@ Worker 容量由热池目标、活动上限和单账户并发共同约束。
| 健康与状态 | `GET /health`、`GET /api/status` |
| 模型与账户 | `GET /api/models`、`GET/POST /api/accounts`、`GET /api/accounts/exits`、`GET/POST /api/accounts/import/chrome`、`GET /api/accounts/import/browsers`、`POST /api/accounts/import/cookies/discover`、`POST /api/accounts/import/cookies`、`PUT/DELETE /api/accounts/{id}`、`PUT /api/accounts/{id}/state` |
| 账户任务 | `GET /api/accounts/tasks`、`DELETE /api/accounts/tasks/{id}` |
| 登录与刷新 | `POST /api/accounts/{id}/login`、`POST /api/accounts/{id}/refresh`、`GET /api/login-view/{view}`(WebSocket) |
| 登录与刷新 | `POST /api/accounts/{id}/login`、`POST /api/accounts/{id}/refresh`、`POST /api/accounts/refresh`、`GET /api/login-view/{view}`(WebSocket) |
| 远程配对 | `GET /api/pairing`、`POST /api/pairing`、`POST /api/pairing/accounts`、`PUT /api/pairing/accounts/{account}/cookies` |
| 生成服务 | `POST /api/control/start`、`POST /api/control/stop` |
| 配置 | `GET /api/config`、`PUT /api/config`、`GET /api/paths?path=`(列出服务所在机器的目录与账户状态文件 `storage-state.json`,`path=roots` 列出文件系统根)、`POST /api/paths/pick?path=`(桌面版以系统对话框选择账户目录) |
Expand Down
7 changes: 4 additions & 3 deletions docs/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

`INFO` 记录状态推进和完成结果,`WARN` 记录等待、切换与客户端取消,`ERROR` 记录失败结果。管理页面支持按级别、来源、消息、阶段名、字段名与字段取值筛选,日志正文可以选择和横向滚动。

页面每行的消息列依次为展开箭头、状态位、标题与字段、行尾耗时,各行标题左缘对齐:请求的状态位为 HTTP 状态,阶段为进度或结束状态图标,单条运行事件为中性圆点;字段 `duration` 显示在行尾。
页面每行的消息列依次为展开箭头、状态标签、标题与字段、行尾耗时,各行标题左缘对齐:请求的状态标签为 HTTP 状态或“处理中”,阶段为进度或结束状态名,单条运行事件没有状态标签;字段 `duration` 显示在行尾。展开的详情从行首开始。

带 `stage` 的运行事件在页面上按来源与阶段名合并为一张卡片,显示阶段名、当前进度 `step/steps` 与最新一步的消息和字段。带 `state` 的事件结束同一来源进行中的卡片并显示结束状态,没有进行中的卡片时自成一张已结束的卡片;步骤号不大于当前步骤时另起一张卡片。卡片位于首条消息的时间位置,展开详情可查看每一步的时间、消息与字段;级别、来源和文本筛选在任一步命中时显示该卡片。

Expand Down Expand Up @@ -214,6 +214,7 @@ ERROR account@example.com [WAA Worker 停止 failed] WAA Worker 停止失败 p
- 展开详情可查看接口、输入用量、原始终止原因、事件时间线与 JSON
- 时间线中每次换号为一行,显示账户、上游状态、按状态归类的原因与上游原文,点击展开该账户的全部事件;请求的来源按换号顺序写成 `A → B`,上游要求验证账户的 403 归为“需要验证账户”,跳转到拒绝页的归为“服务受限”
- 连续的同类进度事件合为一行并标出次数,悬停次数查看每一次的时刻与字段
- 时间线每步一行,依次为时刻、消息与耗时(`duration` 或 `waited`),其余字段在下方按名称与取值对齐;`等待模型继续输出` 与随后的 `模型继续输出` 合为一行“停顿 N 后继续”;`rpc`、`mode`、`network_bytes`、`network_idle`、`reasoning_events`、`text_events`、`last_event`、`current_event` 以及与卡片相同的模型和通道只在 JSON 中

```text
22:11:47 200 gemini-3.8-flash 换号 5 403 ×3 429 ×2 4.76 s 工具调用 1
Expand Down Expand Up @@ -253,11 +254,11 @@ ERROR account@example.com [WAA Worker 停止 failed] WAA Worker 停止失败 p

客户端取消记录为 `499`;认证、额度和上游失败分别使用对应 HTTP 状态与 `request.error`。

管理端取消活动请求或停止生成服务时,仍连接的客户端按公开协议收到 `503 request_canceled` 或对应的流式 error event。
管理端取消活动请求时,仍连接的客户端按公开协议收到 `503 request_canceled` 或对应的流式 error event;停止生成服务时收到 `503 service_stopped`,错误消息写明生成服务已停止。

## 流式等待

连续 15 秒没有阶段进展时会写入诊断日志。请求在收到上游终态、客户端取消或达到 `REQUEST_TIMEOUT` 时结束。
连续 15 秒没有阶段进展时会写入诊断日志。请求在收到上游终态、客户端取消或上游连续 `REQUEST_TIMEOUT` 没有数据时结束。流在完成前中断或上游异常结束而重新生成时,记一条“重新生成”,`attempt` 为第几次,`reason` 为中断错误或结束原因。

| 事件 | 当前停留位置 | 重点字段 |
| --- | --- | --- |
Expand Down
Loading