opencode-aicodewith-auth 0.1.11 → 0.1.14

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 CHANGED
@@ -185,9 +185,9 @@ If the output is NOT `https://registry.npmjs.org/` (e.g., shows taobao, cnpm, or
185
185
  > 你现在可以使用以下模型:
186
186
  > - `gpt-5.2-codex`
187
187
  > - `gpt-5.2`
188
- > - `claude-sonnet-4-5-20250929`
189
- > - `claude-opus-4-5-20251101`
190
- > - `gemini-3-pro-high`
188
+ > - `claude-sonnet-4-5`
189
+ > - `claude-opus-4-5`
190
+ > - `gemini-3-pro`
191
191
  >
192
192
  > 测试命令: `opencode --model gpt-5.2-codex`"
193
193
 
@@ -197,9 +197,9 @@ If the output is NOT `https://registry.npmjs.org/` (e.g., shows taobao, cnpm, or
197
197
  > 你现在可以使用以下模型:
198
198
  > - `gpt-5.2-codex`
199
199
  > - `gpt-5.2`
200
- > - `claude-sonnet-4-5-20250929`
201
- > - `claude-opus-4-5-20251101`
202
- > - `gemini-3-pro-high`
200
+ > - `claude-sonnet-4-5`
201
+ > - `claude-opus-4-5`
202
+ > - `gemini-3-pro`
203
203
  >
204
204
  > 测试命令: `opencode --model gpt-5.2-codex`
205
205
  >
package/README.md CHANGED
@@ -63,9 +63,9 @@ User Request → OpenCode → Plugin Auth Hook → Route by Model:
63
63
  |---------|---------|:-------:|---------|
64
64
  | `aicodewith/gpt-5.2-codex` | GPT-5.2 Codex | ✅ | 日常编程、代码生成 |
65
65
  | `aicodewith/gpt-5.2` | GPT-5.2 | ✅ | 架构设计、逻辑推理 |
66
- | `aicodewith/claude-sonnet-4-5-20250929` | Claude Sonnet 4.5 | ✅ | 代码审查、文档查询 |
67
- | `aicodewith/claude-opus-4-5-20251101` | Claude Opus 4.5 | ✅ | 复杂任务、深度思考 |
68
- | `aicodewith/gemini-3-pro-high` | Gemini 3 Pro | ✅ | 前端 UI、多模态任务 |
66
+ | `aicodewith/claude-sonnet-4-5` | Claude Sonnet 4.5 | ✅ | 代码审查、文档查询 |
67
+ | `aicodewith/claude-opus-4-5` | Claude Opus 4.5 | ✅ | 复杂任务、深度思考 |
68
+ | `aicodewith/gemini-3-pro` | Gemini 3 Pro | ✅ | 前端 UI、多模态任务 |
69
69
 
70
70
  ---
71
71
 
package/dist/index.js CHANGED
@@ -68,7 +68,7 @@ var PLUGIN_NAME = "opencode-aicodewith-auth";
68
68
  var PROVIDER_ID = "aicodewith";
69
69
  var AUTH_METHOD_LABEL = "AICodewith API Key";
70
70
  var CODEX_BASE_URL = "https://api.aicodewith.com/chatgpt/v1";
71
- var AICODEWITH_ANTHROPIC_BASE_URL = "https://api.aicodewith.com";
71
+ var AICODEWITH_ANTHROPIC_BASE_URL = "https://api.aicodewith.com/v1";
72
72
  var AICODEWITH_GEMINI_BASE_URL = "https://api.aicodewith.com/gemini_cli";
73
73
  var GEMINI_USER_AGENT = "GeminiCLI/v25.2.1 (darwin; arm64)";
74
74
  var GEMINI_API_CLIENT = "google-genai-sdk/1.30.0 gl-node/v25.2.1";
@@ -853,7 +853,6 @@ async function transformRequestBody(body, codexInstructions) {
853
853
  hasTools: !!body.tools
854
854
  });
855
855
  body.model = normalizedModel;
856
- body.store = false;
857
856
  body.stream = true;
858
857
  body.instructions = codexInstructions;
859
858
  if (body.input && Array.isArray(body.input)) {
@@ -1501,15 +1500,15 @@ var provider_config_default = {
1501
1500
  name: "GPT-5.2",
1502
1501
  modalities: { input: ["text", "image"], output: ["text"] }
1503
1502
  },
1504
- "claude-sonnet-4-5-20250929": {
1503
+ "claude-sonnet-4-5": {
1505
1504
  name: "Claude Sonnet 4.5",
1506
1505
  modalities: { input: ["text", "image"], output: ["text"] }
1507
1506
  },
1508
- "claude-opus-4-5-20251101": {
1507
+ "claude-opus-4-5": {
1509
1508
  name: "Claude Opus 4.5",
1510
1509
  modalities: { input: ["text", "image"], output: ["text"] }
1511
1510
  },
1512
- "gemini-3-pro-high": {
1511
+ "gemini-3-pro": {
1513
1512
  name: "Gemini 3 Pro",
1514
1513
  modalities: { input: ["text", "image"], output: ["text"] }
1515
1514
  }
@@ -1583,6 +1582,39 @@ var buildStandardProviderConfig = () => ({
1583
1582
  ...provider_config_default,
1584
1583
  npm: PROVIDER_NPM
1585
1584
  });
1585
+ var MODEL_ID_MIGRATIONS = {
1586
+ "claude-sonnet-4-5-20250929": "claude-sonnet-4-5",
1587
+ "claude-opus-4-5-20251101": "claude-opus-4-5",
1588
+ "gemini-3-pro-high": "gemini-3-pro"
1589
+ };
1590
+ var migrateModelId = (modelId) => {
1591
+ if (typeof modelId !== "string")
1592
+ return modelId;
1593
+ const withoutProvider = modelId.replace(/^aicodewith\//, "");
1594
+ const migrated = MODEL_ID_MIGRATIONS[withoutProvider];
1595
+ if (!migrated)
1596
+ return modelId;
1597
+ return modelId.startsWith("aicodewith/") ? `aicodewith/${migrated}` : migrated;
1598
+ };
1599
+ var migrateModelIdsInConfig = (obj) => {
1600
+ if (!obj || typeof obj !== "object")
1601
+ return false;
1602
+ let changed = false;
1603
+ for (const key in obj) {
1604
+ if (key === "model" && typeof obj[key] === "string") {
1605
+ const migrated = migrateModelId(obj[key]);
1606
+ if (migrated !== obj[key]) {
1607
+ obj[key] = migrated;
1608
+ changed = true;
1609
+ }
1610
+ } else if (typeof obj[key] === "object") {
1611
+ if (migrateModelIdsInConfig(obj[key])) {
1612
+ changed = true;
1613
+ }
1614
+ }
1615
+ }
1616
+ return changed;
1617
+ };
1586
1618
  var applyProviderConfig = (config) => {
1587
1619
  let changed = false;
1588
1620
  const providerMap = config.provider && typeof config.provider === "object" ? config.provider : {};
@@ -1598,6 +1630,9 @@ var applyProviderConfig = (config) => {
1598
1630
  config.plugin = nextPlugins;
1599
1631
  changed = true;
1600
1632
  }
1633
+ if (migrateModelIdsInConfig(config)) {
1634
+ changed = true;
1635
+ }
1601
1636
  return changed;
1602
1637
  };
1603
1638
  var ensureConfigFile = async () => {
@@ -1621,6 +1656,16 @@ var ensureConfigFile = async () => {
1621
1656
  if (!config || typeof config !== "object")
1622
1657
  return;
1623
1658
  const changed = applyProviderConfig(config);
1659
+ const omoPath = path4.join(configDir, "oh-my-opencode.json");
1660
+ if (await fileExists(omoPath)) {
1661
+ const omoConfig = await readJsonOrJsonc(omoPath);
1662
+ if (omoConfig && typeof omoConfig === "object") {
1663
+ if (migrateModelIdsInConfig(omoConfig)) {
1664
+ await writeFile2(omoPath, `${JSON.stringify(omoConfig, null, 2)}
1665
+ `, "utf-8");
1666
+ }
1667
+ }
1668
+ }
1624
1669
  if (!changed)
1625
1670
  return;
1626
1671
  await mkdir2(configDir, { recursive: true });
@@ -1675,7 +1720,11 @@ var rewriteUrl = (originalUrl, baseUrl) => {
1675
1720
  const rewritten = new URL(original.toString());
1676
1721
  rewritten.protocol = base.protocol;
1677
1722
  rewritten.host = base.host;
1678
- rewritten.pathname = `${basePath}${original.pathname}`;
1723
+ let targetPath = original.pathname;
1724
+ if (basePath.endsWith("/v1") && targetPath.startsWith("/v1/")) {
1725
+ targetPath = targetPath.slice(3);
1726
+ }
1727
+ rewritten.pathname = `${basePath}${targetPath}`;
1679
1728
  return rewritten.toString();
1680
1729
  };
1681
1730
  var ensureGeminiSseParam = (url) => {
@@ -10,7 +10,7 @@ export declare const PLUGIN_NAME = "opencode-aicodewith-auth";
10
10
  export declare const PROVIDER_ID = "aicodewith";
11
11
  export declare const AUTH_METHOD_LABEL = "AICodewith API Key";
12
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";
13
+ export declare const AICODEWITH_ANTHROPIC_BASE_URL = "https://api.aicodewith.com/v1";
14
14
  export declare const AICODEWITH_GEMINI_BASE_URL = "https://api.aicodewith.com/gemini_cli";
15
15
  export declare const GEMINI_USER_AGENT = "GeminiCLI/v25.2.1 (darwin; arm64)";
16
16
  export declare const GEMINI_API_CLIENT = "google-genai-sdk/1.30.0 gl-node/v25.2.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-aicodewith-auth",
3
- "version": "0.1.11",
3
+ "version": "0.1.14",
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",