opencode-aicodewith-auth 0.1.18 → 0.1.19

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/index.js CHANGED
@@ -69,6 +69,7 @@ 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
71
  var AICODEWITH_ANTHROPIC_BASE_URL = "https://api.aicodewith.com/v1";
72
+ var AICODEWITH_LITE_URL = "https://api.aicodewith.com/lite";
72
73
  var AICODEWITH_GEMINI_BASE_URL = "https://api.aicodewith.com/gemini_cli";
73
74
  var GEMINI_USER_AGENT = "GeminiCLI/v25.2.1 (darwin; arm64)";
74
75
  var GEMINI_API_CLIENT = "google-genai-sdk/1.30.0 gl-node/v25.2.1";
@@ -1620,6 +1621,14 @@ var provider_config_default = {
1620
1621
  name: "Claude Opus 4.5",
1621
1622
  modalities: { input: ["text", "image"], output: ["text"] }
1622
1623
  },
1624
+ "claude-sonnet-4-5-20250929-third-party": {
1625
+ name: "Claude Sonnet 4.5 (third party)",
1626
+ modalities: { input: ["text", "image"], output: ["text"] }
1627
+ },
1628
+ "claude-opus-4-5-20251101-third-party": {
1629
+ name: "Claude Opus 4.5 (third party)",
1630
+ modalities: { input: ["text", "image"], output: ["text"] }
1631
+ },
1623
1632
  "gemini-3-pro": {
1624
1633
  name: "Gemini 3 Pro",
1625
1634
  modalities: { input: ["text", "image"], output: ["text"] }
@@ -1764,6 +1773,8 @@ var parseRequestBody = (init) => {
1764
1773
  };
1765
1774
  var isGeminiUrl = (url) => url.includes(":generateContent") || url.includes(":streamGenerateContent") || url.includes("/models/") && url.includes("/v1");
1766
1775
  var isClaudeUrl = (url) => url.includes("/v1/messages");
1776
+ var isThirdPartyModel = (model) => Boolean(model && model.endsWith("-third-party"));
1777
+ var stripThirdPartySuffix = (model) => model.replace(/-third-party$/, "");
1767
1778
  var isModel = (model, prefix) => Boolean(model && model.startsWith(prefix));
1768
1779
  var isCodexModel = (model) => Boolean(model && CODEX_MODEL_PREFIXES.some((prefix) => model.startsWith(prefix)));
1769
1780
  var saveResponseIfEnabled = async (response, provider, metadata) => {
@@ -1894,10 +1905,19 @@ var AicodewithCodexAuthPlugin = async (ctx) => {
1894
1905
  return await saveResponseIfEnabled(response, "gemini", { url: geminiUrl, model });
1895
1906
  }
1896
1907
  if (isClaudeRequest) {
1897
- const targetUrl = rewriteUrl(originalUrl, AICODEWITH_ANTHROPIC_BASE_URL);
1898
- const transformedInit = transformClaudeRequest(init);
1908
+ const isThirdParty = isThirdPartyModel(model);
1909
+ const baseUrl = isThirdParty ? AICODEWITH_LITE_URL : AICODEWITH_ANTHROPIC_BASE_URL;
1910
+ const targetUrl = rewriteUrl(originalUrl, baseUrl);
1911
+ let transformedInit = transformClaudeRequest(init);
1912
+ if (isThirdParty && model && transformedInit?.body && typeof transformedInit.body === "string") {
1913
+ try {
1914
+ const body = JSON.parse(transformedInit.body);
1915
+ body.model = stripThirdPartySuffix(model);
1916
+ transformedInit = { ...transformedInit, body: JSON.stringify(body) };
1917
+ } catch {}
1918
+ }
1899
1919
  const response = await fetch(targetUrl, transformedInit);
1900
- const savedResponse = await saveResponseIfEnabled(response, "claude", { url: targetUrl, model });
1920
+ const savedResponse = await saveResponseIfEnabled(response, isThirdParty ? "claude-third-party" : "claude", { url: targetUrl, model });
1901
1921
  return transformClaudeResponse(savedResponse);
1902
1922
  }
1903
1923
  return await fetch(originalUrl, init);
@@ -11,6 +11,7 @@ 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
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";
14
15
  export declare const AICODEWITH_GEMINI_BASE_URL = "https://api.aicodewith.com/gemini_cli";
15
16
  export declare const GEMINI_USER_AGENT = "GeminiCLI/v25.2.1 (darwin; arm64)";
16
17
  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.18",
3
+ "version": "0.1.19",
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",