Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ BUILD_NATIVE_NONSTREAM=true
# 提供 -build 对话模型;用过 -build 模型的账户曾被 Google 成批限制使用 AI Studio,关闭时这些模型不出现在 /v1/models,请求时返回已在设置中关闭的错误,保存后立即生效
BUILD_CHAT_MODELS=true

# -build 对话模型的上游协议:auto(默认,按账户页面启动数据标志 45831005 自动选择)、agency(新版 StreamRunAgentTask)或 legacy(旧版 CodeAssistantOffline),保存后下一次请求生效
BUILD_CHAT_PROTOCOL=auto

# 非流式请求等待超过 10 秒时先返回 200,之后每 10 秒写出一个换行,经反向代理时连接不会因长时间无数据断开
NONSTREAM_KEEPALIVE=true

Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
- **智能模型切换**: 从 AI Studio 实时发现模型并按 `model` 字段路由;开启 `DISCOVER_HIDDEN_MODELS` 后,AI Studio 官网尚未公开的模型在确认账户能用后也会加入模型列表;在“模型目录”中可逐个选择模型是否在 API 中显示
- **Google 工具**: 支持 Search、Image Search、URL Context、Code Execution 和 Maps
- **Files 与 Transcribe**: 支持文件上传、查询、内容读取、删除和音频转录
- **Live 与 Robotics**: 通过 WebSocket 支持文本、音频、JPEG、媒体结束、工具调用、恢复和中断
- **Live 与 Robotics**: 通过 WebSocket 支持文本、音频、JPEG、媒体结束、工具调用、恢复和中断;Google Gen AI SDK 的 Live 客户端可直接连接
- **反指纹检测**: 为每个账户固定 Firefox 指纹与出口,官方 WAA 在 SpiderMonkey 的 Firefox 页面环境或 Camoufox 页面中运行
- **图形界面启动器**: 通过网页管理账户、服务启停、实时日志、模型、请求、用量统计(用过多把 API key 时可按 key 拆分)、按模型与账户查看的号池额度和配置,界面提供深色与浅色两种配色,以及简体中文、繁體中文、English、日本語、한국어、Français 与 Deutsch 七种语言
- **桌面版**: Windows、macOS 与 Linux 桌面应用在窗口中显示管理页面,关闭窗口后在系统托盘继续运行
Expand Down Expand Up @@ -428,6 +428,7 @@ agy
| 视频 | `POST /v1/videos`、`GET /v1/videos`、`GET`/`DELETE /v1/videos/{id}`、`GET /v1/videos/{id}/content` |
| Gemini 视频 | `POST /v1beta/models/{model}:predictLongRunning`、`GET /v1beta/operations/{id}` |
| Live(含实时翻译、实时转录与实时音乐)/ Robotics | `GET /v1/live`、`GET /v1/robotics/stream` |
| Gemini Live(Google Gen AI SDK) | `GET /ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent`,`v1alpha` 与 `v1` 同样可用 |

Gemini 的 `/v1beta` 路径在 `/v1` 下同样可用,Google Gen AI SDK 3.x 默认使用 `/v1`。`/v1/models` 与 `/v1/files` 的请求带 `x-goog-api-key` 请求头或 `key` 参数且不带 `Authorization` 时按 Gemini 格式返回,其余按 OpenAI 格式返回。

Expand Down Expand Up @@ -506,7 +507,7 @@ curl http://127.0.0.1:2048/v1beta/models/gemini-2.5-flash-preview-tts:generateCo
- 可用语音由实时模型目录中的 `capability_options.voices` 返回
- `gemini-3.8-flash-tts` 等带 `speech_metadata` 能力的模型同样接受上面的 `说话人: 台词` 写法,也可以为每个文本 part 设置 `speechMetadata.speaker` 与 `speechMetadata.style`,并用 `multiSpeakerVoiceConfig.mode` 选择 `VERBATIM` 或 `CONVERSATIONAL`
- OpenAI `instructions` 在这些模型上作为语音风格
- 自定义声音(Voice Design):`POST /v1beta/voices` 以 `{"voice":{"type":"prompted","display_name":"Old Sailor","prompted":{"input":"<声音描述>"}}}` 创建,返回 `voice_...` ID 与试听音频,之后在任一协议的声音参数中填这个 ID;服务按描述挑选最接近的预置音色,生成时把描述作为风格提示。API 试用页的语音页「新建声音」提供同样的流程
- 自定义声音(Voice Design):`POST /v1beta/voices` 以 `{"voice":{"type":"prompted","display_name":"Old Sailor","prompted":{"input":"<声音描述>"}}}` 创建,返回 `voice_...` ID 与试听音频,之后在任一协议的声音参数中填这个 ID;服务按描述挑选最接近的预置音色,生成时把描述作为风格提示。API 试用页的语音页「新建声音」提供同样的流程,并提供改写描述、以已有声音为基础改编(Remix)与录音复刻(Voice Replication)

### 图片生成 (Nano Banana)

Expand Down Expand Up @@ -598,9 +599,9 @@ curl http://127.0.0.1:2048/v1beta/decisions \
| `gemini-3.8-live` | Gemini 3.8 Live | 实时对话 | 131072 | 65536 |
| `gemini-3.5-live-translate-preview` | Gemini 3.5 Live Translate Preview | 实时翻译 | 16384 | 32768 |

目录中另有 `-latest` 别名、Robotics-ER、Gemini 3 系列与早期版本的图片、TTS、Live 模型,各文本与图片模型带 Google 搜索的 `-search` 变体,以及 Build 通道的 `-build` 模型。Genie 4(`genie-4`)只对开通计费的 API key 开放,列在目录中、不含 `channels`。
目录中另有 `-latest` 别名、Robotics-ER、Gemini 3 系列与早期版本的图片、TTS、Live 模型,各文本与图片模型带 Google 搜索的 `-search` 变体,以及 Build 通道的 `-build` 模型。只对付费 API key 开放的模型(如 Genie 4,`genie-4`)本服务调用不了,管理端模型目录标注“仅限付费 API key”,公开目录不列出。

公开端点实现标准 `generateContent`、`countTokens`、`embedContent`、`batchEmbedContents`、`predictLongRunning` 和 `createDecision`(`/v1beta/decisions`);`bidiGenerateContent` 与 `bidiGenerateMusic` 模型经 `/v1/live` 调用。`/v1/models` 与 `/v1beta/models` 原样汇总各账户实时上游目录;调度按目录明确提供的模型 ID、方法、能力字段和账户当前运行状态选择账户。
公开端点实现标准 `generateContent`、`countTokens`、`embedContent`、`batchEmbedContents`、`predictLongRunning` 和 `createDecision`(`/v1beta/decisions`);`bidiGenerateContent` 模型经 `/v1/live` 或标准 Live 端点调用,`bidiGenerateMusic` 模型经 `/v1/live` 调用。`/v1/models` 与 `/v1beta/models` 原样汇总各账户实时上游目录中本服务调用得了的模型;调度按目录明确提供的模型 ID、方法、能力字段和账户当前运行状态选择账户。

- 启用账户的订阅都不满足的模型(如只对 Google AI Ultra 开放的模型)同样列在目录中、不含 `channels`,调用时返回 403 并写明所需订阅
- 能力含 `output_continuation` 的模型(如 Gemini 4 Argon)与官网一样接受到 `input_token_limit` 的输出上限:未指定输出上限时取 `input_token_limit`,超过 32768 时分轮自动续写,各轮输出合并为一个响应
Expand Down Expand Up @@ -693,6 +694,7 @@ cp .env.example .env
| `GENERATE_CONTENT_ACCOUNTS` | 空 | 被 Google 迁到任务接口的模型在这些账户上改用 GenerateContent 发送,账户 ID 逗号分隔;请求方式与官网不同,可能触发 Google 风控;保存后立即生效 |
| `BUILD_NATIVE_NONSTREAM` | `true` | 启用 Build 通道时非流式请求优先使用 Build 原生单次调用;不可用时回退流式并记录原因 |
| `BUILD_CHAT_MODELS` | `true` | 提供 `-build` 对话模型;关闭时这些模型不出现在 `/v1/models`,请求时返回已在设置中关闭的错误;保存后立即生效 |
| `BUILD_CHAT_PROTOCOL` | `auto` | `-build` 对话模型使用的上游协议:`auto` 按账户页面启动数据标志 `45831005` 自适应选择,`agency` 固定走新版 `StreamRunAgentTask`,`legacy` 固定走旧版 `CodeAssistantOffline`;保存后下一次请求生效 |
| `NONSTREAM_KEEPALIVE` | `true` | 非流式请求等待结果超过 10 秒时先返回 200 并定时写出换行保持连接 |
| `FAKE_STREAM` | `false` | 流式请求先按非流式取得完整结果再按流式格式输出,中途失败时换号重发,等待期间照常发送心跳 |
| `YOUTUBE_LINKS` | `false` | 用户消息文本中的 YouTube 链接作为视频发送给模型,并从文本中移除 |
Expand Down
10 changes: 6 additions & 4 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The three projects connect to AI Studio, the Gemini web app and Antigravity, and
- **Smart Model Switching**: Discover models from AI Studio and route through the `model` field; with `DISCOVER_HIDDEN_MODELS` enabled, models that AI Studio hasn't made public yet are added to the model list once the account is confirmed to be able to use them; the Model catalog page chooses per model whether it is shown in the API
- **Google Tools**: Search, Image Search, URL Context, Code Execution, and Maps
- **Files and Transcribe**: File upload, metadata, content, deletion, and audio transcription
- **Live and Robotics**: WebSocket text, audio, JPEG images, media end, tool calls, resumption, and interruption
- **Live and Robotics**: WebSocket text, audio, JPEG images, media end, tool calls, resumption, and interruption; Live clients of the Google Gen AI SDKs connect directly
- **Anti-Fingerprinting**: Each account keeps a stable Firefox fingerprint and network exit, and the official WAA runs in the Firefox page environment of SpiderMonkey or in a Camoufox page
- **GUI Launcher**: Manage accounts, service controls, live logs, models, requests, usage statistics (broken down by API key once several keys are in use), account pool quota by model and by account, and configuration in the web UI, with dark and light color themes and seven languages: 简体中文, 繁體中文, English, 日本語, 한국어, Français, and Deutsch
- **Desktop App**: Windows, macOS, and Linux desktop apps show the management UI in a window and keep running in the system tray after the window is closed
Expand Down Expand Up @@ -428,6 +428,7 @@ Main endpoints:
| Video | `POST /v1/videos`, `GET /v1/videos`, `GET`/`DELETE /v1/videos/{id}`, `GET /v1/videos/{id}/content` |
| Gemini Video | `POST /v1beta/models/{model}:predictLongRunning`, `GET /v1beta/operations/{id}` |
| Live (including live translation, live transcription, and live music) / Robotics | `GET /v1/live`, `GET /v1/robotics/stream` |
| Gemini Live (Google Gen AI SDKs) | `GET /ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent`; `v1alpha` and `v1` also work |

The Gemini `/v1beta` paths are also available under `/v1`, which Google Gen AI SDK 3.x uses by default. Requests to `/v1/models` and `/v1/files` that carry an `x-goog-api-key` header or a `key` parameter without `Authorization` get Gemini responses; all others get OpenAI responses.

Expand Down Expand Up @@ -506,7 +507,7 @@ curl http://127.0.0.1:2048/v1beta/models/gemini-2.5-flash-preview-tts:generateCo
- Available voices are returned by `capability_options.voices` in the live model catalog
- Models with the `speech_metadata` capability, such as `gemini-3.8-flash-tts`, accept the same `Speaker: line` script; each text part can also set `speechMetadata.speaker` and `speechMetadata.style`, with `multiSpeakerVoiceConfig.mode` selecting `VERBATIM` or `CONVERSATIONAL`
- OpenAI `instructions` become the speech style on these models
- Custom voices (Voice Design): create one with `POST /v1beta/voices` and `{"voice":{"type":"prompted","display_name":"Old Sailor","prompted":{"input":"<voice description>"}}}`; the response carries a `voice_...` ID and a preview clip, and the ID works in the voice field of every protocol. The service picks the closest prebuilt voice for the description and sends the description as a speaking style. "New voice" on the playground speech page runs the same flow
- Custom voices (Voice Design): create one with `POST /v1beta/voices` and `{"voice":{"type":"prompted","display_name":"Old Sailor","prompted":{"input":"<voice description>"}}}`; the response carries a `voice_...` ID and a preview clip, and the ID works in the voice field of every protocol. The service picks the closest prebuilt voice for the description and sends the description as a speaking style. "New voice" on the playground speech page runs the same flow, with prompt improvement, remixing an existing voice and voice replication from a recording

### Image Generation (Nano Banana)

Expand Down Expand Up @@ -598,9 +599,9 @@ The model catalog follows AI Studio updates; clients read the current values fro
| `gemini-3.8-live` | Gemini 3.8 Live | Live | 131072 | 65536 |
| `gemini-3.5-live-translate-preview` | Gemini 3.5 Live Translate Preview | Live translation | 16384 | 32768 |

The catalog also includes `-latest` aliases, Robotics-ER, the Gemini 3 series, earlier image, TTS, and Live models, `-search` variants of text and image models with Google Search turned on, and the Build channel's `-build` models. Genie 4 (`genie-4`) is open only to API keys with billing enabled; it is listed without `channels`.
The catalog also includes `-latest` aliases, Robotics-ER, the Gemini 3 series, earlier image, TTS, and Live models, `-search` variants of text and image models with Google Search turned on, and the Build channel's `-build` models. Models open only to paid API keys (such as Genie 4, `genie-4`) cannot be called by this service; the admin model catalog marks them "Paid API key only" and the public catalog does not list them.

Public endpoints implement `generateContent`, `countTokens`, `embedContent`, `batchEmbedContents`, `predictLongRunning`, and `createDecision` (`/v1beta/decisions`); `bidiGenerateContent` and `bidiGenerateMusic` models are called through `/v1/live`. `/v1/models` and `/v1beta/models` preserve the live upstream catalogs across accounts; scheduling uses explicit model ID, method, and capability fields plus current account runtime state.
Public endpoints implement `generateContent`, `countTokens`, `embedContent`, `batchEmbedContents`, `predictLongRunning`, and `createDecision` (`/v1beta/decisions`); `bidiGenerateContent` models are called through `/v1/live` or the standard Live endpoint, and `bidiGenerateMusic` models through `/v1/live`. `/v1/models` and `/v1beta/models` preserve the callable models of the live upstream catalogs across accounts; scheduling uses explicit model ID, method, and capability fields plus current account runtime state.

- Models that no enabled account's subscription covers (such as models open only to Google AI Ultra) are still listed without `channels`, and calls return 403 naming the required subscription
- Models with the `output_continuation` capability (such as Gemini 4 Argon) accept an output limit up to `input_token_limit`, as on the official site: they use `input_token_limit` when the request sets no output limit, and beyond 32768 tokens the response continues automatically in multiple rounds and is returned as one response
Expand Down Expand Up @@ -693,6 +694,7 @@ Process environment variables override the same keys in `.env`, and those settin
| `GENERATE_CONTENT_ACCOUNTS` | empty | Account IDs, comma-separated, that send models Google moved to the task API via GenerateContent instead; this differs from AI Studio and may trigger Google's risk controls; applied on save |
| `BUILD_NATIVE_NONSTREAM` | `true` | With the Build channel enabled, prefer native Build unary calls for non-streaming requests; log any fallback to stream collection |
| `BUILD_CHAT_MODELS` | `true` | Offer the `-build` chat models; when off they are left out of `/v1/models` and requests return an error saying they are turned off in settings; applied on save |
| `BUILD_CHAT_PROTOCOL` | `auto` | Upstream protocol for the `-build` chat models: `auto` follows flag `45831005` in the account's page bootstrap data, `agency` always uses the new `StreamRunAgentTask`, `legacy` always uses the old `CodeAssistantOffline`; applied to the next request after saving |
| `NONSTREAM_KEEPALIVE` | `true` | When a non-streaming request waits longer than 10 seconds, return 200 first and keep the connection open with periodic newlines |
| `FAKE_STREAM` | `false` | Streaming requests get the full result as a non-streaming generation, retry on another account if it fails midway, then stream it in the protocol format; heartbeats continue while waiting |
| `YOUTUBE_LINKS` | `false` | Send YouTube links in user message text to the model as video and remove them from the text |
Expand Down
Loading