{"_id":"@alexandrebrillant2/llm-client","_rev":"2-4e4ace93725ba9b2dc35ed6150cdc912","name":"@alexandrebrillant2/llm-client","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@alexandrebrillant2/llm-client","version":"1.0.0","keywords":["llm client","unfifed REST API","plugin LLM","provider LLM","general LLM","client LLM","service llm","llm","ollama","ollama cloud","mistralai","openai","anthropic","google","gemini","lechat","chatgpt","claude"],"author":{"name":"Alexandre Brillant"},"license":"MIT","_id":"@alexandrebrillant2/llm-client@1.0.0","maintainers":[{"name":"alexandrebrillant2","email":"abrillant@japisoft.com"}],"homepage":"https://github.com/AlexandreBrillant/llm-client","bugs":{"url":"https://github.com/AlexandreBrillant/llm-client/issues"},"dist":{"shasum":"155ab0ad590f6ef028fbb7d52aba778f0536f3d1","tarball":"https://registry.npmjs.org/@alexandrebrillant2/llm-client/-/llm-client-1.0.0.tgz","fileCount":27,"integrity":"sha512-IT6vxLLGaWZT6zSRIbCj/unUIBmu3uC74zI+MoTfnTapcynRf20+TmAlUUfZP0rte6lXD+kvvgHCIv6PuncX9g==","signatures":[{"sig":"MEQCIAVLyrekZVmXA7iTuLpdP7db51NNVeOZbO+m9YewddElAiBeIsA0b02wQBf7dV8qFYr9G2v7Tc1hQz/nXS4Rlw7fuA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":127467},"main":"llmClient.mjs","type":"module","gitHead":"8e000abe1e7ea89f0ac2b27a7a0aa52bfd707ab5","scripts":{"test":"npm run test:ollama && npm run test:ollama-cloud && npm run test:chatgpt","build":"cp src/*.mjs dist && cp -r src/providers dist","prebuild":"node --check src/*.mjs && node --check src/providers/*.mjs","test:google":"node test/test-google.mjs","test:ollama":"node test/test-ollama.mjs","test:openai":"node test/test-openai.mjs","test:anthropic":"node test/test-anthropic.mjs","test:mistralai":"node test/test-mistralai.mjs","test:ollamaCloud":"node test/test-ollama-cloud.mjs"},"_npmUser":{"name":"alexandrebrillant2","email":"abrillant@japisoft.com"},"repository":{"url":"git+https://github.com/AlexandreBrillant/llm-client.git","type":"git"},"_npmVersion":"11.6.2","description":"LM-client is a lightweight library that provides a unified REST API interface for interacting with various language models (Ollama, ChatGPT, Mistral, etc.). It abstracts provider-specific details into modular plugins, offering a simple and consistent way ","directories":{},"_nodeVersion":"24.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/llm-client_1.0.0_1775210952176_0.5312945485014908","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@alexandrebrillant2/llm-client","version":"1.0.1","publishConfig":{"access":"public"},"description":"LM-client is a lightweight library that provides a unified REST API interface for interacting with various language models (Ollama, ChatGPT, Mistral, etc.). It abstracts provider-specific details into modular plugins, offering a simple and consistent way ","keywords":["llm client","unfifed REST API","plugin LLM","provider LLM","general LLM","client LLM","service llm","llm","ollama","ollama cloud","mistralai","openai","anthropic","google","gemini","lechat","chatgpt","claude"],"homepage":"https://github.com/AlexandreBrillant/llm-client","bugs":{"url":"https://github.com/AlexandreBrillant/llm-client/issues"},"repository":{"type":"git","url":"git+https://github.com/AlexandreBrillant/llm-client.git"},"license":"MIT","author":{"name":"Alexandre Brillant"},"type":"module","main":"llmClient.mjs","scripts":{"prebuild":"node --check src/*.mjs && node --check src/providers/*.mjs","build":"cp src/*.mjs dist && cp -r src/providers dist","test:ollama":"node test/test-ollama.mjs","test:ollamaCloud":"node test/test-ollama-cloud.mjs","test:openai":"node test/test-openai.mjs","test:mistralai":"node test/test-mistralai.mjs","test:anthropic":"node test/test-anthropic.mjs","test:google":"node test/test-google.mjs","test":"npm run test:ollama && npm run test:ollama-cloud && npm run test:chatgpt"},"gitHead":"63e6e3851f9355d2c1a13a45e30ff6b614b32b2b","_id":"@alexandrebrillant2/llm-client@1.0.1","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-9t8fm9jLGiUId6jglkjHQtsamemH5KIvYeEIcIjoemHharGRXvoJM5xkkSXxqS0KHgHyaxfSdVv3eQWcfKXe/A==","shasum":"d8f0137fdf0a6fc0ad24a08ceb0d62d3b415a989","tarball":"https://registry.npmjs.org/@alexandrebrillant2/llm-client/-/llm-client-1.0.1.tgz","fileCount":28,"unpackedSize":127922,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICzwJClr3oncTA9gz2mWDaT8ZVdl5DclQPD7X9F6eqyMAiEAhJ0SX+Csb4YoR0NVM3908lOw9EqW33iFctt19NQveuA="}]},"_npmUser":{"name":"alexandrebrillant2","email":"abrillant@japisoft.com"},"directories":{},"maintainers":[{"name":"alexandrebrillant2","email":"abrillant@japisoft.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/llm-client_1.0.1_1775220737430_0.39879311904168824"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-03T10:09:12.097Z","modified":"2026-04-03T12:52:17.695Z","1.0.0":"2026-04-03T10:09:12.331Z","1.0.1":"2026-04-03T12:52:17.589Z"},"bugs":{"url":"https://github.com/AlexandreBrillant/llm-client/issues"},"author":{"name":"Alexandre Brillant"},"license":"MIT","homepage":"https://github.com/AlexandreBrillant/llm-client","keywords":["llm client","unfifed REST API","plugin LLM","provider LLM","general LLM","client LLM","service llm","llm","ollama","ollama cloud","mistralai","openai","anthropic","google","gemini","lechat","chatgpt","claude"],"repository":{"type":"git","url":"git+https://github.com/AlexandreBrillant/llm-client.git"},"description":"LM-client is a lightweight library that provides a unified REST API interface for interacting with various language models (Ollama, ChatGPT, Mistral, etc.). It abstracts provider-specific details into modular plugins, offering a simple and consistent way ","maintainers":[{"name":"alexandrebrillant2","email":"abrillant@japisoft.com"}],"readme":"# llm-client\n\nLLM-client is a lightweight JavaScript library that provides a unified REST API interface for interacting with various language models (Ollama, ChatGPT, Mistral, etc.). It abstracts provider-specific details into modular plugins, offering a simple and consistent way to integrate multiple LLM services into your applications.\n\n(c) 2026 [Alexandre Brillant](https://www.alexandrebrillant.com)\n\nhttps://github.com/AlexandreBrillant/llm-client\n\nFeatures for the Free version\n\n- No external dependencies\n- Easy to use\n- Supports both streaming and non-streaming requests\n- Simplified context management\n\n\nLLM-Client supports :\n\n- OLLAMA\n- OLLAMA Cloud\n- OpenAI\n- Anthropic\n- Google\n- MistralAI\n\nProfessional version ([contact me here](https://www.alexandrebrillant.com/llmclient.html)) :\n\n- Load balancing support\n- Error rescue\n- Cache mode\n- Monitoring\n- Context management\n\nEnvironment Support\n\nLLM-Client is designed to run in both browser (web) and Node.js environments. It uses standard ESM (ECMAScript Modules) for compatibility across platforms.\n\n# Architecture\n\nLLM-Client uses access providers. Each provider is specific to a cloud client (OpenAI, etc.).\n\n ![LLM-Client](images/fig1.png)\n\n# Requests\n\nLLM-Client supports the same request types across all providers:\n\n## Simple Request :\n\nA request is an array of objects in the format { role:\"\", content:\"\" }. The role designates the type of request: user, system, or assistant.\n\n```javascript\n[\n    { role:\"user\", content:\"My request\" }\n]\n```\n\n## System and User Request\n\n```javascript\n[\n    { role:\"system\", content:\"Be funny\" },\n    { role:\"user\", content:\"My request\" }\n]\n```\n\n## Multi-turn Request\n\n```javascript\n[\n    { role:\"user\", content:\"Hello, how do you do ?\" },\n    { role:\"assistant\", content:\"Well...\" },\n    { role:\"user\", content:\"And after ?\" }\n]\n```\n# Responses\n\nThe response is always in the following format:\n\n```javascript\n{ message: {\n    role:'assistant', \n    content:'my llm response'\n  }\n}\n```\n\n- Without streaming : The response is complete\n- With streaming : The response is split into chunks and sent as they become available\n\n## Without Streaming\n\n```javascript\n{ message: { role:'assistant', content:'I m very happy to meet you' } }\n```\n\n## With Streaming\n\nThe response is split into multiple parts and sent incrementally:\n\n```javascript\n{ message: { role:'assistant', content:'I m very' } }\n{ message: { role:'assistant', content:'happ' } }\n{ message: { role:'assistant', content:'y to meet' } }\n{ message: { role:'assistant', content:'you' } }\n```\n\n# Usage\n\nLLM-Client uses standard ESM modules.\n\n## Import the LLM-client Class\n\nYou must adapt each access path to your usage\n\n```javascript\nimport { LLMClient } from \"./llmClient.mjs\";\n```\n\n## Choose a Provider\n\nHere, we use Ollama as an example :\n\n```javascript\nimport { OllamaProvider as MyProvider } from \"./providers/ollama.mjs\";\n```\n\n## Create a Provider instant and initialize LLMClient\n\n```javascript\nconst provider = new MyProvider();\nconst client = new LLMClient( provider );\n```\n\n## Fetch Available models\n\n```javascript\nconst models = await client.models();\n\nmodels.forEach( model => {\n    console.log( \"-\" + model.name )\n});\n```\n\n## Send a Request\n\nSelect a model (e.g. ministral-3:3b) and send a request\n\n```javascript\nconst model = \"ministral-3:3b\";\nconst messages = [ \n    { role : \"user\", content : \"hello\" },\n];\n\nlet stream = false;\n\nlet response = await client.chat( { model, messages, stream } );\nconsole.log( response.message.content );\n```\n\n## Enable Streaming\n\nTo display the response incrementally in the terminal we use the Node.js process objet. For\nother context (like a web page), you will have to concat each result.\n\n```javascript\n// With streaming\nstream = true;\n\nconst messages = [ \n    { role : \"system\", content : \"be concise\" }\n    { role : \"user\", content : \"hello\" },\n];\n\nconst response2 = await client.chat( { model, messages, stream } );\nfor await ( response of response2 ) {\n    process.stdout.write( response.message.content );\n}\n```\n\n# Cloud Providers\n\nYou need an API key from each cloud provider. Pass the key using the **setAPIKey** method.\n\n## Ollama Cloud\n\n```javascript\nimport { LLMClient } from \"./llmClient.mjs\";\nimport { OllamaCloudProvider as MyProvider } from \"./providers/ollamaCloud.mjs\";\n\nconst provider = new MyProvider();\nconst client = new LLMClient( provider );\n\nclient.setAPIKey( YOUR_API_KEY );\n```\n\n## OpenAI\n\n```javascript\nimport { LLMClient } from \"./llmClient.mjs\";\nimport { OpenAIProvider as MyProvider } from \"./providers/openai.mjs\";\n\nconst provider = new MyProvider();\nconst client = new LLMClient( provider );\n\nclient.setAPIKey( YOUR_API_KEY );\n```\n\n## Anthropic\n\n```javascript\nimport { LLMClient } from \"./llmClient.mjs\";\nimport { AnthropicProvider as MyProvider } from \"./providers/anthropic.mjs\";\n\nconst provider = new MyProvider();\nconst client = new LLMClient( provider );\n\nclient.setAPIKey( YOUR_API_KEY );\n```\n\n## Google\n\n```javascript\nimport { LLMClient } from \"./llmClient.mjs\";\nimport { GoogleProvider as MyProvider } from \"./providers/google.mjs\";\n\nconst provider = new MyProvider();\nconst client = new LLMClient( provider );\n\nclient.setAPIKey( YOUR_API_KEY );\n```\n\n## MistralAI\n\n```javascript\nimport { LLMClient } from \"./llmClient.mjs\";\nimport { MistralAIProvider as MyProvider } from \"./providers/mistralai.mjs\";\n\nconst provider = new MyProvider();\nconst client = new LLMClient( provider );\n\nclient.setAPIKey( YOUR_API_KEY );\n```\n\n(c) 2026 [Alexandre Brillant](https://www.alexandrebrillant.com)","readmeFilename":"README.md"}