opencode-aicodewith-auth 0.1.34 → 0.1.38
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/README.ai.md +6 -4
- package/README.md +1 -1
- package/dist/index.js +368 -122
- package/package.json +8 -3
- package/dist/index.d.ts +0 -11
- package/dist/lib/constants.d.ts +0 -35
- package/dist/lib/hooks/auto-update/cache.d.ts +0 -1
- package/dist/lib/hooks/auto-update/checker.d.ts +0 -11
- package/dist/lib/hooks/auto-update/constants.d.ts +0 -15
- package/dist/lib/hooks/auto-update/index.d.ts +0 -12
- package/dist/lib/hooks/auto-update/types.d.ts +0 -30
- package/dist/lib/hooks/omo-config-sync/index.d.ts +0 -14
- package/dist/lib/logger.d.ts +0 -25
- package/dist/lib/prompts/codex-opencode-bridge.d.ts +0 -26
- package/dist/lib/prompts/codex.d.ts +0 -11
- package/dist/lib/prompts/opencode-codex.d.ts +0 -22
- package/dist/lib/request/claude-tools-transform.d.ts +0 -18
- package/dist/lib/request/fetch-helpers.d.ts +0 -19
- package/dist/lib/request/helpers/input-utils.d.ts +0 -13
- package/dist/lib/request/helpers/model-map.d.ts +0 -35
- package/dist/lib/request/request-transformer.d.ts +0 -15
- package/dist/lib/request/response-handler.d.ts +0 -21
- package/dist/lib/types.d.ts +0 -64
- package/dist/provider.d.ts +0 -33
package/README.ai.md
CHANGED
|
@@ -198,25 +198,27 @@ If the output is NOT `https://registry.npmjs.org/` (e.g., shows taobao, cnpm, or
|
|
|
198
198
|
|
|
199
199
|
> "安装完成!请重启 OpenCode 以加载插件。
|
|
200
200
|
> 你现在可以使用以下模型:
|
|
201
|
+
> - `gpt-5.3-codex`
|
|
201
202
|
> - `gpt-5.2-codex`
|
|
202
203
|
> - `gpt-5.2`
|
|
203
204
|
> - `claude-sonnet-4-5-20250929
|
|
204
|
-
> - `claude-opus-4-
|
|
205
|
+
> - `claude-opus-4-6-20260205
|
|
205
206
|
> - `gemini-3-pro`
|
|
206
207
|
>
|
|
207
|
-
> 测试命令: `opencode --model gpt-5.
|
|
208
|
+
> 测试命令: `opencode --model gpt-5.3-codex`"
|
|
208
209
|
|
|
209
210
|
**If using a mirror registry** (taobao, cnpm, etc.), add this warning:
|
|
210
211
|
|
|
211
212
|
> "安装完成!请重启 OpenCode 以加载插件。
|
|
212
213
|
> 你现在可以使用以下模型:
|
|
214
|
+
> - `gpt-5.3-codex`
|
|
213
215
|
> - `gpt-5.2-codex`
|
|
214
216
|
> - `gpt-5.2`
|
|
215
217
|
> - `claude-sonnet-4-5-20250929
|
|
216
|
-
> - `claude-opus-4-
|
|
218
|
+
> - `claude-opus-4-6-20260205
|
|
217
219
|
> - `gemini-3-pro`
|
|
218
220
|
>
|
|
219
|
-
> 测试命令: `opencode --model gpt-5.
|
|
221
|
+
> 测试命令: `opencode --model gpt-5.3-codex`
|
|
220
222
|
>
|
|
221
223
|
> ⚠️ **注意**: 检测到你使用的是非官方 npm 源。如果启动 OpenCode 时遇到插件加载失败(如 `BunInstallFailedError`),可能是镜像源尚未同步最新版本。解决方法:
|
|
222
224
|
> ```bash
|
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ User Request → OpenCode → Plugin Auth Hook → Route by Model:
|
|
|
64
64
|
| `aicodewith/gpt-5.2-codex` | GPT-5.2 Codex | ✅ | 日常编程、代码生成 |
|
|
65
65
|
| `aicodewith/gpt-5.2` | GPT-5.2 | ✅ | 架构设计、逻辑推理 |
|
|
66
66
|
| `aicodewith/claude-sonnet-4-5-20250929` | Claude Sonnet 4.5 | ✅ | 代码审查、文档查询 |
|
|
67
|
-
| `aicodewith/claude-opus-4-
|
|
67
|
+
| `aicodewith/claude-opus-4-6-20260205` | Claude Opus 4.6 | ✅ | 复杂任务、深度思考 |
|
|
68
68
|
| `aicodewith/gemini-3-pro` | Gemini 3 Pro | ✅ | 前端 UI、多模态任务 |
|
|
69
69
|
|
|
70
70
|
---
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,220 @@ import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile3, access
|
|
|
4
4
|
import path5 from "path";
|
|
5
5
|
import os4 from "os";
|
|
6
6
|
|
|
7
|
+
// lib/models/registry.ts
|
|
8
|
+
var PROVIDER_ID = "aicodewith";
|
|
9
|
+
var MODELS = [
|
|
10
|
+
{
|
|
11
|
+
id: "gpt-5.2-codex",
|
|
12
|
+
family: "codex",
|
|
13
|
+
displayName: "GPT-5.2 Codex",
|
|
14
|
+
version: "5.2",
|
|
15
|
+
limit: { context: 400000, output: 128000 },
|
|
16
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
17
|
+
reasoning: "xhigh",
|
|
18
|
+
aliases: ["gpt-5.2-codex", "gpt 5.2 codex", "codex"]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "gpt-5.2",
|
|
22
|
+
family: "gpt",
|
|
23
|
+
displayName: "GPT-5.2",
|
|
24
|
+
version: "5.2",
|
|
25
|
+
limit: { context: 400000, output: 128000 },
|
|
26
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
27
|
+
reasoning: "xhigh",
|
|
28
|
+
aliases: ["gpt-5.2", "gpt 5.2"]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "gpt-5.1-codex",
|
|
32
|
+
family: "codex",
|
|
33
|
+
displayName: "GPT-5.1 Codex (deprecated)",
|
|
34
|
+
version: "5.1",
|
|
35
|
+
limit: { context: 400000, output: 128000 },
|
|
36
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
37
|
+
reasoning: "full",
|
|
38
|
+
deprecated: true,
|
|
39
|
+
replacedBy: "gpt-5.2-codex"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "gpt-5.1-codex-max",
|
|
43
|
+
family: "codex",
|
|
44
|
+
displayName: "GPT-5.1 Codex Max (deprecated)",
|
|
45
|
+
version: "5.1",
|
|
46
|
+
limit: { context: 400000, output: 128000 },
|
|
47
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
48
|
+
reasoning: "xhigh",
|
|
49
|
+
deprecated: true,
|
|
50
|
+
replacedBy: "gpt-5.2-codex"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "gpt-5.1-codex-mini",
|
|
54
|
+
family: "codex",
|
|
55
|
+
displayName: "GPT-5.1 Codex Mini (deprecated)",
|
|
56
|
+
version: "5.1",
|
|
57
|
+
limit: { context: 200000, output: 64000 },
|
|
58
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
59
|
+
reasoning: "basic",
|
|
60
|
+
deprecated: true,
|
|
61
|
+
replacedBy: "gpt-5.2-codex"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "gpt-5.1",
|
|
65
|
+
family: "gpt",
|
|
66
|
+
displayName: "GPT-5.1 (deprecated)",
|
|
67
|
+
version: "5.1",
|
|
68
|
+
limit: { context: 400000, output: 128000 },
|
|
69
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
70
|
+
reasoning: "full",
|
|
71
|
+
deprecated: true,
|
|
72
|
+
replacedBy: "gpt-5.2"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "claude-opus-4-6-20260205",
|
|
76
|
+
family: "claude",
|
|
77
|
+
displayName: "Claude Opus 4.6",
|
|
78
|
+
version: "4.6",
|
|
79
|
+
limit: { context: 200000, output: 64000 },
|
|
80
|
+
modalities: { input: ["text", "image"], output: ["text"] }
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "claude-opus-4-6-20260205-third-party",
|
|
84
|
+
family: "claude",
|
|
85
|
+
displayName: "Claude Opus 4.6 (third party)",
|
|
86
|
+
version: "4.6",
|
|
87
|
+
limit: { context: 200000, output: 64000 },
|
|
88
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
89
|
+
thirdPartyVariant: true
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "claude-sonnet-4-5-20250929",
|
|
93
|
+
family: "claude",
|
|
94
|
+
displayName: "Claude Sonnet 4.5",
|
|
95
|
+
version: "4.5",
|
|
96
|
+
limit: { context: 200000, output: 64000 },
|
|
97
|
+
modalities: { input: ["text", "image"], output: ["text"] }
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "claude-sonnet-4-5-20250929-third-party",
|
|
101
|
+
family: "claude",
|
|
102
|
+
displayName: "Claude Sonnet 4.5 (third party)",
|
|
103
|
+
version: "4.5",
|
|
104
|
+
limit: { context: 200000, output: 64000 },
|
|
105
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
106
|
+
thirdPartyVariant: true
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "claude-haiku-4-5-20251001",
|
|
110
|
+
family: "claude",
|
|
111
|
+
displayName: "Claude Haiku 4.5",
|
|
112
|
+
version: "4.5",
|
|
113
|
+
limit: { context: 200000, output: 8192 },
|
|
114
|
+
modalities: { input: ["text", "image"], output: ["text"] }
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "claude-haiku-4-5-20251001-third-party",
|
|
118
|
+
family: "claude",
|
|
119
|
+
displayName: "Claude Haiku 4.5 (third party)",
|
|
120
|
+
version: "4.5",
|
|
121
|
+
limit: { context: 200000, output: 8192 },
|
|
122
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
123
|
+
thirdPartyVariant: true
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "claude-opus-4-5-20251101",
|
|
127
|
+
family: "claude",
|
|
128
|
+
displayName: "Claude Opus 4.5 (deprecated)",
|
|
129
|
+
version: "4.5",
|
|
130
|
+
limit: { context: 200000, output: 64000 },
|
|
131
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
132
|
+
deprecated: true,
|
|
133
|
+
replacedBy: "claude-opus-4-6-20260205"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "claude-opus-4-5-20251101-third-party",
|
|
137
|
+
family: "claude",
|
|
138
|
+
displayName: "Claude Opus 4.5 (third party, deprecated)",
|
|
139
|
+
version: "4.5",
|
|
140
|
+
limit: { context: 200000, output: 64000 },
|
|
141
|
+
modalities: { input: ["text", "image"], output: ["text"] },
|
|
142
|
+
deprecated: true,
|
|
143
|
+
replacedBy: "claude-opus-4-6-20260205-third-party",
|
|
144
|
+
thirdPartyVariant: true
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: "gemini-3-pro",
|
|
148
|
+
family: "gemini",
|
|
149
|
+
displayName: "Gemini 3 Pro",
|
|
150
|
+
version: "3",
|
|
151
|
+
limit: { context: 1048576, output: 65536 },
|
|
152
|
+
modalities: { input: ["text", "image"], output: ["text"] }
|
|
153
|
+
}
|
|
154
|
+
];
|
|
155
|
+
var getActiveModels = () => MODELS.filter((m) => !m.deprecated);
|
|
156
|
+
var getDeprecatedModels = () => MODELS.filter((m) => m.deprecated);
|
|
157
|
+
var buildModelMigrations = () => {
|
|
158
|
+
const migrations = {};
|
|
159
|
+
for (const model of getDeprecatedModels()) {
|
|
160
|
+
if (model.replacedBy) {
|
|
161
|
+
migrations[model.id] = model.replacedBy;
|
|
162
|
+
migrations[`${PROVIDER_ID}/${model.id}`] = `${PROVIDER_ID}/${model.replacedBy}`;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return migrations;
|
|
166
|
+
};
|
|
167
|
+
var buildAliasMap = () => {
|
|
168
|
+
const map = {};
|
|
169
|
+
for (const model of getActiveModels()) {
|
|
170
|
+
map[model.id] = model.id;
|
|
171
|
+
if (model.aliases) {
|
|
172
|
+
for (const alias of model.aliases) {
|
|
173
|
+
map[alias.toLowerCase()] = model.id;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const effortLevels = ["none", "low", "medium", "high", "xhigh"];
|
|
177
|
+
for (const effort of effortLevels) {
|
|
178
|
+
map[`${model.id}-${effort}`] = model.id;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return map;
|
|
182
|
+
};
|
|
183
|
+
var getFullModelId = (id) => `${PROVIDER_ID}/${id}`;
|
|
184
|
+
var OMO_MODEL_ASSIGNMENTS = {
|
|
185
|
+
agents: {
|
|
186
|
+
sisyphus: getFullModelId("claude-sonnet-4-5-20250929"),
|
|
187
|
+
hephaestus: getFullModelId("claude-sonnet-4-5-20250929"),
|
|
188
|
+
oracle: getFullModelId("gpt-5.2"),
|
|
189
|
+
librarian: getFullModelId("claude-sonnet-4-5-20250929"),
|
|
190
|
+
explore: getFullModelId("claude-sonnet-4-5-20250929"),
|
|
191
|
+
"multimodal-looker": getFullModelId("gemini-3-pro"),
|
|
192
|
+
prometheus: getFullModelId("gpt-5.2"),
|
|
193
|
+
metis: getFullModelId("gpt-5.2"),
|
|
194
|
+
momus: getFullModelId("gpt-5.2"),
|
|
195
|
+
atlas: getFullModelId("claude-sonnet-4-5-20250929"),
|
|
196
|
+
build: getFullModelId("claude-opus-4-6-20260205"),
|
|
197
|
+
plan: getFullModelId("claude-opus-4-6-20260205"),
|
|
198
|
+
"sisyphus-junior": getFullModelId("claude-sonnet-4-5-20250929"),
|
|
199
|
+
"OpenCode-Builder": getFullModelId("claude-opus-4-6-20260205"),
|
|
200
|
+
general: getFullModelId("claude-sonnet-4-5-20250929"),
|
|
201
|
+
"frontend-ui-ux-engineer": getFullModelId("gemini-3-pro"),
|
|
202
|
+
"document-writer": getFullModelId("gemini-3-pro")
|
|
203
|
+
},
|
|
204
|
+
categories: {
|
|
205
|
+
"visual-engineering": getFullModelId("gemini-3-pro"),
|
|
206
|
+
ultrabrain: getFullModelId("gemini-3-pro"),
|
|
207
|
+
deep: getFullModelId("gemini-3-pro"),
|
|
208
|
+
artistry: getFullModelId("gemini-3-pro"),
|
|
209
|
+
quick: getFullModelId("claude-sonnet-4-5-20250929"),
|
|
210
|
+
"unspecified-low": getFullModelId("claude-sonnet-4-5-20250929"),
|
|
211
|
+
"unspecified-high": getFullModelId("gpt-5.2"),
|
|
212
|
+
writing: getFullModelId("gemini-3-pro"),
|
|
213
|
+
visual: getFullModelId("gemini-3-pro"),
|
|
214
|
+
"business-logic": getFullModelId("gpt-5.2"),
|
|
215
|
+
"data-analysis": getFullModelId("claude-sonnet-4-5-20250929")
|
|
216
|
+
}
|
|
217
|
+
};
|
|
7
218
|
// lib/constants.ts
|
|
8
219
|
var PLUGIN_NAME = "opencode-aicodewith-auth";
|
|
9
|
-
var
|
|
220
|
+
var PROVIDER_ID2 = PROVIDER_ID;
|
|
10
221
|
var AUTH_METHOD_LABEL = "AICodewith API Key";
|
|
11
222
|
var CODEX_BASE_URL = "https://api.aicodewith.com/chatgpt/v1";
|
|
12
223
|
var AICODEWITH_ANTHROPIC_BASE_URL = "https://api.aicodewith.com/v1";
|
|
@@ -18,6 +229,7 @@ var GEMINI_PRIVILEGED_USER_ID_ENV = "AICODEWITH_GEMINI_USER_ID";
|
|
|
18
229
|
var USER_AGENT = "codex_cli_rs/0.77.0 (Mac OS 26.2.0; arm64) iTerm.app/3.6.6";
|
|
19
230
|
var ORIGINATOR = "codex_cli_rs";
|
|
20
231
|
var SAVE_RAW_RESPONSE_ENV = "SAVE_RAW_RESPONSE";
|
|
232
|
+
var MODEL_MIGRATIONS = buildModelMigrations();
|
|
21
233
|
var HEADER_NAMES = {
|
|
22
234
|
AUTHORIZATION: "authorization",
|
|
23
235
|
ORIGINATOR: "originator",
|
|
@@ -426,56 +638,10 @@ async function getOpenCodeCodexPrompt() {
|
|
|
426
638
|
}
|
|
427
639
|
|
|
428
640
|
// lib/request/helpers/model-map.ts
|
|
429
|
-
var MODEL_MAP =
|
|
430
|
-
"gpt-5.1-codex": "gpt-5.1-codex",
|
|
431
|
-
"gpt-5.1-codex-low": "gpt-5.1-codex",
|
|
432
|
-
"gpt-5.1-codex-medium": "gpt-5.1-codex",
|
|
433
|
-
"gpt-5.1-codex-high": "gpt-5.1-codex",
|
|
434
|
-
"gpt-5.1-codex-max": "gpt-5.1-codex-max",
|
|
435
|
-
"gpt-5.1-codex-max-low": "gpt-5.1-codex-max",
|
|
436
|
-
"gpt-5.1-codex-max-medium": "gpt-5.1-codex-max",
|
|
437
|
-
"gpt-5.1-codex-max-high": "gpt-5.1-codex-max",
|
|
438
|
-
"gpt-5.1-codex-max-xhigh": "gpt-5.1-codex-max",
|
|
439
|
-
"gpt-5.2": "gpt-5.2",
|
|
440
|
-
"gpt-5.2-none": "gpt-5.2",
|
|
441
|
-
"gpt-5.2-low": "gpt-5.2",
|
|
442
|
-
"gpt-5.2-medium": "gpt-5.2",
|
|
443
|
-
"gpt-5.2-high": "gpt-5.2",
|
|
444
|
-
"gpt-5.2-xhigh": "gpt-5.2",
|
|
445
|
-
"gpt-5.2-codex": "gpt-5.2-codex",
|
|
446
|
-
"gpt-5.2-codex-low": "gpt-5.2-codex",
|
|
447
|
-
"gpt-5.2-codex-medium": "gpt-5.2-codex",
|
|
448
|
-
"gpt-5.2-codex-high": "gpt-5.2-codex",
|
|
449
|
-
"gpt-5.2-codex-xhigh": "gpt-5.2-codex",
|
|
450
|
-
"gpt-5.1-codex-mini": "gpt-5.1-codex-mini",
|
|
451
|
-
"gpt-5.1-codex-mini-medium": "gpt-5.1-codex-mini",
|
|
452
|
-
"gpt-5.1-codex-mini-high": "gpt-5.1-codex-mini",
|
|
453
|
-
"gpt-5.1": "gpt-5.1",
|
|
454
|
-
"gpt-5.1-none": "gpt-5.1",
|
|
455
|
-
"gpt-5.1-low": "gpt-5.1",
|
|
456
|
-
"gpt-5.1-medium": "gpt-5.1",
|
|
457
|
-
"gpt-5.1-high": "gpt-5.1",
|
|
458
|
-
"gpt-5.1-chat-latest": "gpt-5.1",
|
|
459
|
-
"gpt-5-codex": "gpt-5.1-codex",
|
|
460
|
-
"codex-mini-latest": "gpt-5.1-codex-mini",
|
|
461
|
-
"gpt-5-codex-mini": "gpt-5.1-codex-mini",
|
|
462
|
-
"gpt-5-codex-mini-medium": "gpt-5.1-codex-mini",
|
|
463
|
-
"gpt-5-codex-mini-high": "gpt-5.1-codex-mini",
|
|
464
|
-
"gpt-5": "gpt-5.1",
|
|
465
|
-
"gpt-5-mini": "gpt-5.1",
|
|
466
|
-
"gpt-5-nano": "gpt-5.1"
|
|
467
|
-
};
|
|
641
|
+
var MODEL_MAP = buildAliasMap();
|
|
468
642
|
function getNormalizedModel(modelId) {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
return MODEL_MAP[modelId];
|
|
472
|
-
}
|
|
473
|
-
const lowerModelId = modelId.toLowerCase();
|
|
474
|
-
const match = Object.keys(MODEL_MAP).find((key) => key.toLowerCase() === lowerModelId);
|
|
475
|
-
return match ? MODEL_MAP[match] : undefined;
|
|
476
|
-
} catch {
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
643
|
+
const lowerModelId = modelId.toLowerCase().trim();
|
|
644
|
+
return MODEL_MAP[lowerModelId];
|
|
479
645
|
}
|
|
480
646
|
|
|
481
647
|
// lib/request/helpers/input-utils.ts
|
|
@@ -651,7 +817,7 @@ var normalizeOrphanedToolOutputs = (input) => {
|
|
|
651
817
|
// lib/request/request-transformer.ts
|
|
652
818
|
function normalizeModel(model) {
|
|
653
819
|
if (!model)
|
|
654
|
-
return "gpt-5.
|
|
820
|
+
return "gpt-5.2-codex";
|
|
655
821
|
const modelId = model.includes("/") ? model.split("/").pop() : model;
|
|
656
822
|
const mappedModel = getNormalizedModel(modelId);
|
|
657
823
|
if (mappedModel) {
|
|
@@ -664,28 +830,10 @@ function normalizeModel(model) {
|
|
|
664
830
|
if (normalized.includes("gpt-5.2") || normalized.includes("gpt 5.2")) {
|
|
665
831
|
return "gpt-5.2";
|
|
666
832
|
}
|
|
667
|
-
if (normalized.includes("gpt-5.1-codex-max") || normalized.includes("gpt 5.1 codex max")) {
|
|
668
|
-
return "gpt-5.1-codex-max";
|
|
669
|
-
}
|
|
670
|
-
if (normalized.includes("gpt-5.1-codex-mini") || normalized.includes("gpt 5.1 codex mini")) {
|
|
671
|
-
return "gpt-5.1-codex-mini";
|
|
672
|
-
}
|
|
673
|
-
if (normalized.includes("codex-mini-latest") || normalized.includes("gpt-5-codex-mini") || normalized.includes("gpt 5 codex mini")) {
|
|
674
|
-
return "codex-mini-latest";
|
|
675
|
-
}
|
|
676
|
-
if (normalized.includes("gpt-5.1-codex") || normalized.includes("gpt 5.1 codex")) {
|
|
677
|
-
return "gpt-5.1-codex";
|
|
678
|
-
}
|
|
679
|
-
if (normalized.includes("gpt-5.1") || normalized.includes("gpt 5.1")) {
|
|
680
|
-
return "gpt-5.1";
|
|
681
|
-
}
|
|
682
833
|
if (normalized.includes("codex")) {
|
|
683
|
-
return "gpt-5.
|
|
684
|
-
}
|
|
685
|
-
if (normalized.includes("gpt-5") || normalized.includes("gpt 5")) {
|
|
686
|
-
return "gpt-5.1";
|
|
834
|
+
return "gpt-5.2-codex";
|
|
687
835
|
}
|
|
688
|
-
return "gpt-5.
|
|
836
|
+
return "gpt-5.2-codex";
|
|
689
837
|
}
|
|
690
838
|
function resolveReasoningConfig(modelName, body) {
|
|
691
839
|
const providerOpenAI = body.providerOptions?.openai;
|
|
@@ -754,35 +902,16 @@ function getReasoningConfig(modelName, userConfig = {}) {
|
|
|
754
902
|
const normalizedName = modelName?.toLowerCase() ?? "";
|
|
755
903
|
const isGpt52Codex = normalizedName.includes("gpt-5.2-codex") || normalizedName.includes("gpt 5.2 codex");
|
|
756
904
|
const isGpt52General = (normalizedName.includes("gpt-5.2") || normalizedName.includes("gpt 5.2")) && !isGpt52Codex;
|
|
757
|
-
const
|
|
758
|
-
const
|
|
759
|
-
const
|
|
760
|
-
const isLightweight = !isCodexMini && (normalizedName.includes("nano") || normalizedName.includes("mini"));
|
|
761
|
-
const isGpt51General = (normalizedName.includes("gpt-5.1") || normalizedName.includes("gpt 5.1")) && !isCodex && !isCodexMax && !isCodexMini;
|
|
762
|
-
const supportsXhigh = isGpt52General || isGpt52Codex || isCodexMax;
|
|
763
|
-
const supportsNone = isGpt52General || isGpt51General;
|
|
764
|
-
const defaultEffort = isCodexMini ? "medium" : supportsXhigh ? "high" : isLightweight ? "minimal" : "medium";
|
|
905
|
+
const supportsXhigh = isGpt52General || isGpt52Codex;
|
|
906
|
+
const supportsNone = isGpt52General;
|
|
907
|
+
const defaultEffort = supportsXhigh ? "high" : "medium";
|
|
765
908
|
let effort = userConfig.reasoningEffort || defaultEffort;
|
|
766
|
-
if (isCodexMini) {
|
|
767
|
-
if (effort === "minimal" || effort === "low" || effort === "none") {
|
|
768
|
-
effort = "medium";
|
|
769
|
-
}
|
|
770
|
-
if (effort === "xhigh") {
|
|
771
|
-
effort = "high";
|
|
772
|
-
}
|
|
773
|
-
if (effort !== "high" && effort !== "medium") {
|
|
774
|
-
effort = "medium";
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
909
|
if (!supportsXhigh && effort === "xhigh") {
|
|
778
910
|
effort = "high";
|
|
779
911
|
}
|
|
780
912
|
if (!supportsNone && effort === "none") {
|
|
781
913
|
effort = "low";
|
|
782
914
|
}
|
|
783
|
-
if (isCodex && effort === "minimal") {
|
|
784
|
-
effort = "low";
|
|
785
|
-
}
|
|
786
915
|
return {
|
|
787
916
|
effort,
|
|
788
917
|
summary: userConfig.reasoningSummary || "auto"
|
|
@@ -1587,6 +1716,18 @@ var syncAgentsAndCategories = (userConfig, defaultConfig) => {
|
|
|
1587
1716
|
if (!userConfig.categories) {
|
|
1588
1717
|
userConfig.categories = {};
|
|
1589
1718
|
}
|
|
1719
|
+
for (const agent of Object.values(userConfig.agents)) {
|
|
1720
|
+
if (agent.model && MODEL_MIGRATIONS[agent.model]) {
|
|
1721
|
+
agent.model = MODEL_MIGRATIONS[agent.model];
|
|
1722
|
+
changed = true;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
for (const category of Object.values(userConfig.categories)) {
|
|
1726
|
+
if (category.model && MODEL_MIGRATIONS[category.model]) {
|
|
1727
|
+
category.model = MODEL_MIGRATIONS[category.model];
|
|
1728
|
+
changed = true;
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1590
1731
|
if (defaultConfig.agents) {
|
|
1591
1732
|
for (const [name, defaultAgent] of Object.entries(defaultConfig.agents)) {
|
|
1592
1733
|
if (!userConfig.agents[name] && defaultAgent.model) {
|
|
@@ -1644,52 +1785,153 @@ var syncOmoConfig = async () => {
|
|
|
1644
1785
|
// lib/provider-config.json
|
|
1645
1786
|
var provider_config_default = {
|
|
1646
1787
|
name: "AICodewith",
|
|
1647
|
-
env: [
|
|
1788
|
+
env: [
|
|
1789
|
+
"AICODEWITH_API_KEY"
|
|
1790
|
+
],
|
|
1648
1791
|
models: {
|
|
1649
1792
|
"gpt-5.2-codex": {
|
|
1650
1793
|
name: "GPT-5.2 Codex",
|
|
1651
|
-
limit: {
|
|
1652
|
-
|
|
1794
|
+
limit: {
|
|
1795
|
+
context: 400000,
|
|
1796
|
+
output: 128000
|
|
1797
|
+
},
|
|
1798
|
+
modalities: {
|
|
1799
|
+
input: [
|
|
1800
|
+
"text",
|
|
1801
|
+
"image"
|
|
1802
|
+
],
|
|
1803
|
+
output: [
|
|
1804
|
+
"text"
|
|
1805
|
+
]
|
|
1806
|
+
}
|
|
1653
1807
|
},
|
|
1654
1808
|
"gpt-5.2": {
|
|
1655
1809
|
name: "GPT-5.2",
|
|
1656
|
-
limit: {
|
|
1657
|
-
|
|
1810
|
+
limit: {
|
|
1811
|
+
context: 400000,
|
|
1812
|
+
output: 128000
|
|
1813
|
+
},
|
|
1814
|
+
modalities: {
|
|
1815
|
+
input: [
|
|
1816
|
+
"text",
|
|
1817
|
+
"image"
|
|
1818
|
+
],
|
|
1819
|
+
output: [
|
|
1820
|
+
"text"
|
|
1821
|
+
]
|
|
1822
|
+
}
|
|
1823
|
+
},
|
|
1824
|
+
"claude-opus-4-6-20260205": {
|
|
1825
|
+
name: "Claude Opus 4.6",
|
|
1826
|
+
limit: {
|
|
1827
|
+
context: 200000,
|
|
1828
|
+
output: 64000
|
|
1829
|
+
},
|
|
1830
|
+
modalities: {
|
|
1831
|
+
input: [
|
|
1832
|
+
"text",
|
|
1833
|
+
"image"
|
|
1834
|
+
],
|
|
1835
|
+
output: [
|
|
1836
|
+
"text"
|
|
1837
|
+
]
|
|
1838
|
+
}
|
|
1839
|
+
},
|
|
1840
|
+
"claude-opus-4-6-20260205-third-party": {
|
|
1841
|
+
name: "Claude Opus 4.6 (third party)",
|
|
1842
|
+
limit: {
|
|
1843
|
+
context: 200000,
|
|
1844
|
+
output: 64000
|
|
1845
|
+
},
|
|
1846
|
+
modalities: {
|
|
1847
|
+
input: [
|
|
1848
|
+
"text",
|
|
1849
|
+
"image"
|
|
1850
|
+
],
|
|
1851
|
+
output: [
|
|
1852
|
+
"text"
|
|
1853
|
+
]
|
|
1854
|
+
}
|
|
1658
1855
|
},
|
|
1659
1856
|
"claude-sonnet-4-5-20250929": {
|
|
1660
1857
|
name: "Claude Sonnet 4.5",
|
|
1661
|
-
limit: {
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1858
|
+
limit: {
|
|
1859
|
+
context: 200000,
|
|
1860
|
+
output: 64000
|
|
1861
|
+
},
|
|
1862
|
+
modalities: {
|
|
1863
|
+
input: [
|
|
1864
|
+
"text",
|
|
1865
|
+
"image"
|
|
1866
|
+
],
|
|
1867
|
+
output: [
|
|
1868
|
+
"text"
|
|
1869
|
+
]
|
|
1870
|
+
}
|
|
1668
1871
|
},
|
|
1669
1872
|
"claude-sonnet-4-5-20250929-third-party": {
|
|
1670
1873
|
name: "Claude Sonnet 4.5 (third party)",
|
|
1671
|
-
limit: {
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1874
|
+
limit: {
|
|
1875
|
+
context: 200000,
|
|
1876
|
+
output: 64000
|
|
1877
|
+
},
|
|
1878
|
+
modalities: {
|
|
1879
|
+
input: [
|
|
1880
|
+
"text",
|
|
1881
|
+
"image"
|
|
1882
|
+
],
|
|
1883
|
+
output: [
|
|
1884
|
+
"text"
|
|
1885
|
+
]
|
|
1886
|
+
}
|
|
1678
1887
|
},
|
|
1679
1888
|
"claude-haiku-4-5-20251001": {
|
|
1680
1889
|
name: "Claude Haiku 4.5",
|
|
1681
|
-
limit: {
|
|
1682
|
-
|
|
1890
|
+
limit: {
|
|
1891
|
+
context: 200000,
|
|
1892
|
+
output: 8192
|
|
1893
|
+
},
|
|
1894
|
+
modalities: {
|
|
1895
|
+
input: [
|
|
1896
|
+
"text",
|
|
1897
|
+
"image"
|
|
1898
|
+
],
|
|
1899
|
+
output: [
|
|
1900
|
+
"text"
|
|
1901
|
+
]
|
|
1902
|
+
}
|
|
1683
1903
|
},
|
|
1684
1904
|
"claude-haiku-4-5-20251001-third-party": {
|
|
1685
1905
|
name: "Claude Haiku 4.5 (third party)",
|
|
1686
|
-
limit: {
|
|
1687
|
-
|
|
1906
|
+
limit: {
|
|
1907
|
+
context: 200000,
|
|
1908
|
+
output: 8192
|
|
1909
|
+
},
|
|
1910
|
+
modalities: {
|
|
1911
|
+
input: [
|
|
1912
|
+
"text",
|
|
1913
|
+
"image"
|
|
1914
|
+
],
|
|
1915
|
+
output: [
|
|
1916
|
+
"text"
|
|
1917
|
+
]
|
|
1918
|
+
}
|
|
1688
1919
|
},
|
|
1689
1920
|
"gemini-3-pro": {
|
|
1690
1921
|
name: "Gemini 3 Pro",
|
|
1691
|
-
limit: {
|
|
1692
|
-
|
|
1922
|
+
limit: {
|
|
1923
|
+
context: 1048576,
|
|
1924
|
+
output: 65536
|
|
1925
|
+
},
|
|
1926
|
+
modalities: {
|
|
1927
|
+
input: [
|
|
1928
|
+
"text",
|
|
1929
|
+
"image"
|
|
1930
|
+
],
|
|
1931
|
+
output: [
|
|
1932
|
+
"text"
|
|
1933
|
+
]
|
|
1934
|
+
}
|
|
1693
1935
|
}
|
|
1694
1936
|
}
|
|
1695
1937
|
};
|
|
@@ -1764,10 +2006,10 @@ var buildStandardProviderConfig = () => ({
|
|
|
1764
2006
|
var applyProviderConfig = (config) => {
|
|
1765
2007
|
let changed = false;
|
|
1766
2008
|
const providerMap = config.provider && typeof config.provider === "object" ? config.provider : {};
|
|
1767
|
-
const existingProvider = providerMap[
|
|
2009
|
+
const existingProvider = providerMap[PROVIDER_ID2];
|
|
1768
2010
|
const standardProvider = buildStandardProviderConfig();
|
|
1769
2011
|
if (!deepEqual(existingProvider, standardProvider)) {
|
|
1770
|
-
providerMap[
|
|
2012
|
+
providerMap[PROVIDER_ID2] = standardProvider;
|
|
1771
2013
|
config.provider = providerMap;
|
|
1772
2014
|
changed = true;
|
|
1773
2015
|
}
|
|
@@ -1776,6 +2018,10 @@ var applyProviderConfig = (config) => {
|
|
|
1776
2018
|
config.plugin = nextPlugins;
|
|
1777
2019
|
changed = true;
|
|
1778
2020
|
}
|
|
2021
|
+
if (config.model && MODEL_MIGRATIONS[config.model]) {
|
|
2022
|
+
config.model = MODEL_MIGRATIONS[config.model];
|
|
2023
|
+
changed = true;
|
|
2024
|
+
}
|
|
1779
2025
|
return changed;
|
|
1780
2026
|
};
|
|
1781
2027
|
var ensureConfigFile = async () => {
|
|
@@ -1913,7 +2159,7 @@ var AicodewithCodexAuthPlugin = async (ctx) => {
|
|
|
1913
2159
|
});
|
|
1914
2160
|
const autoUpdateHook = createAutoUpdateHook(ctx, { autoUpdate: true });
|
|
1915
2161
|
const authHook = {
|
|
1916
|
-
provider:
|
|
2162
|
+
provider: PROVIDER_ID2,
|
|
1917
2163
|
loader: async (getAuth, _provider) => {
|
|
1918
2164
|
const auth = await getAuth();
|
|
1919
2165
|
if (auth.type !== "api" || !auth.key) {
|
|
@@ -2003,7 +2249,7 @@ var AicodewithCodexAuthPlugin = async (ctx) => {
|
|
|
2003
2249
|
},
|
|
2004
2250
|
event: autoUpdateHook.event,
|
|
2005
2251
|
"chat.params": async (input, output) => {
|
|
2006
|
-
if (input.model.providerID !==
|
|
2252
|
+
if (input.model.providerID !== PROVIDER_ID2)
|
|
2007
2253
|
return;
|
|
2008
2254
|
if (!input.model.id?.startsWith("claude-"))
|
|
2009
2255
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-aicodewith-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "OpenCode plugin for AICodewith authentication - Access GPT-5.2, Claude, and Gemini models through AICodewith API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,10 +19,14 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "bun build index.ts provider.ts --outdir dist --target bun --format esm --external @ai-sdk/anthropic --external @ai-sdk/google --external @ai-sdk/openai --external @ai-sdk/provider --external @ai-sdk/provider-utils --external @opencode-ai/plugin --external @opencode-ai/sdk",
|
|
22
|
+
"build": "bun run generate:config && bun build index.ts provider.ts --outdir dist --target bun --format esm --external @ai-sdk/anthropic --external @ai-sdk/google --external @ai-sdk/openai --external @ai-sdk/provider --external @ai-sdk/provider-utils --external @opencode-ai/plugin --external @opencode-ai/sdk",
|
|
23
23
|
"clean": "rm -rf dist",
|
|
24
|
+
"generate:config": "bun scripts/generate-provider-config.ts && bun scripts/generate-omo-config.ts",
|
|
24
25
|
"prepublishOnly": "bun run clean && bun run build",
|
|
25
26
|
"typecheck": "bunx tsc --noEmit",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage",
|
|
26
30
|
"postinstall": "bun ./scripts/install-opencode-aicodewith.js"
|
|
27
31
|
},
|
|
28
32
|
"keywords": [
|
|
@@ -58,6 +62,7 @@
|
|
|
58
62
|
},
|
|
59
63
|
"devDependencies": {
|
|
60
64
|
"@types/node": "^22.19.8",
|
|
61
|
-
"typescript": "^5.9.3"
|
|
65
|
+
"typescript": "^5.9.3",
|
|
66
|
+
"vitest": "^4.0.18"
|
|
62
67
|
}
|
|
63
68
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file index.ts
|
|
3
|
-
* @input OpenCode plugin context, auth credentials
|
|
4
|
-
* @output Auth hook, config injection, fetch interceptor
|
|
5
|
-
* @pos Plugin entry point - orchestrates auth and request routing
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + README.md file index
|
|
8
|
-
*/
|
|
9
|
-
import type { Plugin } from "@opencode-ai/plugin";
|
|
10
|
-
export declare const AicodewithCodexAuthPlugin: Plugin;
|
|
11
|
-
export default AicodewithCodexAuthPlugin;
|
package/dist/lib/constants.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file constants.ts
|
|
3
|
-
* @input -
|
|
4
|
-
* @output Global constants (URLs, header names, provider IDs)
|
|
5
|
-
* @pos Foundation - imported by most other modules
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
export declare const PLUGIN_NAME = "opencode-aicodewith-auth";
|
|
10
|
-
export declare const PROVIDER_ID = "aicodewith";
|
|
11
|
-
export declare const AUTH_METHOD_LABEL = "AICodewith API Key";
|
|
12
|
-
export declare const CODEX_BASE_URL = "https://api.aicodewith.com/chatgpt/v1";
|
|
13
|
-
export declare const AICODEWITH_ANTHROPIC_BASE_URL = "https://api.aicodewith.com/v1";
|
|
14
|
-
export declare const AICODEWITH_LITE_URL = "https://api.aicodewith.com/lite";
|
|
15
|
-
export declare const AICODEWITH_GEMINI_BASE_URL = "https://api.aicodewith.com/gemini_cli";
|
|
16
|
-
export declare const GEMINI_USER_AGENT = "GeminiCLI/v25.2.1 (darwin; arm64)";
|
|
17
|
-
export declare const GEMINI_API_CLIENT = "google-genai-sdk/1.30.0 gl-node/v25.2.1";
|
|
18
|
-
export declare const GEMINI_PRIVILEGED_USER_ID_ENV = "AICODEWITH_GEMINI_USER_ID";
|
|
19
|
-
export declare const USER_AGENT = "codex_cli_rs/0.77.0 (Mac OS 26.2.0; arm64) iTerm.app/3.6.6";
|
|
20
|
-
export declare const ORIGINATOR = "codex_cli_rs";
|
|
21
|
-
export declare const SAVE_RAW_RESPONSE_ENV = "SAVE_RAW_RESPONSE";
|
|
22
|
-
export declare const HEADER_NAMES: {
|
|
23
|
-
readonly AUTHORIZATION: "authorization";
|
|
24
|
-
readonly ORIGINATOR: "originator";
|
|
25
|
-
readonly SESSION_ID: "session_id";
|
|
26
|
-
readonly CONVERSATION_ID: "conversation_id";
|
|
27
|
-
readonly USER_AGENT: "user-agent";
|
|
28
|
-
readonly ACCEPT: "accept";
|
|
29
|
-
readonly CONTENT_TYPE: "content-type";
|
|
30
|
-
readonly OPENAI_BETA: "openai-beta";
|
|
31
|
-
readonly CHATGPT_ACCOUNT_ID: "chatgpt-account-id";
|
|
32
|
-
readonly X_GOOG_API_KEY: "x-goog-api-key";
|
|
33
|
-
readonly X_GOOG_API_CLIENT: "x-goog-api-client";
|
|
34
|
-
readonly X_GEMINI_PRIVILEGED_USER_ID: "x-gemini-api-privileged-user-id";
|
|
35
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function invalidatePackage(packageName?: string): boolean;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { PluginEntryInfo } from "./types";
|
|
2
|
-
declare function log(...args: unknown[]): void;
|
|
3
|
-
export declare function isLocalDevMode(directory: string): boolean;
|
|
4
|
-
export declare function getLocalDevPath(directory: string): string | null;
|
|
5
|
-
export declare function getLocalDevVersion(directory: string): string | null;
|
|
6
|
-
export declare function findPluginEntry(directory: string): PluginEntryInfo | null;
|
|
7
|
-
export declare function getCachedVersion(): string | null;
|
|
8
|
-
export declare function updatePinnedVersion(configPath: string, oldEntry: string, newVersion: string): boolean;
|
|
9
|
-
export declare function getLatestVersion(): Promise<string | null>;
|
|
10
|
-
export declare function hasOhMyOpencode(directory: string): boolean;
|
|
11
|
-
export { log };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file constants.ts
|
|
3
|
-
* @input None
|
|
4
|
-
* @output Auto-update configuration constants
|
|
5
|
-
* @pos Constants for package paths, npm registry, cache directories
|
|
6
|
-
*/
|
|
7
|
-
export declare const PACKAGE_NAME = "opencode-aicodewith-auth";
|
|
8
|
-
export declare const NPM_REGISTRY_URL = "https://registry.npmjs.org/-/package/opencode-aicodewith-auth/dist-tags";
|
|
9
|
-
export declare const NPM_FETCH_TIMEOUT = 5000;
|
|
10
|
-
export declare const CACHE_DIR: string;
|
|
11
|
-
export declare const INSTALLED_PACKAGE_JSON: string;
|
|
12
|
-
export declare function getWindowsAppdataDir(): string | null;
|
|
13
|
-
export declare const USER_CONFIG_DIR: string;
|
|
14
|
-
export declare const USER_OPENCODE_CONFIG: string;
|
|
15
|
-
export declare const USER_OPENCODE_CONFIG_JSONC: string;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
import type { AutoUpdateOptions } from "./types";
|
|
3
|
-
export declare function createAutoUpdateHook(ctx: PluginInput, options?: AutoUpdateOptions): {
|
|
4
|
-
event: ({ event }: {
|
|
5
|
-
event: {
|
|
6
|
-
type: string;
|
|
7
|
-
properties?: unknown;
|
|
8
|
-
};
|
|
9
|
-
}) => Promise<void>;
|
|
10
|
-
};
|
|
11
|
-
export type { AutoUpdateOptions } from "./types";
|
|
12
|
-
export { invalidatePackage } from "./cache";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface NpmDistTags {
|
|
2
|
-
latest: string;
|
|
3
|
-
[key: string]: string;
|
|
4
|
-
}
|
|
5
|
-
export interface OpencodeConfig {
|
|
6
|
-
plugin?: string[];
|
|
7
|
-
[key: string]: unknown;
|
|
8
|
-
}
|
|
9
|
-
export interface PackageJson {
|
|
10
|
-
version: string;
|
|
11
|
-
name?: string;
|
|
12
|
-
[key: string]: unknown;
|
|
13
|
-
}
|
|
14
|
-
export interface UpdateCheckResult {
|
|
15
|
-
needsUpdate: boolean;
|
|
16
|
-
currentVersion: string | null;
|
|
17
|
-
latestVersion: string | null;
|
|
18
|
-
isLocalDev: boolean;
|
|
19
|
-
isPinned: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface AutoUpdateOptions {
|
|
22
|
-
autoUpdate?: boolean;
|
|
23
|
-
showStartupToast?: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface PluginEntryInfo {
|
|
26
|
-
entry: string;
|
|
27
|
-
isPinned: boolean;
|
|
28
|
-
pinnedVersion: string | null;
|
|
29
|
-
configPath: string;
|
|
30
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file lib/hooks/omo-config-sync/index.ts
|
|
3
|
-
* @input OpenCode config directory + GitHub default config
|
|
4
|
-
* @output Synced oh-my-opencode.json with aicodewith models
|
|
5
|
-
* @pos Auto-sync OMO agent configs to use aicodewith provider
|
|
6
|
-
*
|
|
7
|
-
* Sync Logic:
|
|
8
|
-
* 1. Fetch default config from GitHub (with local fallback)
|
|
9
|
-
* 2. For each agent/category in default config:
|
|
10
|
-
* - User config doesn't exist → create with default value
|
|
11
|
-
* - User config exists with different model → keep user's (user customized)
|
|
12
|
-
* - User config exists with same model → no change
|
|
13
|
-
*/
|
|
14
|
-
export declare const syncOmoConfig: () => Promise<void>;
|
package/dist/lib/logger.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file logger.ts
|
|
3
|
-
* @input Log stage, data objects
|
|
4
|
-
* @output File logs (~/.opencode/logs/), console debug output
|
|
5
|
-
* @pos Utility - debug/request logging for development
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
export declare const LOGGING_ENABLED: boolean;
|
|
10
|
-
export declare const DEBUG_ENABLED: boolean;
|
|
11
|
-
export declare const SAVE_RAW_RESPONSE_ENABLED: boolean;
|
|
12
|
-
export declare function logRequest(stage: string, data: Record<string, unknown>): void;
|
|
13
|
-
export declare function logDebug(message: string, data?: unknown): void;
|
|
14
|
-
export declare function logWarn(message: string, data?: unknown): void;
|
|
15
|
-
/**
|
|
16
|
-
* Save raw response to temp directory
|
|
17
|
-
* @param provider - Provider name (codex, claude, gemini)
|
|
18
|
-
* @param responseBody - Raw response body string
|
|
19
|
-
* @param metadata - Optional metadata (url, status, etc.)
|
|
20
|
-
*/
|
|
21
|
-
export declare function saveRawResponse(provider: string, responseBody: string, metadata?: {
|
|
22
|
-
url?: string;
|
|
23
|
-
status?: number;
|
|
24
|
-
model?: string;
|
|
25
|
-
}): void;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file codex-opencode-bridge.ts
|
|
3
|
-
* @input -
|
|
4
|
-
* @output CODEX_OPENCODE_BRIDGE constant (tool remapping rules)
|
|
5
|
-
* @pos Bridge layer - maps Codex tools to OpenCode equivalents
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/prompts/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Codex-OpenCode Bridge Prompt
|
|
11
|
-
*
|
|
12
|
-
* This prompt bridges Codex CLI instructions to the OpenCode environment.
|
|
13
|
-
* It incorporates critical tool mappings, available tools list, substitution rules,
|
|
14
|
-
* and verification checklist to ensure proper tool usage.
|
|
15
|
-
*
|
|
16
|
-
* Token Count: ~450 tokens (~90% reduction vs full OpenCode prompt)
|
|
17
|
-
*/
|
|
18
|
-
export declare const CODEX_OPENCODE_BRIDGE = "# Codex Running in OpenCode\n\nYou are running Codex through OpenCode, an open-source terminal coding assistant. OpenCode provides different tools but follows Codex operating principles.\n\n## CRITICAL: Tool Replacements\n\n<critical_rule priority=\"0\">\n\u274C APPLY_PATCH DOES NOT EXIST \u2192 \u2705 USE \"edit\" INSTEAD\n- NEVER use: apply_patch, applyPatch\n- ALWAYS use: edit tool for ALL file modifications\n- Before modifying files: Verify you're using \"edit\", NOT \"apply_patch\"\n</critical_rule>\n\n<critical_rule priority=\"0\">\n\u274C UPDATE_PLAN DOES NOT EXIST \u2192 \u2705 USE \"todowrite\" INSTEAD\n- NEVER use: update_plan, updatePlan, read_plan, readPlan\n- ALWAYS use: todowrite for task/plan updates, todoread to read plans\n- Before plan operations: Verify you're using \"todowrite\", NOT \"update_plan\"\n</critical_rule>\n\n## Available OpenCode Tools\n\n**File Operations:**\n- `write` - Create new files\n - Overwriting existing files requires a prior Read in this session; default to ASCII unless the file already uses Unicode.\n- `edit` - Modify existing files (REPLACES apply_patch)\n - Requires a prior Read in this session; preserve exact indentation; ensure `oldString` uniquely matches or use `replaceAll`; edit fails if ambiguous or missing.\n- `read` - Read file contents\n\n**Search/Discovery:**\n- `grep` - Search file contents (tool, not bash grep); use `include` to filter patterns; set `path` only when not searching workspace root; for cross-file match counts use bash with `rg`.\n- `glob` - Find files by pattern; defaults to workspace cwd unless `path` is set.\n- `list` - List directories (requires absolute paths)\n\n**Execution:**\n- `bash` - Run shell commands\n - No workdir parameter; do not include it in tool calls.\n - Always include a short description for the command.\n - Do not use cd; use absolute paths in commands.\n - Quote paths containing spaces with double quotes.\n - Chain multiple commands with ';' or '&&'; avoid newlines.\n - Use Grep/Glob tools for searches; only use bash with `rg` when you need counts or advanced features.\n - Do not use `ls`/`cat` in bash; use `list`/`read` tools instead.\n - For deletions (rm), verify by listing parent dir with `list`.\n\n**Network:**\n- `webfetch` - Fetch web content\n - Use fully-formed URLs (http/https; http auto-upgrades to https).\n - Always set `format` to one of: text | markdown | html; prefer markdown unless otherwise required.\n - Read-only; short cache window.\n\n**Task Management:**\n- `todowrite` - Manage tasks/plans (REPLACES update_plan)\n- `todoread` - Read current plan\n\n## Substitution Rules\n\nBase instruction says: You MUST use instead:\napply_patch \u2192 edit\nupdate_plan \u2192 todowrite\nread_plan \u2192 todoread\n\n**Path Usage:** Use per-tool conventions to avoid conflicts:\n- Tool calls: `read`, `edit`, `write`, `list` require absolute paths.\n- Searches: `grep`/`glob` default to the workspace cwd; prefer relative include patterns; set `path` only when a different root is needed.\n- Presentation: In assistant messages, show workspace-relative paths; use absolute paths only inside tool calls.\n- Tool schema overrides general path preferences\u2014do not convert required absolute paths to relative.\n\n## Verification Checklist\n\nBefore file/plan modifications:\n1. Am I using \"edit\" NOT \"apply_patch\"?\n2. Am I using \"todowrite\" NOT \"update_plan\"?\n3. Is this tool in the approved list above?\n4. Am I following each tool's path requirements?\n\nIf ANY answer is NO \u2192 STOP and correct before proceeding.\n\n## OpenCode Working Style\n\n**Communication:**\n- Send brief preambles (8-12 words) before tool calls, building on prior context\n- Provide progress updates during longer tasks\n\n**Execution:**\n- Keep working autonomously until query is fully resolved before yielding\n- Don't return to user with partial solutions\n\n**Code Approach:**\n- New projects: Be ambitious and creative\n- Existing codebases: Surgical precision - modify only what's requested unless explicitly instructed to do otherwise\n\n**Testing:**\n- If tests exist: Start specific to your changes, then broader validation\n\n## Advanced Tools\n\n**Task Tool (Sub-Agents):**\n- Use the Task tool (functions.task) to launch sub-agents\n- Check the Task tool description for current agent types and their capabilities\n- Useful for complex analysis, specialized workflows, or tasks requiring isolated context\n- The agent list is dynamically generated - refer to tool schema for available agents\n\n**Parallelization:**\n- When multiple independent tool calls are needed, use multi_tool_use.parallel to run them concurrently.\n- Reserve sequential calls for ordered or data-dependent steps.\n\n**MCP Tools:**\n- Model Context Protocol servers provide additional capabilities\n- MCP tools are prefixed: `mcp__<server-name>__<tool-name>`\n- Check your available tools for MCP integrations\n- Use when the tool's functionality matches your task needs\n\n## What Remains from Codex\n \nSandbox policies, approval mechanisms, final answer formatting, git commit protocols, and file reference formats all follow Codex instructions. In approval policy \"never\", never request escalations.\n\n## Approvals & Safety\n- Assume workspace-write filesystem, network enabled, approval on-failure unless explicitly stated otherwise.\n- When a command fails due to sandboxing or permissions, retry with escalated permissions if allowed by policy, including a one-line justification.\n- Treat destructive commands (e.g., `rm`, `git reset --hard`) as requiring explicit user request or approval.\n- When uncertain, prefer non-destructive verification first (e.g., confirm file existence with `list`, then delete with `bash`).";
|
|
19
|
-
export interface CodexOpenCodeBridgeMeta {
|
|
20
|
-
estimatedTokens: number;
|
|
21
|
-
reductionVsCurrent: string;
|
|
22
|
-
reductionVsToolRemap: string;
|
|
23
|
-
protects: string[];
|
|
24
|
-
omits: string[];
|
|
25
|
-
}
|
|
26
|
-
export declare const CODEX_OPENCODE_BRIDGE_META: CodexOpenCodeBridgeMeta;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file codex.ts
|
|
3
|
-
* @input Normalized model name
|
|
4
|
-
* @output Codex system prompt (fetched from GitHub, cached)
|
|
5
|
-
* @pos Prompt provider - fetches model-specific instructions from openai/codex repo
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/prompts/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
export type ModelFamily = "gpt-5.2-codex" | "codex-max" | "codex" | "gpt-5.2" | "gpt-5.1";
|
|
10
|
-
export declare function getModelFamily(normalizedModel: string): ModelFamily;
|
|
11
|
-
export declare function getCodexInstructions(normalizedModel?: string): Promise<string>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file opencode-codex.ts
|
|
3
|
-
* @input -
|
|
4
|
-
* @output OpenCode's codex.txt prompt (for filtering duplicate system prompts)
|
|
5
|
-
* @pos Prompt fetcher - caches OpenCode's system prompt for comparison
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/prompts/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Fetch OpenCode's codex.txt prompt with ETag-based caching
|
|
11
|
-
* Uses HTTP conditional requests to efficiently check for updates
|
|
12
|
-
*
|
|
13
|
-
* Rate limit protection: Only checks GitHub if cache is older than 15 minutes
|
|
14
|
-
* @returns The codex.txt content
|
|
15
|
-
*/
|
|
16
|
-
export declare function getOpenCodeCodexPrompt(): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Get first N characters of the cached OpenCode prompt for verification
|
|
19
|
-
* @param chars Number of characters to get (default: 50)
|
|
20
|
-
* @returns First N characters or null if not cached
|
|
21
|
-
*/
|
|
22
|
-
export declare function getCachedPromptPrefix(chars?: number): Promise<string | null>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file claude-tools-transform.ts
|
|
3
|
-
* @input Claude API request body and response
|
|
4
|
-
* @output Transformed request/response with mcp_ prefix handling and metadata
|
|
5
|
-
* @pos Handles tool name transformation to bypass Claude Code OAuth restrictions
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/request/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Transform Claude API request to add mcp_ prefix to tool names and inject user_id metadata
|
|
11
|
-
* This bypasses the "This credential is only authorized for use with Claude Code" error
|
|
12
|
-
*/
|
|
13
|
-
export declare function transformClaudeRequest(init?: RequestInit): RequestInit | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Transform Claude API response to remove mcp_ prefix from tool names
|
|
16
|
-
* This restores the original tool names in the streaming response
|
|
17
|
-
*/
|
|
18
|
-
export declare function transformClaudeResponse(response: Response): Response;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file fetch-helpers.ts
|
|
3
|
-
* @input Raw request, API key, RequestInit
|
|
4
|
-
* @output Transformed headers, URL extraction, response handlers
|
|
5
|
-
* @pos Request layer entry - coordinates transformation and response handling
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/request/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
import type { RequestBody } from "../types";
|
|
10
|
-
export declare function extractRequestUrl(input: Request | string | URL): string;
|
|
11
|
-
export declare function transformRequestForCodex(init?: RequestInit): Promise<{
|
|
12
|
-
body: RequestBody;
|
|
13
|
-
updatedInit: RequestInit;
|
|
14
|
-
} | undefined>;
|
|
15
|
-
export declare function createAicodewithHeaders(init: RequestInit | undefined, apiKey: string, opts?: {
|
|
16
|
-
promptCacheKey?: string;
|
|
17
|
-
}): Headers;
|
|
18
|
-
export declare function handleErrorResponse(response: Response): Promise<Response>;
|
|
19
|
-
export declare function handleSuccessResponse(response: Response, isStreaming: boolean): Promise<Response>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file input-utils.ts
|
|
3
|
-
* @input InputItem[], cached OpenCode prompt
|
|
4
|
-
* @output Filtered InputItem[] (OpenCode prompts removed, orphaned outputs fixed)
|
|
5
|
-
* @pos Helper - message filtering and tool output normalization
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/request/helpers/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
import type { InputItem } from "../../types";
|
|
10
|
-
export declare const getContentText: (item: InputItem) => string;
|
|
11
|
-
export declare function isOpenCodeSystemPrompt(item: InputItem, cachedPrompt: string | null): boolean;
|
|
12
|
-
export declare function filterOpenCodeSystemPromptsWithCachedPrompt(input: InputItem[] | undefined, cachedPrompt: string | null): InputItem[] | undefined;
|
|
13
|
-
export declare const normalizeOrphanedToolOutputs: (input: InputItem[]) => InputItem[];
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file model-map.ts
|
|
3
|
-
* @input Config model ID (e.g., "gpt-5.2-codex-high")
|
|
4
|
-
* @output Normalized API model name (e.g., "gpt-5.2-codex")
|
|
5
|
-
* @pos Helper - static model ID mapping for all supported variants
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/request/helpers/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Model Configuration Map
|
|
11
|
-
*
|
|
12
|
-
* Maps model config IDs to their normalized API model names.
|
|
13
|
-
* Only includes exact config IDs that OpenCode will pass to the plugin.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Map of config model IDs to normalized API model names
|
|
17
|
-
*
|
|
18
|
-
* Key: The model ID as specified in opencode.json config
|
|
19
|
-
* Value: The normalized model name to send to the API
|
|
20
|
-
*/
|
|
21
|
-
export declare const MODEL_MAP: Record<string, string>;
|
|
22
|
-
/**
|
|
23
|
-
* Get normalized model name from config ID
|
|
24
|
-
*
|
|
25
|
-
* @param modelId - Model ID from config (e.g., "gpt-5.1-codex-low")
|
|
26
|
-
* @returns Normalized model name (e.g., "gpt-5.1-codex") or undefined if not found
|
|
27
|
-
*/
|
|
28
|
-
export declare function getNormalizedModel(modelId: string): string | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Check if a model ID is in the model map
|
|
31
|
-
*
|
|
32
|
-
* @param modelId - Model ID to check
|
|
33
|
-
* @returns True if model is in the map
|
|
34
|
-
*/
|
|
35
|
-
export declare function isKnownModel(modelId: string): boolean;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file request-transformer.ts
|
|
3
|
-
* @input RequestBody from OpenCode
|
|
4
|
-
* @output Transformed RequestBody for Codex API
|
|
5
|
-
* @pos Core transformation - model normalization, reasoning config, input filtering
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/request/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
import type { ConfigOptions, InputItem, ReasoningConfig, RequestBody } from "../types";
|
|
10
|
-
export declare function normalizeModel(model: string | undefined): string;
|
|
11
|
-
export declare function filterInput(input: InputItem[] | undefined): InputItem[] | undefined;
|
|
12
|
-
export declare function filterOpenCodeSystemPrompts(input: InputItem[] | undefined): Promise<InputItem[] | undefined>;
|
|
13
|
-
export declare function addCodexBridgeMessage(input: InputItem[] | undefined, hasTools: boolean): InputItem[] | undefined;
|
|
14
|
-
export declare function getReasoningConfig(modelName: string | undefined, userConfig?: ConfigOptions): ReasoningConfig;
|
|
15
|
-
export declare function transformRequestBody(body: RequestBody, codexInstructions: string): Promise<RequestBody>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file response-handler.ts
|
|
3
|
-
* @input SSE Response stream
|
|
4
|
-
* @output JSON Response (for non-streaming) or passthrough (for streaming)
|
|
5
|
-
* @pos Response layer - SSE parsing and content-type handling
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/request/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Convert SSE stream response to JSON for generateText()
|
|
11
|
-
* @param response - Fetch response with SSE stream
|
|
12
|
-
* @param headers - Response headers
|
|
13
|
-
* @returns Response with JSON body
|
|
14
|
-
*/
|
|
15
|
-
export declare function convertSseToJson(response: Response, headers: Headers): Promise<Response>;
|
|
16
|
-
/**
|
|
17
|
-
* Ensure response has content-type header
|
|
18
|
-
* @param headers - Response headers
|
|
19
|
-
* @returns Headers with content-type set
|
|
20
|
-
*/
|
|
21
|
-
export declare function ensureContentType(headers: Headers): Headers;
|
package/dist/lib/types.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file types.ts
|
|
3
|
-
* @input -
|
|
4
|
-
* @output TypeScript interfaces (RequestBody, InputItem, etc.)
|
|
5
|
-
* @pos Foundation - shared type definitions across lib/
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + lib/ARCHITECTURE.md
|
|
8
|
-
*/
|
|
9
|
-
export interface ConfigOptions {
|
|
10
|
-
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
11
|
-
reasoningSummary?: "auto" | "concise" | "detailed" | "off" | "on";
|
|
12
|
-
textVerbosity?: "low" | "medium" | "high";
|
|
13
|
-
include?: string[];
|
|
14
|
-
}
|
|
15
|
-
export interface ReasoningConfig {
|
|
16
|
-
effort: "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
17
|
-
summary: "auto" | "concise" | "detailed" | "off" | "on";
|
|
18
|
-
}
|
|
19
|
-
export interface InputItem {
|
|
20
|
-
id?: string;
|
|
21
|
-
type: string;
|
|
22
|
-
role: string;
|
|
23
|
-
content?: unknown;
|
|
24
|
-
[key: string]: unknown;
|
|
25
|
-
}
|
|
26
|
-
export interface RequestBody {
|
|
27
|
-
model: string;
|
|
28
|
-
store?: boolean;
|
|
29
|
-
stream?: boolean;
|
|
30
|
-
instructions?: string;
|
|
31
|
-
input?: InputItem[];
|
|
32
|
-
tools?: unknown;
|
|
33
|
-
reasoning?: Partial<ReasoningConfig>;
|
|
34
|
-
text?: {
|
|
35
|
-
verbosity?: "low" | "medium" | "high";
|
|
36
|
-
};
|
|
37
|
-
include?: string[];
|
|
38
|
-
providerOptions?: {
|
|
39
|
-
openai?: Partial<ConfigOptions> & {
|
|
40
|
-
store?: boolean;
|
|
41
|
-
include?: string[];
|
|
42
|
-
};
|
|
43
|
-
[key: string]: unknown;
|
|
44
|
-
};
|
|
45
|
-
prompt_cache_key?: string;
|
|
46
|
-
max_output_tokens?: number;
|
|
47
|
-
max_completion_tokens?: number;
|
|
48
|
-
[key: string]: unknown;
|
|
49
|
-
}
|
|
50
|
-
export interface SSEEventData {
|
|
51
|
-
type: string;
|
|
52
|
-
response?: unknown;
|
|
53
|
-
[key: string]: unknown;
|
|
54
|
-
}
|
|
55
|
-
export interface CacheMetadata {
|
|
56
|
-
etag: string | null;
|
|
57
|
-
tag: string;
|
|
58
|
-
lastChecked: number;
|
|
59
|
-
url: string;
|
|
60
|
-
}
|
|
61
|
-
export interface GitHubRelease {
|
|
62
|
-
tag_name: string;
|
|
63
|
-
[key: string]: unknown;
|
|
64
|
-
}
|
package/dist/provider.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file provider.ts
|
|
3
|
-
* @input Provider settings (apiKey, baseURL, headers)
|
|
4
|
-
* @output Multi-provider language model factory (OpenAI/Anthropic/Google)
|
|
5
|
-
* @pos Core provider - routes model requests to appropriate SDK
|
|
6
|
-
*
|
|
7
|
-
* 📌 On change: Update this header + README.md file index
|
|
8
|
-
*/
|
|
9
|
-
import type { LanguageModelV2 } from "@ai-sdk/provider";
|
|
10
|
-
import type { FetchFunction } from "@ai-sdk/provider-utils";
|
|
11
|
-
export type AicodewithProviderSettings = {
|
|
12
|
-
apiKey?: string;
|
|
13
|
-
baseURL?: string;
|
|
14
|
-
headers?: Record<string, string>;
|
|
15
|
-
fetch?: FetchFunction;
|
|
16
|
-
anthropic?: {
|
|
17
|
-
apiKey?: string;
|
|
18
|
-
baseURL?: string;
|
|
19
|
-
headers?: Record<string, string>;
|
|
20
|
-
};
|
|
21
|
-
google?: {
|
|
22
|
-
apiKey?: string;
|
|
23
|
-
baseURL?: string;
|
|
24
|
-
headers?: Record<string, string>;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export interface AicodewithProvider {
|
|
28
|
-
(modelId: string): LanguageModelV2;
|
|
29
|
-
chat(modelId: string): LanguageModelV2;
|
|
30
|
-
responses(modelId: string): LanguageModelV2;
|
|
31
|
-
languageModel(modelId: string): LanguageModelV2;
|
|
32
|
-
}
|
|
33
|
-
export declare function createAicodewith(options?: AicodewithProviderSettings): AicodewithProvider;
|