@wacry/codeks-bridge 0.0.25 → 0.0.26
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/dist/config.js +13 -0
- package/dist/profiles.js +7 -0
- package/dist/types.d.ts +7 -0
- package/docs/config.md +22 -0
- package/docs/design.md +1 -1
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -117,6 +117,19 @@ export function validateConfig(value) {
|
|
|
117
117
|
fail(`model ${slug}: options must be an object`);
|
|
118
118
|
if (model.input_modalities !== undefined && (!strings(model.input_modalities) || !model.input_modalities.length || model.input_modalities.some((m) => !["text", "image"].includes(m))))
|
|
119
119
|
fail(`model ${slug}: input_modalities must contain text or image`);
|
|
120
|
+
if (model.service_tiers !== undefined) {
|
|
121
|
+
if (!Array.isArray(model.service_tiers))
|
|
122
|
+
fail(`model ${slug}: service_tiers must be an array`);
|
|
123
|
+
const ids = new Set();
|
|
124
|
+
for (const tier of model.service_tiers) {
|
|
125
|
+
if (!object(tier) || typeof tier.id !== "string" || !tier.id.trim() || typeof tier.name !== "string" || !tier.name.trim() || typeof tier.description !== "string") {
|
|
126
|
+
fail(`model ${slug}: service_tiers entries require nonempty id, name, and a string description`);
|
|
127
|
+
}
|
|
128
|
+
if (ids.has(tier.id))
|
|
129
|
+
fail(`model ${slug}: duplicate service_tiers id ${tier.id}`);
|
|
130
|
+
ids.add(tier.id);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
120
133
|
if (model.reasoning !== undefined) {
|
|
121
134
|
const r = model.reasoning;
|
|
122
135
|
if (!object(r))
|
package/dist/profiles.js
CHANGED
|
@@ -48,6 +48,13 @@ export function modelProfile(model) {
|
|
|
48
48
|
info.context_window = info.max_context_window = model.context_window;
|
|
49
49
|
if (model.input_modalities !== undefined)
|
|
50
50
|
info.input_modalities = [...model.input_modalities];
|
|
51
|
+
if (model.service_tiers !== undefined) {
|
|
52
|
+
info.service_tiers = structuredClone(model.service_tiers);
|
|
53
|
+
// Keep legacy Fast discovery consistent with the explicit tier list.
|
|
54
|
+
info.additional_speed_tiers = [];
|
|
55
|
+
if (!model.service_tiers.some(tier => tier.id === info.default_service_tier))
|
|
56
|
+
info.default_service_tier = null;
|
|
57
|
+
}
|
|
51
58
|
return {
|
|
52
59
|
...FORMATS[entry.adapter], model_info: info, effort_map, multi_agent_effort,
|
|
53
60
|
max_output_tokens: model.max_output_tokens ?? entry.max_output_tokens,
|
package/dist/types.d.ts
CHANGED
|
@@ -36,6 +36,13 @@ export interface ModelConfig {
|
|
|
36
36
|
context_window?: number;
|
|
37
37
|
max_output_tokens?: number;
|
|
38
38
|
input_modalities?: ("text" | "image")[];
|
|
39
|
+
/** Replace advertised service tiers; an empty list removes tier choices. */
|
|
40
|
+
service_tiers?: {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
}[];
|
|
39
46
|
reasoning?: {
|
|
40
47
|
default_effort?: string;
|
|
41
48
|
effort_map?: Record<string, string>;
|
package/docs/config.md
CHANGED
|
@@ -151,6 +151,7 @@ token 临近过期时自动续期并写回原文件;HTTP 401 可触发一次
|
|
|
151
151
|
| `context_window` | 可选窗口预算;设置时同时覆盖客户端的 `context_window` 和 `max_context_window` |
|
|
152
152
|
| `max_output_tokens` | 覆盖目录的默认回答输出预算;请求中的显式值优先于模型配置 |
|
|
153
153
|
| `input_modalities` | 可选,覆盖条目中的 `text`/`image` 能力声明 |
|
|
154
|
+
| `service_tiers` | 可选,完整替换客户端可选服务档位;每项为 `{id, name, description}`,`[]` 清空额外档位 |
|
|
154
155
|
| `reasoning` | 默认 effort 及其到原生值的映射 |
|
|
155
156
|
| `replay` | reasoning、原生压缩的允许来源,以及未识别历史状态的处理方式 |
|
|
156
157
|
| `compaction` | 压缩方式、执行模型,以及本目标是否接收原生压缩 |
|
|
@@ -174,6 +175,27 @@ token 临近过期时自动续期并写回原文件;HTTP 401 可触发一次
|
|
|
174
175
|
|
|
175
176
|
最终由 bridge 固定模型路由、转换后的历史、工具定义、流模式和必要协议字段。摘要请求保留普通工具选择并移除结构化输出约束;原生压缩移除普通回答的输出上限。必须重建的字段承载桥接契约,不由 options 改写。详见上表链接的后端文档,以及[摘要的工具选择](compaction.md#工具选择与缓存)。
|
|
176
177
|
|
|
178
|
+
## 服务档位
|
|
179
|
+
|
|
180
|
+
同一 GPT 模型在不同端点上可能支持不同档位。`models.<别名>.service_tiers` 使用 Codex 当前的原生目录格式:`id` 是实际请求中的 `service_tier` 值,`name` 是客户端展示和档位命令名称,`description` 是说明文字。省略时保留原目录;设置后完整替换,可以给相同目录条目的不同别名配置不同能力。
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
"gpt-fast": {
|
|
184
|
+
"catalog": "gpt-6.1-sol", "upstream": "primary", "model": "gpt-6.1-sol",
|
|
185
|
+
"service_tiers": [
|
|
186
|
+
{ "id": "priority", "name": "Fast", "description": "Faster responses with priority processing" }
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
"gpt-standard": {
|
|
190
|
+
"catalog": "gpt-6.1-sol", "upstream": "secondary", "model": "sol-deployment",
|
|
191
|
+
"service_tiers": []
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
`service_tiers` 是当前字段;`additional_speed_tiers` 已被 Codex 标记弃用,不作为独立配置项。显式覆盖时,bridge 同时清空派生目录中的旧字段,避免它继续声明 Fast 能力。原目录的 `default_service_tier` 仍在新列表时保留,否则清空;配置不会改写仓库中的原始模型条目。
|
|
196
|
+
|
|
197
|
+
这是客户端能力声明,不是请求默认值或服务端权限。实际选择由 codeks 的 `service_tier` 设置及界面决定;bridge 保留 GPT 请求中的 `service_tier`,不会根据这份列表再次过滤或替换。档位 ID 不限定为 `priority`、`ultrafast` 或 `flex`,额外元数据原样保留,真实支持情况由上游决定。当前 codeks 即使未在目录中列出 `flex`,仍允许显式请求它,因此 `[]` 不代表禁止所有服务档位请求。
|
|
198
|
+
|
|
177
199
|
## Adapter 专用行为
|
|
178
200
|
|
|
179
201
|
`adapters` 与 `options` 分工不同:前者控制 bridge 怎样转换协议,后者是发送给上游的原生请求参数。命名空间使用目录已有的 adapter ID;以后新增协议专用行为时,在对应命名空间增加字段,无需向模型目录或连接顶层添加协议特例。`claude-messages` 的设置:
|
package/docs/design.md
CHANGED
|
@@ -40,7 +40,7 @@ Claude、DeepSeek 与 Gemini 从 GPT-6.1 Sol 模板开始,`shell_type` 沿用
|
|
|
40
40
|
|
|
41
41
|
## 配置表达策略,adapter 负责协议
|
|
42
42
|
|
|
43
|
-
`models.catalog` 选择条目;`upstreams` 包含连接、鉴权及共用的 adapter 设置;别名和真实部署名独立。目录条目决定 adapter
|
|
43
|
+
`models.catalog` 选择条目;`upstreams` 包含连接、鉴权及共用的 adapter 设置;别名和真实部署名独立。目录条目决定 adapter,实际模型名不参与方言推断。模型窗口、输入模态、服务档位、effort 映射、状态复用范围、压缩模式及执行模型可由配置覆盖。
|
|
44
44
|
|
|
45
45
|
协议专用桥接行为放在 `adapters.<adapter ID>`,模型逐字段覆盖连接,再取对应 adapter 默认值;原生请求参数仍通过开放的 `options` 浅层合并。这样的边界让未来 GPT、Messages 或 Chat 方言可以添加各自确有需求的设置,而不用在连接顶层堆积特例,也不提前维护空的配置对象或通用插件框架。配置行为不改变来源身份和模型目录。Claude 的 thinking 失配策略通过这里配置,适用于工具定义变化、故障续接等引起的前缀差异;见 [Adapter 专用行为](config.md#adapter-专用行为)。
|
|
46
46
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wacry/codeks-bridge",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Configurable local Responses API bridge for codeks with GPT, Claude Messages, DeepSeek Chat, and native Gemini adapters.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "David Zhang",
|