dsh-cliproxyapi-pro 1.12.0 → 1.12.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  本插件的所有重要变更。版本号遵循[语义化版本](https://semver.org/lang/zh-CN/)。
6
6
 
7
+ ## 1.12.1 — 2026-11-18
8
+
9
+ ### 变更
10
+ - **Gemini 改走原生协议。** DSH 的 `llm-pi-ai` 自定义路由支持 Gemini `generateContent`(`google-generative-ai`),自动模式下不带前缀的 `gemini-*` 模型不再走 OpenAI Chat,而是写入新的 `<路由>-gemini` 路由(地址为 `<CPA>/v1beta`),省去 CPA 的 Chat ↔ Gemini 转换,思考签名和工具调用按原生格式往返。该路由必须配置 API Key,未配置密钥的账号 Gemini 仍走 Chat;思考档位只提供 Gemini 适配器能发送的 `minimal` / `low` / `medium` / `high`。`devin/gemini-*` 等带前缀的 ID 仍走 Chat。「统一使用」和单模型协议也可以选 **Gemini**。已经在 `cli-proxy` 上使用 Gemini 的会话需要重新选一次模型。
11
+
7
12
  ## 1.12.0 — 2026-11-18
8
13
 
9
14
  ### 新增
package/README.en.md CHANGED
@@ -12,7 +12,7 @@ Enter a server URL and an API key, and the plugin reads the CPA model catalog an
12
12
 
13
13
  - **Multiple accounts**: each account has its own URL, key, model selection and parameters, and can be switched off at any time. [Details](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/en/accounts-and-models.md)
14
14
  - **Works out of the box**: on the first connection, the newest model of each family in that server's own catalog is checked (at most 12), so the picker isn't flooded with hundreds of models. [Details](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/en/accounts-and-models.md)
15
- - **Native protocols**: Claude over Anthropic Messages, GPT / Codex / Grok over OpenAI Responses, everything else over OpenAI Chat — fewer protocol translations inside CPA. [Details](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/en/accounts-and-models.md)
15
+ - **Native protocols**: Claude over Anthropic Messages, GPT / Codex / Grok over OpenAI Responses, Gemini over its native `generateContent` (needs an API key, otherwise OpenAI Chat), everything else over OpenAI Chat — fewer protocol translations inside CPA. [Details](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/en/accounts-and-models.md)
16
16
  - **Visual management**: check models and edit per-model parameters in the settings panel. By default the plugin registers no agent tool, so it takes no model context (the optional generation tool `generate_media` is switched on in the Generation tab). [Details](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/en/accounts-and-models.md)
17
17
  - **Channel quota**: see each channel's remaining quota per credential, with a badge for the current model in the composer and a quick view of every account in the sidebar footer; failed queries pause automatic refresh. [Details](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/en/quota.md)
18
18
  - **Images and videos**: generate and edit images, and generate, edit and extend videos through CPA; the optional agent generation tool is off by default. [Details](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/en/media.md)
@@ -36,7 +36,7 @@ The plugin is published on npm as [`dsh-cliproxyapi-pro`](https://www.npmjs.com/
36
36
  dsh-cliproxyapi-pro
37
37
  ```
38
38
 
39
- To pin a version, write `dsh-cliproxyapi-pro@1.12.0`.
39
+ To pin a version, write `dsh-cliproxyapi-pro@1.12.1`.
40
40
  4. Click **Install**. When it finishes, the dialog offers to enable the plugin right away — accept it.
41
41
 
42
42
  > If downloads are slow in mainland China, open **Registry** next to the input and choose **the mainland China mirror**.
@@ -65,7 +65,7 @@ In **Add plugin**, or as the `plugin_manager` `target`, you can also enter:
65
65
 
66
66
  | Source | What to enter |
67
67
  |---|---|
68
- | A released version | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#v1.12.0` |
68
+ | A released version | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#v1.12.1` |
69
69
  | Latest development version | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#main` |
70
70
  | Offline package | Download [`dsh-cliproxyapi-pro.tgz`](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/releases/latest/download/dsh-cliproxyapi-pro.tgz) (always the latest release) and enter its absolute local path |
71
71
  | Local source (development) | Absolute path of a cloned repository; installed as a link, so code changes go live when the plugin reloads |
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  - **多账号**:每个账号独立的地址、密钥、模型勾选和参数,互不影响,可随时停用。 [详解](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/zh/accounts-and-models.md)
14
14
  - **开箱即用**:首次连接时按该服务自己的模型目录,为每个模型家族勾选最新的一个(最多 12 个),模型选择器不会被上百个模型淹没。 [详解](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/zh/accounts-and-models.md)
15
- - **原生协议**:Claude 走 Anthropic Messages,GPT / Codex / Grok 走 OpenAI Responses,其余走 OpenAI Chat,减少 CPA 的协议转换。 [详解](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/zh/accounts-and-models.md)
15
+ - **原生协议**:Claude 走 Anthropic Messages,GPT / Codex / Grok 走 OpenAI Responses,Gemini 走 Gemini 原生 `generateContent`(需配置 API Key,否则走 OpenAI Chat),其余走 OpenAI Chat,减少 CPA 的协议转换。 [详解](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/zh/accounts-and-models.md)
16
16
  - **可视化管理**:设置面板里勾选模型、编辑单个模型的参数。默认不注册 Agent 工具,不占用模型上下文(可选的生成工具 `generate_media` 需在「生成」标签手动打开)。 [详解](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/zh/accounts-and-models.md)
17
17
  - **渠道额度**:按凭证查看各渠道的剩余额度,对话框里的徽标显示当前模型的额度,侧边栏底部可快速查看所有账号;查询失败会暂停自动刷新。 [详解](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/zh/quota.md)
18
18
  - **生图 / 生视频**:通过 CPA 生成和编辑图片,生成、编辑和延长视频;可选的 agent 生成工具默认关闭。 [详解](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/blob/main/docs/zh/media.md)
@@ -36,7 +36,7 @@
36
36
  dsh-cliproxyapi-pro
37
37
  ```
38
38
 
39
- 需要固定版本时可以写成 `dsh-cliproxyapi-pro@1.12.0`。
39
+ 需要固定版本时可以写成 `dsh-cliproxyapi-pro@1.12.1`。
40
40
  4. 点击 **安装**,完成后点击 **立即启用**。
41
41
 
42
42
  > 在中国大陆下载慢,可以点输入框旁的 **安装源**,切换到 **中国大陆镜像源**。
@@ -65,7 +65,7 @@ dsh plugin --profile <profile 名称> add dsh-cliproxyapi-pro
65
65
 
66
66
  | 来源 | 填写内容 |
67
67
  |---|---|
68
- | 某个发布版本 | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#v1.12.0` |
68
+ | 某个发布版本 | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#v1.12.1` |
69
69
  | 最新开发版 | `git+https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro.git#main` |
70
70
  | 离线安装包 | 下载 [`dsh-cliproxyapi-pro.tgz`](https://github.com/TinyBOOOOM/dsh-cliproxyapi-pro/releases/latest/download/dsh-cliproxyapi-pro.tgz)(始终是最新版),填写它的本地绝对路径 |
71
71
  | 本地源码(开发用) | 克隆后的仓库目录绝对路径;以链接方式安装,改代码后重载插件即生效 |
package/lib/client.js CHANGED
@@ -82,12 +82,13 @@ window.__ModuleLoader__.load({
82
82
  apiKeyHint: "保存在 DSH 凭证服务({ref}),不会写入配置文件。本地免密的 CPA 可留空。",
83
83
  clearKeyBtn: "清除密钥",
84
84
  protocolLabel: "接口协议",
85
- protocolHint: "自动模式下每个模型走所属家族的原生协议,减少 CPA 中转转换;Gemini 等 DSH 不支持原生协议的模型走 OpenAI Chat。",
85
+ protocolHint: "自动模式下每个模型走所属家族的原生协议,减少 CPA 中转转换:Claude 走 Claude Messages,GPT / Grok 走 OpenAI Responses,Gemini 走 Gemini 原生协议(需要配置 API Key,未配置时改走 OpenAI Chat),其余模型走 OpenAI Chat。",
86
86
  protocolAuto: "自动:按模型家族走原生协议(推荐)",
87
87
  protocolFixedPrefix: "统一使用:",
88
88
  protocolNameCompletions: "OpenAI Chat",
89
89
  protocolNameResponses: "OpenAI Responses",
90
90
  protocolNameMessages: "Claude Messages",
91
+ protocolNameGemini: "Gemini",
91
92
  modelProtocolLabel: "请求协议",
92
93
  modelProtocolDefault: "跟随全局设置",
93
94
  modelProtocolHint: "原生协议:",
@@ -629,12 +630,13 @@ window.__ModuleLoader__.load({
629
630
  apiKeyHint: "Stored in the DSH credentials service ({ref}), never in settings files. Leave blank for a local CPA without a key.",
630
631
  clearKeyBtn: "Clear Key",
631
632
  protocolLabel: "Wire Protocol",
632
- protocolHint: "Auto sends each model over its family's own protocol to avoid CPA translation; models DSH cannot speak natively (such as Gemini) use OpenAI Chat.",
633
+ protocolHint: "Auto sends each model over its family's own protocol to avoid CPA translation: Claude uses Claude Messages, GPT / Grok use OpenAI Responses, Gemini uses Gemini (needs an API key; without one it falls back to OpenAI Chat), and everything else uses OpenAI Chat.",
633
634
  protocolAuto: "Auto: native protocol per model family (recommended)",
634
635
  protocolFixedPrefix: "Always use: ",
635
636
  protocolNameCompletions: "OpenAI Chat",
636
637
  protocolNameResponses: "OpenAI Responses",
637
638
  protocolNameMessages: "Claude Messages",
639
+ protocolNameGemini: "Gemini",
638
640
  modelProtocolLabel: "Request Protocol",
639
641
  modelProtocolDefault: "Follow global setting",
640
642
  modelProtocolHint: "Native protocol: ",
@@ -2560,6 +2562,7 @@ select.dcpa-q-input.dcpa-media-kind { flex: none; width: auto; height: 28px; fon
2560
2562
  "openai-completions": "protocolNameCompletions",
2561
2563
  "openai-responses": "protocolNameResponses",
2562
2564
  "anthropic-messages": "protocolNameMessages",
2565
+ "google-generative-ai": "protocolNameGemini",
2563
2566
  };
2564
2567
  const PROTOCOLS = Object.keys(PROTOCOL_NAME_KEYS);
2565
2568
 
@@ -53,13 +53,16 @@ export const MAX_CATALOG_BYTES = 8 * 1024 * 1024;
53
53
  export const PI_AI_NS = "llm-pi-ai";
54
54
  export const REASONING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
55
55
  /** Wire protocols the DSH llm-pi-ai adapter accepts on a hand-declared route. */
56
- export const PROTOCOLS = ["openai-completions", "openai-responses", "anthropic-messages"];
56
+ export const PROTOCOLS = ["openai-completions", "openai-responses", "anthropic-messages", "google-generative-ai"];
57
57
  /** Route-key suffix and display-name label of each protocol's route. */
58
58
  export const PROTOCOL_ROUTES = {
59
59
  "openai-completions": { suffix: "", label: "" },
60
60
  "openai-responses": { suffix: "-responses", label: " (OpenAI Responses)" },
61
61
  "anthropic-messages": { suffix: "-messages", label: " (Claude Messages)" },
62
+ "google-generative-ai": { suffix: "-gemini", label: " (Gemini)" },
62
63
  };
64
+ /** The only thinking levels pi-ai's Gemini adapter can send (`thinkingLevel` / budget). */
65
+ export const GOOGLE_THINKING_LEVELS = ["minimal", "low", "medium", "high"];
63
66
  export const DEFAULT_MODEL_NS = "agent-default-model";
64
67
  export const REF_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
65
68
 
@@ -165,10 +168,7 @@ export function resolveConfig(rawConfig = {}) {
165
168
  const apiKeyEnv = apiKeyEnvRaw || DEFAULT_API_KEY_ENV;
166
169
  const baseURL = String(readVolatile(rawConfig?.baseURL, "")).trim();
167
170
  const protocolRaw = String(readVolatile(rawConfig?.protocol, "openai-completions")).trim();
168
- const protocol =
169
- protocolRaw === "openai-responses" || protocolRaw === "anthropic-messages"
170
- ? protocolRaw
171
- : "openai-completions";
171
+ const protocol = PROTOCOLS.includes(protocolRaw) ? protocolRaw : "openai-completions";
172
172
  const protocolMode =
173
173
  String(readVolatile(rawConfig?.protocolMode, "auto")).trim() === "fixed" ? "fixed" : "auto";
174
174
  const refreshRaw = Number(
@@ -1,28 +1,34 @@
1
1
  // Native wire protocols, model overrides and managed llm-pi-ai route profiles.
2
2
 
3
- import { REASONING_LEVELS, PROTOCOLS, PROTOCOL_ROUTES } from "./config.js";
3
+ import { REASONING_LEVELS, PROTOCOLS, PROTOCOL_ROUTES, GOOGLE_THINKING_LEVELS } from "./config.js";
4
4
  import { filterModels, sortModelsNewestFirst } from "./models.js";
5
5
 
6
6
  /**
7
7
  * Pick the wire protocol that reaches a model with the fewest translations.
8
8
  *
9
- * CLIProxyAPI serves every model on OpenAI Chat, OpenAI Responses and
10
- * Anthropic Messages and translates between them and the upstream channel.
11
- * Speaking the upstream's own protocol skips that translation:
9
+ * CLIProxyAPI serves every model on OpenAI Chat, OpenAI Responses, Anthropic
10
+ * Messages and Gemini generateContent and translates between them and the
11
+ * upstream channel. Speaking the upstream's own protocol skips that translation:
12
12
  * - Claude family -> Anthropic Messages (`/v1/messages`)
13
13
  * - OpenAI / Codex / Grok -> OpenAI Responses (`/v1/responses`)
14
- * - everything else, including Gemini -> OpenAI Chat Completions; DSH
15
- * cannot speak Gemini generateContent on a custom route.
14
+ * - unprefixed `gemini-*` ids -> Gemini generateContent (`/v1beta/models/…`).
15
+ * Prefixed ids (`team/gemini-…`) stay on Chat: pi-ai keys Gemini tool-call
16
+ * ids and multimodal tool results on an id that starts with `gemini-`.
17
+ * - everything else -> OpenAI Chat Completions.
16
18
  * `owned_by` from the CPA listing names the family; the id is the fallback.
19
+ * The Gemini route needs an API key; {@link buildPiAiRoutes} falls back to
20
+ * Chat for keyless accounts.
17
21
  * @param model - parsed catalog model.
18
22
  * @returns one of {@link PROTOCOLS}.
19
23
  */
20
24
  export function nativeProtocol(model) {
21
25
  const owner = String(model.ownedBy ?? "").toLowerCase();
22
- const bare = String(model.id ?? "").toLowerCase().split("/").pop() ?? "";
26
+ const id = String(model.id ?? "").toLowerCase();
27
+ const bare = id.split("/").pop() ?? "";
23
28
  if (owner === "anthropic" || /^claude/.test(bare)) return "anthropic-messages";
24
29
  if (owner === "openai" || owner === "xai") return "openai-responses";
25
30
  if (/^(gpt|o\d|codex|grok)/.test(bare) && !/^gpt-oss/.test(bare)) return "openai-responses";
31
+ if (/^gemini-/.test(id)) return "google-generative-ai";
26
32
  return "openai-completions";
27
33
  }
28
34
 
@@ -38,8 +44,11 @@ export function routeKeyFor(provider, protocol) {
38
44
  return `${provider}${PROTOCOL_ROUTES[protocol].suffix}`;
39
45
  }
40
46
 
47
+ /** Route base URL; pi-ai's Gemini client expects the API version in it. */
41
48
  export function routeBaseURL(rootURL, protocol) {
42
- return protocol === "anthropic-messages" ? rootURL : `${rootURL}/v1`;
49
+ if (protocol === "anthropic-messages") return rootURL;
50
+ if (protocol === "google-generative-ai") return `${rootURL}/v1beta`;
51
+ return `${rootURL}/v1`;
43
52
  }
44
53
 
45
54
  export function supportedReasoning(model) {
@@ -56,6 +65,29 @@ export function supportedReasoning(model) {
56
65
  return Object.keys(result).length === 0 ? undefined : result;
57
66
  }
58
67
 
68
+ /**
69
+ * Narrow reasoning efforts to what pi-ai's Gemini adapter can send: it maps a
70
+ * wire value to `thinkingLevel` / a budget and throws for anything outside
71
+ * {@link GOOGLE_THINKING_LEVELS}, so `xhigh` / `max` are dropped. `off` is
72
+ * kept only when the catalog declares it: Gemini sends it as
73
+ * `thinkingBudget: 0`, which thinking-level models may reject. A model that
74
+ * declared only levels above `high` keeps `high`.
75
+ */
76
+ export function googleReasoning(model, efforts) {
77
+ if (efforts === undefined) return undefined;
78
+ const declared = new Set(model.reasoningLevels);
79
+ const result = {};
80
+ for (const [level, wire] of Object.entries(efforts)) {
81
+ if (level === "off") {
82
+ if (declared.has("off")) result.off = null;
83
+ } else if (GOOGLE_THINKING_LEVELS.includes(wire)) {
84
+ result[level] = wire;
85
+ }
86
+ }
87
+ if (!Object.keys(result).some((level) => level !== "off")) result.high = "high";
88
+ return result;
89
+ }
90
+
59
91
  /**
60
92
  * Claude models that take adaptive thinking with an `effort` value rather
61
93
  * than a token budget: Opus/Sonnet 4.6+, Haiku 5+, Fable and every 5.x.
@@ -100,7 +132,8 @@ export function protocolCompat(model, protocol, hasReasoning) {
100
132
  }
101
133
 
102
134
  export function toPiAiModelProfile(model, protocol) {
103
- const reasoningEfforts = supportedReasoning(model);
135
+ const supported = supportedReasoning(model);
136
+ const reasoningEfforts = protocol === "google-generative-ai" ? googleReasoning(model, supported) : supported;
104
137
  const compat = protocolCompat(model, protocol, reasoningEfforts !== undefined);
105
138
  return {
106
139
  id: model.id,
@@ -116,8 +149,10 @@ export function toPiAiModelProfile(model, protocol) {
116
149
  /**
117
150
  * Build one llm-pi-ai route per protocol the selected models need.
118
151
  * The base route key (e.g. `cli-proxy`) always carries OpenAI Chat so that
119
- * existing sessions and the default-model setting keep resolving; Responses
120
- * and Messages models get `<key>-responses` / `<key>-messages` siblings.
152
+ * existing sessions and the default-model setting keep resolving; Responses,
153
+ * Messages and Gemini models get `<key>-responses` / `<key>-messages` /
154
+ * `<key>-gemini` siblings. pi-ai's Gemini adapter refuses to send a request
155
+ * without an API key, so a keyless account keeps Gemini models on Chat.
121
156
  * @returns `{ allModels, orderedModels, routes }` where `routes` maps each
122
157
  * route key to its profile, in protocol order, and every ordered model
123
158
  * carries its `protocol` and `route`.
@@ -133,7 +168,8 @@ export function buildPiAiRoutes(config, discovery, hasApiKey) {
133
168
  const chatOrdered = allOrdered.filter(isChatModel);
134
169
  const filtered = filterModels(chatOrdered, config).map((model) => {
135
170
  const effective = applyModelOverride(model, config.modelOverrides?.[model.id]);
136
- const protocol = modelProtocol(model, config);
171
+ const wanted = modelProtocol(model, config);
172
+ const protocol = wanted === "google-generative-ai" && !hasApiKey ? "openai-completions" : wanted;
137
173
  return { ...effective, protocol, route: routeKeyFor(config.provider, protocol) };
138
174
  });
139
175
  if (filtered.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cliproxyapi-pro",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "description": "CLIProxyAPI (CPA) provider for DeepSeek Harness — multiple accounts, model sync over native protocols, per-credential quota, and optional image / video generation.",
5
5
  "keywords": [
6
6
  "dsh",