@imenam/unified-llm-client 2.2.0 → 2.3.0

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 (32) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +383 -359
  3. package/dist/adapters/openrouter/OpenRouterLogAdapter.d.ts +11 -0
  4. package/dist/adapters/openrouter/OpenRouterLogAdapter.d.ts.map +1 -0
  5. package/dist/adapters/openrouter/OpenRouterLogAdapter.js +51 -0
  6. package/dist/adapters/openrouter/OpenRouterOutputAdapter.d.ts +6 -0
  7. package/dist/adapters/openrouter/OpenRouterOutputAdapter.d.ts.map +1 -0
  8. package/dist/adapters/openrouter/OpenRouterOutputAdapter.js +9 -0
  9. package/dist/adapters/openrouter/OpenRouterPromptAdapter.d.ts +15 -0
  10. package/dist/adapters/openrouter/OpenRouterPromptAdapter.d.ts.map +1 -0
  11. package/dist/adapters/openrouter/OpenRouterPromptAdapter.js +374 -0
  12. package/dist/adapters/openrouter/OpenRouterToolAdapter.d.ts +6 -0
  13. package/dist/adapters/openrouter/OpenRouterToolAdapter.d.ts.map +1 -0
  14. package/dist/adapters/openrouter/OpenRouterToolAdapter.js +16 -0
  15. package/dist/common/types.d.ts +10 -1
  16. package/dist/common/types.d.ts.map +1 -1
  17. package/dist/core/LLMAdapter.d.ts.map +1 -1
  18. package/dist/core/LLMAdapter.js +16 -0
  19. package/dist/core/Models.d.ts +6 -0
  20. package/dist/core/Models.d.ts.map +1 -1
  21. package/dist/core/Models.js +9 -0
  22. package/dist/core/UnifiedLLMClient.d.ts +2 -2
  23. package/dist/core/UnifiedLLMClient.d.ts.map +1 -1
  24. package/dist/core/UnifiedLLMClient.js +1 -1
  25. package/dist/examples/audio-example.js +1 -1
  26. package/dist/examples/example.js +16 -16
  27. package/dist/examples/qwen-omni-audio-example.js +5 -5
  28. package/dist/examples/qwen-vl-example.js +7 -7
  29. package/dist/index.d.ts +5 -4
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +4 -1
  32. package/package.json +71 -71
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MODELS = void 0;
4
+ exports.openRouterModel = openRouterModel;
4
5
  exports.MODELS = {
5
6
  GEMINI_FLASH_2_5: {
6
7
  provider: "gemini",
@@ -138,3 +139,11 @@ exports.MODELS = {
138
139
  modelName: "claude-opus-4-6",
139
140
  },
140
141
  };
142
+ /**
143
+ * Construit un modèle OpenRouter à partir de son identifiant (ex.
144
+ * `google/gemini-3-flash-preview`). Les coûts sont facultatifs : OpenRouter
145
+ * renvoie le coût réel de chaque appel dans `usage.cost`.
146
+ */
147
+ function openRouterModel(modelName, costsPer1MTokens = { prompt: 0, output: 0 }) {
148
+ return { provider: "openrouter", modelName, costsPer1MTokens, currency: "USD" };
149
+ }
@@ -1,8 +1,8 @@
1
1
  import { ApiKeyResolver, ChatMessage, ChatResponse, ToolDefinition, AudioGenerationOptions, AudioGenerationResponse, UnifiedLog } from "../common/types";
2
2
  import { PromptAdapterOptions, StreamedChatChunk, ChatOptionalConfig } from "./LLMAdapter";
3
- import { Model } from "../common/types";
3
+ import { Model, Provider } from "../common/types";
4
4
  export type UnifiedLLMClientOptions = {
5
- provider: "openai" | "gemini" | "qwen" | "anthropic";
5
+ provider: Provider;
6
6
  adapterOptions?: PromptAdapterOptions;
7
7
  logger?: (log: UnifiedLog) => any | Promise<any>;
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"UnifiedLLMClient.d.ts","sourceRoot":"","sources":["../../src/core/UnifiedLLMClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAY,cAAc,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACnK,OAAO,EAAiB,oBAAoB,EAAqE,iBAAiB,EAAgB,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAG3L,OAAO,EA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Y,CAAC;YA8FxB,aAAa;IA0C3B;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAQtF;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,sBAAsB,GAAG,aAAa,CAAC,MAAM,CAAC;IAQ3E;;OAEG;IACG,uBAAuB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAQlD;;OAEG;IACG,wBAAwB,CAC5B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GACtD,OAAO,CAAC,uBAAuB,CAAC;IAYnC;;OAEG;IACG,uBAAuB,CAC3B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,EACvD,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GACtD,OAAO,CAAC,uBAAuB,CAAC;CAcpC"}
@@ -45,7 +45,7 @@ class UnifiedLLMClient {
45
45
  this.logger = (options === null || options === void 0 ? void 0 : options.logger) || global._unifiedLlmDefaultLogger;
46
46
  }
47
47
  checkNotImplementedFeatures(message) {
48
- if (message.attachedFile && this.model.provider !== "gemini" && this.model.provider !== "qwen" && this.model.provider !== "anthropic" && this.model.provider !== "openai") {
48
+ if (message.attachedFile && !LLMAdapter_1.PROVIDERS_CONFIG[this.model.provider]) {
49
49
  throw new Error("Attached files are not supported for this provider");
50
50
  }
51
51
  }
@@ -81,7 +81,7 @@ function generateSimpleAudio(client) {
81
81
  }
82
82
  function generateMultiVoiceAudio(client) {
83
83
  return __awaiter(this, void 0, void 0, function* () {
84
- const podcastText = `Speaker 1: Bienvenue dans notre podcast technologique !
84
+ const podcastText = `Speaker 1: Bienvenue dans notre podcast technologique !
85
85
  Speaker 2: Aujourd'hui, nous parlons d'intelligence artificielle et de génération de voix.`;
86
86
  const multiOutputPath = path.join(AUDIO_OUTPUT_DIR, "podcast-example.wav");
87
87
  const multiResponse = yield client.generateMultiVoiceAudio(podcastText, [
@@ -183,8 +183,8 @@ function basicAudioGeneration() {
183
183
  console.log(voices.join(', '));
184
184
  // Exemple 3: Génération multi-voix simple
185
185
  console.log('\n🎙️ Génération multi-voix...');
186
- const dialogText = `Speaker 1: Salut ! content ça va ?
187
- Speaker 2: Très bien, merci ! Et toi ?
186
+ const dialogText = `Speaker 1: Salut ! content ça va ?
187
+ Speaker 2: Très bien, merci ! Et toi ?
188
188
  Speaker 1: Ça va super bien, merci de demander !`;
189
189
  const multiAudioResponse = yield client.generateMultiVoiceAudio(dialogText, [
190
190
  { speaker: "Speaker 1", voiceName: "Kore" },
@@ -326,20 +326,20 @@ function parseSubject() {
326
326
  const res = yield client.chat({
327
327
  message: {
328
328
  role: "user",
329
- content: `Voila le sujet du devoir. Peux-tu le parser en respectant la structure suivante ?
330
- {
331
- questions: [
332
- {
333
- number: "1",
334
- content: "Question 1" or "Exercie N", etc...,
335
- type: "Title" or "Question",
336
- marking_scheme: "X" or "", // if type is "Question", X can be a float - 3.5, 4, etc...
337
- sub_questions: [
338
- ...same structure
339
- ]
340
- }
341
- ]
342
- }
329
+ content: `Voila le sujet du devoir. Peux-tu le parser en respectant la structure suivante ?
330
+ {
331
+ questions: [
332
+ {
333
+ number: "1",
334
+ content: "Question 1" or "Exercie N", etc...,
335
+ type: "Title" or "Question",
336
+ marking_scheme: "X" or "", // if type is "Question", X can be a float - 3.5, 4, etc...
337
+ sub_questions: [
338
+ ...same structure
339
+ ]
340
+ }
341
+ ]
342
+ }
343
343
  `,
344
344
  attachedFile: "./media/nested_subject.pdf"
345
345
  },
@@ -56,13 +56,13 @@ const path = __importStar(require("path"));
56
56
  * ALIBABA_CLOUD_API_KEY=... npm run example:qwen-omni -- ./chemin/audio.mp3 [--tools]
57
57
  * npm run example:qwen-omni -- ./reponse.txt [duree_en_secondes]
58
58
  */
59
- const TRANSCRIPTION_PROMPT = `Transcris cet extrait audio intégralement, en français.
60
- Réponds UNIQUEMENT avec un tableau JSON, sans texte autour et sans bloc de code.
61
- Chaque élément représente une phrase et suit ce format exact :
62
- {"timecode": "MM:SS", "speaker": "nom ou Inconnu", "text": "la phrase transcrite"}
59
+ const TRANSCRIPTION_PROMPT = `Transcris cet extrait audio intégralement, en français.
60
+ Réponds UNIQUEMENT avec un tableau JSON, sans texte autour et sans bloc de code.
61
+ Chaque élément représente une phrase et suit ce format exact :
62
+ {"timecode": "MM:SS", "speaker": "nom ou Inconnu", "text": "la phrase transcrite"}
63
63
  Le timecode est l'instant de DÉBUT de la phrase, relatif au début de l'extrait.`;
64
64
  /** Prompt du mode function calling : le format est défini par le schéma de l'outil. */
65
- const TRANSCRIPTION_PROMPT_TOOLS = `Transcris cet extrait audio intégralement, en français,
65
+ const TRANSCRIPTION_PROMPT_TOOLS = `Transcris cet extrait audio intégralement, en français,
66
66
  puis transmets le résultat via l'outil submit_transcription.`;
67
67
  const TRANSCRIPTION_TOOL = {
68
68
  name: "submit_transcription",
@@ -144,13 +144,13 @@ function qwenVLBoundingBoxesExample() {
144
144
  console.log("📦 Exemple 2: Extraction de bounding boxes...");
145
145
  // Initialiser le client Qwen
146
146
  const client = new UnifiedLLMClient_1.UnifiedLLMClient(Models_1.MODELS.QWEN_VL_3);
147
- const expectedJsonFormat = `{
148
- "data": [
149
- {
150
- "bbox_2d": [x1, y1, x2, y2],
151
- "text_content": "contenu du texte"
152
- }
153
- ]
147
+ const expectedJsonFormat = `{
148
+ "data": [
149
+ {
150
+ "bbox_2d": [x1, y1, x2, y2],
151
+ "text_content": "contenu du texte"
152
+ }
153
+ ]
154
154
  }`;
155
155
  // Redimensionner l'image pour l'extraction de bounding boxes
156
156
  const resizedImageBuffer = yield resizeImageForVision("./media/Gaspard_5_with_lines.png", 1000);
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { ApiKeyResolver, ChatMessage, ToolDefinition, ToolCall, ChatResponse, AudioGenerationOptions, AudioGenerationResponse, VoiceConfig, SpeakerConfig } from "./common/types";
1
+ import { ApiKeyResolver, Model, Provider, ChatMessage, ToolDefinition, ToolCall, ChatResponse, AudioGenerationOptions, AudioGenerationResponse, VoiceConfig, SpeakerConfig } from "./common/types";
2
2
  import { PromptAdapter, PromptAdapterOptions, OutputAdapter, AudioAdapter, ChatOptionalConfig } from "./core/LLMAdapter";
3
3
  import { UnifiedLLMClient, ChatOptions } from "./core/UnifiedLLMClient";
4
- import { MODELS } from "./core/Models";
4
+ import { MODELS, openRouterModel } from "./core/Models";
5
+ import { OPENROUTER_BASE_URL } from "./adapters/openrouter/OpenRouterPromptAdapter";
5
6
  import { ProxyServer } from "./proxy/ProxyServer";
6
7
  import { ProxyChatRequest, ProxyServerOptions, ProxySSEEvent } from "./proxy/types";
7
- export { UnifiedLLMClient, MODELS, ProxyServer };
8
- export type { ApiKeyResolver, ChatMessage, ToolDefinition, ToolCall, ChatResponse, PromptAdapter, PromptAdapterOptions, OutputAdapter, AudioAdapter, AudioGenerationOptions, AudioGenerationResponse, VoiceConfig, SpeakerConfig, ChatOptionalConfig, ChatOptions, ProxyChatRequest, ProxyServerOptions, ProxySSEEvent, };
8
+ export { UnifiedLLMClient, MODELS, ProxyServer, openRouterModel, OPENROUTER_BASE_URL };
9
+ export type { ApiKeyResolver, Model, Provider, ChatMessage, ToolDefinition, ToolCall, ChatResponse, PromptAdapter, PromptAdapterOptions, OutputAdapter, AudioAdapter, AudioGenerationOptions, AudioGenerationResponse, VoiceConfig, SpeakerConfig, ChatOptionalConfig, ChatOptions, ProxyChatRequest, ProxyServerOptions, ProxySSEEvent, };
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAClL,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzH,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACjD,YAAY,EACV,cAAc,EACd,WAAW,EACX,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,GACd,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACnM,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzH,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC;AACvF,YAAY,EACV,cAAc,EACd,KAAK,EACL,QAAQ,EACR,WAAW,EACX,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,GACd,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProxyServer = exports.MODELS = exports.UnifiedLLMClient = void 0;
3
+ exports.OPENROUTER_BASE_URL = exports.openRouterModel = exports.ProxyServer = exports.MODELS = exports.UnifiedLLMClient = void 0;
4
4
  const UnifiedLLMClient_1 = require("./core/UnifiedLLMClient");
5
5
  Object.defineProperty(exports, "UnifiedLLMClient", { enumerable: true, get: function () { return UnifiedLLMClient_1.UnifiedLLMClient; } });
6
6
  const Models_1 = require("./core/Models");
7
7
  Object.defineProperty(exports, "MODELS", { enumerable: true, get: function () { return Models_1.MODELS; } });
8
+ Object.defineProperty(exports, "openRouterModel", { enumerable: true, get: function () { return Models_1.openRouterModel; } });
9
+ const OpenRouterPromptAdapter_1 = require("./adapters/openrouter/OpenRouterPromptAdapter");
10
+ Object.defineProperty(exports, "OPENROUTER_BASE_URL", { enumerable: true, get: function () { return OpenRouterPromptAdapter_1.OPENROUTER_BASE_URL; } });
8
11
  const ProxyServer_1 = require("./proxy/ProxyServer");
9
12
  Object.defineProperty(exports, "ProxyServer", { enumerable: true, get: function () { return ProxyServer_1.ProxyServer; } });
package/package.json CHANGED
@@ -1,71 +1,71 @@
1
- {
2
- "name": "@imenam/unified-llm-client",
3
- "version": "2.2.0",
4
- "description": "A unified interface for multiple LLM providers (OpenAI, Gemini, Anthropic, Qwen) with tool-calling, streaming, and audio support",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": [
8
- "dist",
9
- "README.md",
10
- "LICENSE"
11
- ],
12
- "scripts": {
13
- "build": "tsc",
14
- "dev": "tsc -w",
15
- "prepublishOnly": "npm run build",
16
- "release:patch": "npm version patch && npm publish",
17
- "release:minor": "npm version minor && npm publish",
18
- "release:major": "npm version major && npm publish",
19
- "example": "node dist/examples/example.js",
20
- "example:audio": "node dist/examples/audio-example.js",
21
- "example:qwen": "node dist/examples/qwen-vl-example.js",
22
- "example:qwen-omni": "node dist/examples/qwen-omni-audio-example.js",
23
- "example:anthropic": "node dist/examples/anthropic-example.js",
24
- "example:abort": "node dist/examples/chat-abort-example.js",
25
- "example:proxy": "node dist/examples/proxy-example.js",
26
- "example:proxy-api-key-resolver": "node dist/examples/proxy-api-key-resolver-example.js",
27
- "example:api-key-resolver": "node dist/examples/api-key-resolver-example.js",
28
- "proxy:start": "node dist/examples/proxy-server-start.js",
29
- "example:error-logging": "node dist/examples/example-error-logging.js"
30
- },
31
- "keywords": [
32
- "llm",
33
- "openai",
34
- "gemini",
35
- "anthropic",
36
- "qwen",
37
- "ai",
38
- "unified",
39
- "tool-calling",
40
- "streaming",
41
- "chatgpt",
42
- "gpt",
43
- "claude",
44
- "mistral"
45
- ],
46
- "author": "imenam",
47
- "license": "MIT",
48
- "publishConfig": {
49
- "access": "public"
50
- },
51
- "repository": {
52
- "type": "git",
53
- "url": "https://github.com/imenam/globalLLMInterface.git"
54
- },
55
- "devDependencies": {
56
- "@types/mime-types": "^2.1.4",
57
- "typescript": "^5.8.3"
58
- },
59
- "dependencies": {
60
- "@anthropic-ai/sdk": "^0.52.0",
61
- "@google/genai": "^1.46.0",
62
- "@mistralai/mistralai": "^1.6.1",
63
- "@types/node": "^22.15.24",
64
- "@types/node-fetch": "^2.6.13",
65
- "dotenv": "^16.5.0",
66
- "mime-types": "^3.0.1",
67
- "node-fetch": "^3.3.2",
68
- "openai": "^4.103.0",
69
- "sharp": "^0.34.4"
70
- }
71
- }
1
+ {
2
+ "name": "@imenam/unified-llm-client",
3
+ "version": "2.3.0",
4
+ "description": "A unified interface for multiple LLM providers (OpenAI, Gemini, Anthropic, Qwen) with tool-calling, streaming, and audio support",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md",
10
+ "LICENSE"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "dev": "tsc -w",
15
+ "prepublishOnly": "npm run build",
16
+ "release:patch": "npm version patch && npm publish",
17
+ "release:minor": "npm version minor && npm publish",
18
+ "release:major": "npm version major && npm publish",
19
+ "example": "node dist/examples/example.js",
20
+ "example:audio": "node dist/examples/audio-example.js",
21
+ "example:qwen": "node dist/examples/qwen-vl-example.js",
22
+ "example:qwen-omni": "node dist/examples/qwen-omni-audio-example.js",
23
+ "example:anthropic": "node dist/examples/anthropic-example.js",
24
+ "example:abort": "node dist/examples/chat-abort-example.js",
25
+ "example:proxy": "node dist/examples/proxy-example.js",
26
+ "example:proxy-api-key-resolver": "node dist/examples/proxy-api-key-resolver-example.js",
27
+ "example:api-key-resolver": "node dist/examples/api-key-resolver-example.js",
28
+ "proxy:start": "node dist/examples/proxy-server-start.js",
29
+ "example:error-logging": "node dist/examples/example-error-logging.js"
30
+ },
31
+ "keywords": [
32
+ "llm",
33
+ "openai",
34
+ "gemini",
35
+ "anthropic",
36
+ "qwen",
37
+ "ai",
38
+ "unified",
39
+ "tool-calling",
40
+ "streaming",
41
+ "chatgpt",
42
+ "gpt",
43
+ "claude",
44
+ "mistral"
45
+ ],
46
+ "author": "imenam",
47
+ "license": "MIT",
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "https://github.com/imenam/globalLLMInterface.git"
54
+ },
55
+ "devDependencies": {
56
+ "@types/mime-types": "^2.1.4",
57
+ "typescript": "^5.8.3"
58
+ },
59
+ "dependencies": {
60
+ "@anthropic-ai/sdk": "^0.52.0",
61
+ "@google/genai": "^1.46.0",
62
+ "@mistralai/mistralai": "^1.6.1",
63
+ "@types/node": "^22.15.24",
64
+ "@types/node-fetch": "^2.6.13",
65
+ "dotenv": "^16.5.0",
66
+ "mime-types": "^3.0.1",
67
+ "node-fetch": "^3.3.2",
68
+ "openai": "^4.103.0",
69
+ "sharp": "^0.34.4"
70
+ }
71
+ }