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
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
- **图片生成**: 支持 Nano Banana 图片生成
- **视频生成**: 视频长任务与图片转视频由 Gemini Omni 生成;Gemini Omni 通过四套生成接口接收文本、图片与视频输入,输出文本与 MP4 视频
- **Deep Research**: Pro 与 Ultra 账户可通过四套生成接口与 Interactions 的 `agent` 字段调用 Deep Research,输出研究过程、带引用的报告与图表
- **决策模型**: `gemini-decision-1` 经 `/v1beta/decisions` 对同一份输入一次回答多个是非、单选与评分问题,返回校准后的概率与置信度;输入可以是文本、图片、音频、视频与 PDF,只计输入 token
- **YouTube 输入**: YouTube 视频 URL 作为外部视频附件读取;开启 `YOUTUBE_LINKS` 后,消息文本中的 YouTube 链接同样作为视频读取
- **视频理解设置**: Gemini 与 Interactions 支持逐视频的起止时间、0–24 FPS 范围内的正数采样率和静态/Agentic 处理;Agentic 返回服务端处理步骤并支持历史续接
- **智能模型切换**: 从 AI Studio 实时发现模型并按 `model` 字段路由
Expand Down Expand Up @@ -343,7 +344,7 @@ curl http://127.0.0.1:2048/v1/chat/completions \
| Anthropic Messages | `http://127.0.0.1:2048` | `.env` 中的 `PROXY_API_KEY` |
| Gemini | `http://127.0.0.1:2048` | `.env` 中的 `PROXY_API_KEY` |

模型名称从 `GET /v1/models` 或 `GET /v1beta/models` 读取。`PROXY_API_KEY` 为空时,浏览器中只有本机页面可以直接调用接口;网页版客户端和部分桌面客户端需要设置 `PROXY_API_KEY`。多个 key 用逗号分隔,任一 key 都可调用;设置页可为每个 key 勾选处理其请求的账户。
模型名称从 `GET /v1/models` 或 `GET /v1beta/models` 读取。`PROXY_API_KEY` 为空时,浏览器中只有本机页面可以直接调用接口;网页版客户端和部分桌面客户端需要设置 `PROXY_API_KEY`。多个 key 用逗号分隔,任一 key 都可调用;设置页可为每个 key 勾选处理其请求的账户。请求带 `X-AIStudio-Account: <账户>` 请求头时只由该账户处理,账户填账户页显示的邮箱;该账户出错时直接返回它的错误,不换到其他账户。

以 Cherry Studio 为例:

Expand Down Expand Up @@ -510,6 +511,28 @@ curl http://127.0.0.1:2048/v1/videos \

创建任务后通过 `GET /v1/videos/{id}` 查询状态,通过 `GET /v1/videos/{id}/content` 下载结果;`gemini-omni-1.1-flash` 等能输出视频的 Omni 模型同样经 `:predictLongRunning` 创建任务。

### 决策 (Gemini Decision)

```bash
curl http://127.0.0.1:2048/v1beta/decisions \
-H "x-goog-api-key: 123" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-decision-1",
"input": "I was charged twice for my order.",
"questions": {
"is_refund": {"type": "noul", "instructions": "Is the customer asking for money back?"},
"department": {
"type": "choice",
"instructions": "Which department should handle this request?",
"criteria": {"billing": "Payments and refunds.", "shipping": "Delivery and tracking.", "other": ""}
}
}
}'
```

`questions` 的键由调用方命名,回答按同样的键返回。`noul` 返回为真的概率 `noul`,`criteria` 可写 `true_description` 与 `false_description`;`choice` 的 `criteria` 为选项 ID 到说明,返回 `choice` 与各选项的 `probabilities`;`score` 的 `criteria` 为从低到高的等级说明,返回期望等级 `score`、各等级的 `probabilities` 与 `legend`。每个回答都带 `confidence`。`input` 接受字符串或 Interactions 内容块,图片、音频、视频与 PDF 以 `data`(Base64)或 `uri`(HTTPS 链接或本服务 Files API 的文件)给出并写明 `mime_type`。Google Gen AI SDK 以 `client.decisions.create` 调用。

## 模型

模型目录会随 AI Studio 更新,客户端从 `/v1/models` 或 `/v1beta/models` 读取当前值。下表为目录中的常用模型,模型 ID 与上限以运行时结果为准:
Expand All @@ -526,6 +549,7 @@ curl http://127.0.0.1:2048/v1/videos \
| `gemma-4-31b-it` | Gemma 4 31B IT | 文本 | 262144 | 32768 |
| `gemini-omni-1.1-flash` | Gemini Omni 1.1 Flash | 文本与视频 | 131072 | 65536 |
| `deep-research-preview-04-2026` | Deep Research Preview | 深度研究 | 131072 | 65536 |
| `gemini-decision-1` | Gemini Decision 1 | 决策 | 262144 | 0 |
| `gemini-nano-banana-2.1` | Nano Banana 2.1 | 图片 | 65536 | 65536 |
| `gemini-3.1-flash-image` | Nano Banana 2 | 图片 | 65536 | 65536 |
| `gemini-3.1-flash-lite-image` | Nano Banana 2 Lite | 图片 | 65536 | 65536 |
Expand All @@ -540,7 +564,7 @@ curl http://127.0.0.1:2048/v1/videos \

目录中另有 `-latest` 别名、Robotics-ER、早期版本的图片与 TTS 模型,以及 Build 通道的 `-build` 模型。

公开端点实现标准 `generateContent`、`countTokens`、`embedContent`、`batchEmbedContents` 和 `predictLongRunning`;`bidiGenerateContent` 与 `bidiGenerateMusic` 模型经 `/v1/live` 调用。`/v1/models` 与 `/v1beta/models` 原样汇总各账户实时上游目录;调度按目录明确提供的模型 ID、方法、能力字段和账户当前运行状态选择账户。
公开端点实现标准 `generateContent`、`countTokens`、`embedContent`、`batchEmbedContents`、`predictLongRunning` 和 `createDecision`(`/v1beta/decisions`);`bidiGenerateContent` 与 `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 时分轮自动续写,各轮输出合并为一个响应。模型名可以带思考后缀,例如 `gemini-4-argon(low)`:括号内为 `none`、`minimal`、`low`、`medium`、`high`、`xhigh`、`max`、`auto` 或思考预算 token 数,后缀优先于请求体中的思考参数。客户端写死的模型名可用 `MODEL_MAPPING` 映射到目录中的模型,例如 `MODEL_MAPPING=claude-haiku-5-5:gemini-3.8-flash`,别名以目标模型的字段列在模型目录中。

Expand Down
28 changes: 26 additions & 2 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The three projects connect to AI Studio, the Gemini web app and Antigravity, and
- **Image Generation**: Nano Banana image generation
- **Video Generation**: Gemini Omni generates video tasks and image-to-video; Gemini Omni accepts text, image, and video input and returns text and MP4 video through the four generation APIs
- **Deep Research**: Pro and Ultra accounts can run Deep Research through the four generation APIs and the Interactions `agent` field, returning the research process, a cited report, and charts
- **Decision Model**: `gemini-decision-1` answers many yes/no, choice, and score questions about one shared input in a single call to `/v1beta/decisions`, returning calibrated probabilities and confidence; input can be text, images, audio, video, and PDF, and only input tokens are billed
- **YouTube Input**: YouTube video URLs are read as external video attachments; with `YOUTUBE_LINKS` enabled, YouTube links in message text are read as video too
- **Video Understanding Controls**: Gemini and Interactions support per-video start/end offsets, sampling rates greater than 0 and up to 24 FPS, and static/agentic processing; agentic results preserve server-side processing steps and conversation history
- **Smart Model Switching**: Discover models from AI Studio and route through the `model` field
Expand Down Expand Up @@ -343,7 +344,7 @@ curl http://127.0.0.1:2048/v1/chat/completions \
| Anthropic Messages | `http://127.0.0.1:2048` | `PROXY_API_KEY` from `.env` |
| Gemini | `http://127.0.0.1:2048` | `PROXY_API_KEY` from `.env` |

Read model names from `GET /v1/models` or `GET /v1beta/models`. When `PROXY_API_KEY` is empty, only pages on this machine can call the API from a browser; web clients and some desktop clients need `PROXY_API_KEY` set. Separate several keys with commas; any of them is accepted. On the Settings page you can tick which accounts handle each key's requests.
Read model names from `GET /v1/models` or `GET /v1beta/models`. When `PROXY_API_KEY` is empty, only pages on this machine can call the API from a browser; web clients and some desktop clients need `PROXY_API_KEY` set. Separate several keys with commas; any of them is accepted. On the Settings page you can tick which accounts handle each key's requests. A request with the header `X-AIStudio-Account: <account>` is handled only by that account, written as the email shown on the Accounts page; if that account fails, its error is returned directly instead of switching to another account.

For Cherry Studio:

Expand Down Expand Up @@ -510,6 +511,28 @@ curl http://127.0.0.1:2048/v1/videos \

After creating the task, poll `GET /v1/videos/{id}` and download the result from `GET /v1/videos/{id}/content`; video-capable Omni models such as `gemini-omni-1.1-flash` also create tasks through `:predictLongRunning`.

### Decisions (Gemini Decision)

```bash
curl http://127.0.0.1:2048/v1beta/decisions \
-H "x-goog-api-key: 123" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-decision-1",
"input": "I was charged twice for my order.",
"questions": {
"is_refund": {"type": "noul", "instructions": "Is the customer asking for money back?"},
"department": {
"type": "choice",
"instructions": "Which department should handle this request?",
"criteria": {"billing": "Payments and refunds.", "shipping": "Delivery and tracking.", "other": ""}
}
}
}'
```

You name the keys of `questions`, and answers come back under the same keys. `noul` returns the probability `noul` that the statement holds, with optional `true_description` and `false_description` in `criteria`; `choice` takes option IDs mapped to descriptions in `criteria` and returns `choice` plus `probabilities` for every option; `score` takes level descriptions from low to high in `criteria` and returns the expected level `score`, per-level `probabilities`, and `legend`. Every answer includes `confidence`. `input` accepts a string or Interactions content blocks; images, audio, video, and PDF use `data` (Base64) or `uri` (an HTTPS URL or a file from this service's Files API) with `mime_type`. The Google Gen AI SDK calls it through `client.decisions.create`.

## Models

The model catalog follows AI Studio updates; clients read the current values from `/v1/models` or `/v1beta/models`. The table below lists common catalog models; runtime results are authoritative for model IDs and limits:
Expand All @@ -526,6 +549,7 @@ The model catalog follows AI Studio updates; clients read the current values fro
| `gemma-4-31b-it` | Gemma 4 31B IT | Text | 262144 | 32768 |
| `gemini-omni-1.1-flash` | Gemini Omni 1.1 Flash | Text and video | 131072 | 65536 |
| `deep-research-preview-04-2026` | Deep Research Preview | Deep research | 131072 | 65536 |
| `gemini-decision-1` | Gemini Decision 1 | Decision | 262144 | 0 |
| `gemini-nano-banana-2.1` | Nano Banana 2.1 | Image | 65536 | 65536 |
| `gemini-3.1-flash-image` | Nano Banana 2 | Image | 65536 | 65536 |
| `gemini-3.1-flash-lite-image` | Nano Banana 2 Lite | Image | 65536 | 65536 |
Expand All @@ -540,7 +564,7 @@ The model catalog follows AI Studio updates; clients read the current values fro

The catalog also includes `-latest` aliases, Robotics-ER, earlier image and TTS models, and the Build channel's `-build` models.

Public endpoints implement `generateContent`, `countTokens`, `embedContent`, `batchEmbedContents`, and `predictLongRunning`; `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` 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.

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, and use `input_token_limit` when the request sets no output limit; beyond 32768 tokens the response continues automatically in multiple rounds and is returned as one response. Model names accept a thinking suffix such as `gemini-4-argon(low)`: the value in parentheses is `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, `auto`, or a thinking budget in tokens, and it overrides thinking parameters in the request body. Model names fixed in a client can be mapped to catalog models with `MODEL_MAPPING`, for example `MODEL_MAPPING=claude-haiku-5-5:gemini-3.8-flash`; each alias is listed in the model catalog with the fields of its target.

Expand Down
Loading