@kwirthmagnify/kwirth-common-ai 0.5.39 → 0.5.40

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.
Files changed (2) hide show
  1. package/dist/back.js +4 -3
  2. package/package.json +1 -1
package/dist/back.js CHANGED
@@ -66,10 +66,11 @@ const buildModel = (llm, providers) => {
66
66
  case 'openrouter': return (0, ai_sdk_provider_1.createOpenRouter)({ apiKey: key })(llm.model);
67
67
  case 'anthropic': return (0, anthropic_1.createAnthropic)({ apiKey: key })(llm.model);
68
68
  case 'openai-compat': {
69
- // Mismo criterio que loadModels: el baseURL de OpenAI debe terminar en /v1 (el SDK le añade
70
- // /chat/completions). Si el endpoint no lo trae, se lo añadimos → si no, 404 en el chat.
69
+ // baseURL debe terminar en /v1 (el SDK añade el path). Y usamos .chat() → Chat Completions API
70
+ // (/v1/chat/completions): los endpoints OpenAI-compatibles (Huawei MaaS, etc.) NO exponen la
71
+ // Responses API (/v1/responses) → si no, 404 APIG.0101.
71
72
  const b = ((_c = prov === null || prov === void 0 ? void 0 : prov.endpoint) !== null && _c !== void 0 ? _c : '').replace(/\/+$/, '');
72
- return (0, openai_1.createOpenAI)({ apiKey: key, baseURL: b.endsWith('/v1') ? b : `${b}/v1` })(llm.model);
73
+ return (0, openai_1.createOpenAI)({ apiKey: key, baseURL: b.endsWith('/v1') ? b : `${b}/v1` }).chat(llm.model);
73
74
  }
74
75
  default:
75
76
  console.log('Invalid provider type', type);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwirthmagnify/kwirth-common-ai",
3
- "version": "0.5.39",
3
+ "version": "0.5.40",
4
4
  "description": "Shared AI/LLM types and utilities for Kwirth AI plugins",
5
5
  "scripts": {
6
6
  "build": "del .\\dist\\* /s /q 2>nul & tsc",