adaptive-memory-multi-model-router 1.9.4 → 2.0.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 (130) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +50 -0
  2. package/.github/ISSUE_TEMPLATE/config.yml +11 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +37 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +44 -0
  5. package/.github/workflows/npm-stats-validation.yml +152 -0
  6. package/.github/workflows/pages.yml +37 -0
  7. package/CHANGELOG.md +122 -0
  8. package/CODE_OF_CONDUCT.md +128 -0
  9. package/CONTRIBUTING.md +110 -0
  10. package/LAUNCH-PAIN-DRIVEN.md +339 -0
  11. package/LAUNCH.md +575 -0
  12. package/POPULARITY_BOOSTERS.md +285 -0
  13. package/README.md +231 -300
  14. package/SECURITY.md +69 -0
  15. package/articles/CONTENT_STRUCTURE.md +292 -0
  16. package/articles/DEVTO_COST_GUIDE.md +473 -0
  17. package/articles/DEVTO_FINAL.md +416 -0
  18. package/articles/DEVTO_MULTI_PROVIDER.md +542 -0
  19. package/articles/HN_10X_BETTER.md +430 -0
  20. package/articles/HN_CHINESE_STYLE.md +308 -0
  21. package/articles/HN_FINAL.md +199 -0
  22. package/articles/HN_POSTED_VERSION.md +56 -0
  23. package/articles/HN_RESEARCH.md +364 -0
  24. package/articles/PAIN-DRIVEN-devto-v2.md +308 -0
  25. package/articles/PAIN-DRIVEN-devto-v3.md +268 -0
  26. package/articles/PAIN-DRIVEN-devto.md +242 -0
  27. package/articles/PAIN-DRIVEN-hackernews-v2.md +138 -0
  28. package/articles/PAIN-DRIVEN-hackernews-v3.md +151 -0
  29. package/articles/PAIN-DRIVEN-hackernews.md +131 -0
  30. package/articles/PAIN-DRIVEN-reddit-v2.md +301 -0
  31. package/articles/PAIN-DRIVEN-reddit-v3.md +236 -0
  32. package/articles/PAIN-DRIVEN-reddit.md +218 -0
  33. package/articles/PAIN-DRIVEN-twitter-v2.md +110 -0
  34. package/articles/PAIN-DRIVEN-twitter-v3.md +121 -0
  35. package/articles/PAIN-DRIVEN-twitter.md +120 -0
  36. package/articles/PORTKEY_VS_A3M.md +147 -0
  37. package/articles/REDDIT_FINAL.md +232 -0
  38. package/articles/TWITTER_FINAL.md +167 -0
  39. package/articles/WHY_10X_BETTER.md +261 -0
  40. package/articles/WHY_CHINESE_STYLE_BETTER.md +323 -0
  41. package/articles/ai-discoverability-llm-routing.md +210 -0
  42. package/articles/devto-llm-routing.md +109 -0
  43. package/articles/hackernews-show-hn.md +65 -0
  44. package/articles/hashnode-llm-cost-optimization.md +125 -0
  45. package/articles/medium-building-llm-router.md +205 -0
  46. package/articles/reddit-ml.md +86 -0
  47. package/articles/twitter-thread-cost-savings.md +98 -0
  48. package/articles/youtube-tutorial-script.md +262 -0
  49. package/assets/banner.svg +109 -0
  50. package/assets/logo.svg +68 -0
  51. package/assets/social-preview.svg +64 -0
  52. package/demo/demo-script.md +53 -0
  53. package/dist/analytics/costAnalytics.d.ts +77 -0
  54. package/dist/analytics/costAnalytics.d.ts.map +1 -0
  55. package/dist/analytics/costAnalytics.js +219 -0
  56. package/dist/analytics/costAnalytics.js.map +1 -0
  57. package/dist/cache/semanticCache.d.ts +62 -0
  58. package/dist/cache/semanticCache.d.ts.map +1 -0
  59. package/dist/cache/semanticCache.js +176 -0
  60. package/dist/cache/semanticCache.js.map +1 -0
  61. package/dist/cli.js +35 -0
  62. package/dist/geo/generativeEngineOptimization.js +321 -0
  63. package/dist/geo/geoRouter.js +387 -0
  64. package/dist/index.d.ts +4 -723
  65. package/dist/index.js +11 -344
  66. package/dist/index.js.map +1 -1
  67. package/dist/integrations/langchainAdapter.d.ts +146 -0
  68. package/dist/integrations/langchainAdapter.d.ts.map +1 -0
  69. package/dist/integrations/langchainAdapter.js +731 -0
  70. package/dist/integrations/langchainAdapter.js.map +1 -0
  71. package/dist/integrations/oauth.d.ts +69 -0
  72. package/dist/integrations/oauth.d.ts.map +1 -0
  73. package/dist/integrations/oauth.js +225 -21
  74. package/dist/integrations/oauth.js.map +1 -0
  75. package/dist/memory/autoFetch.d.ts +39 -0
  76. package/dist/memory/autoFetch.d.ts.map +1 -0
  77. package/dist/memory/autoFetch.js +80 -88
  78. package/dist/memory/autoFetch.js.map +1 -0
  79. package/dist/memory/memoryTree.d.ts +76 -0
  80. package/dist/memory/memoryTree.d.ts.map +1 -0
  81. package/dist/memory/memoryTree.js +185 -130
  82. package/dist/memory/memoryTree.js.map +1 -0
  83. package/dist/memory/obsidianVault.d.ts +71 -0
  84. package/dist/memory/obsidianVault.d.ts.map +1 -0
  85. package/dist/memory/obsidianVault.js +207 -22
  86. package/dist/memory/obsidianVault.js.map +1 -0
  87. package/dist/providers/providerConfig.d.ts +49 -0
  88. package/dist/providers/providerConfig.d.ts.map +1 -0
  89. package/dist/providers/providerConfig.js +806 -401
  90. package/dist/providers/providerConfig.js.map +1 -0
  91. package/dist/security/guardrails.d.ts +76 -0
  92. package/dist/security/guardrails.d.ts.map +1 -0
  93. package/dist/security/guardrails.js +479 -0
  94. package/dist/security/guardrails.js.map +1 -0
  95. package/dist/security/inputValidation.js +351 -0
  96. package/dist/server/dashboard.d.ts +58 -0
  97. package/dist/server/dashboard.d.ts.map +1 -0
  98. package/dist/server/dashboard.js +553 -0
  99. package/dist/server/dashboard.js.map +1 -0
  100. package/dist/server/modelMapper.d.ts +43 -0
  101. package/dist/server/modelMapper.d.ts.map +1 -0
  102. package/dist/server/modelMapper.js +154 -0
  103. package/dist/server/modelMapper.js.map +1 -0
  104. package/dist/server/proxyServer.d.ts +41 -0
  105. package/dist/server/proxyServer.d.ts.map +1 -0
  106. package/dist/server/proxyServer.js +932 -0
  107. package/dist/server/proxyServer.js.map +1 -0
  108. package/dist/skills/__tests__/skill_manager.test.d.ts +2 -0
  109. package/dist/skills/__tests__/skill_manager.test.d.ts.map +1 -0
  110. package/dist/skills/__tests__/skill_manager.test.js +268 -0
  111. package/dist/skills/__tests__/skill_manager.test.js.map +1 -0
  112. package/docs/geo/GENERATIVE_ENGINE_OPTIMIZATION.md +232 -0
  113. package/docs-site/index.html +347 -0
  114. package/llms.txt +138 -0
  115. package/package.json +72 -7
  116. package/playground/README.md +51 -0
  117. package/playground/codesandbox.json +12 -0
  118. package/playground/index.js +39 -0
  119. package/scripts/update-npm-badges.js +158 -0
  120. package/src/analytics/costAnalytics.ts +304 -0
  121. package/src/cache/semanticCache.ts +221 -0
  122. package/src/index.ts +6 -0
  123. package/src/integrations/langchainAdapter.ts +955 -0
  124. package/src/providers/providerConfig.ts +923 -0
  125. package/src/security/guardrails.ts +585 -0
  126. package/src/server/dashboard.ts +610 -0
  127. package/src/server/modelMapper.ts +182 -0
  128. package/src/server/proxyServer.ts +1105 -0
  129. package/src/types/langchain.d.ts +83 -0
  130. package/tsconfig.build.json +20 -0
@@ -0,0 +1,347 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>A3M Router - Adaptive Memory Multi-Model Router</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ body {
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
16
+ background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
17
+ color: #fff;
18
+ min-height: 100vh;
19
+ }
20
+
21
+ .container {
22
+ max-width: 1200px;
23
+ margin: 0 auto;
24
+ padding: 2rem;
25
+ }
26
+
27
+ header {
28
+ text-align: center;
29
+ padding: 4rem 0;
30
+ }
31
+
32
+ .logo {
33
+ width: 120px;
34
+ height: 120px;
35
+ margin: 0 auto 2rem;
36
+ }
37
+
38
+ h1 {
39
+ font-size: 4rem;
40
+ font-weight: 800;
41
+ background: linear-gradient(135deg, #6366f1, #8b5cf6, #06b6d4);
42
+ -webkit-background-clip: text;
43
+ -webkit-text-fill-color: transparent;
44
+ margin-bottom: 1rem;
45
+ }
46
+
47
+ .tagline {
48
+ font-size: 1.5rem;
49
+ color: #94a3b8;
50
+ margin-bottom: 2rem;
51
+ }
52
+
53
+ .stats {
54
+ display: flex;
55
+ justify-content: center;
56
+ gap: 3rem;
57
+ margin: 3rem 0;
58
+ flex-wrap: wrap;
59
+ }
60
+
61
+ .stat {
62
+ text-align: center;
63
+ padding: 1.5rem 2rem;
64
+ background: rgba(255,255,255,0.05);
65
+ border-radius: 16px;
66
+ border: 1px solid rgba(255,255,255,0.1);
67
+ }
68
+
69
+ .stat-value {
70
+ font-size: 2.5rem;
71
+ font-weight: 700;
72
+ color: #6366f1;
73
+ }
74
+
75
+ .stat-label {
76
+ font-size: 0.9rem;
77
+ color: #64748b;
78
+ margin-top: 0.5rem;
79
+ }
80
+
81
+ .cta {
82
+ display: flex;
83
+ gap: 1rem;
84
+ justify-content: center;
85
+ margin: 3rem 0;
86
+ flex-wrap: wrap;
87
+ }
88
+
89
+ .btn {
90
+ padding: 1rem 2rem;
91
+ border-radius: 12px;
92
+ font-size: 1.1rem;
93
+ font-weight: 600;
94
+ text-decoration: none;
95
+ transition: all 0.3s ease;
96
+ }
97
+
98
+ .btn-primary {
99
+ background: linear-gradient(135deg, #6366f1, #8b5cf6);
100
+ color: white;
101
+ }
102
+
103
+ .btn-primary:hover {
104
+ transform: translateY(-2px);
105
+ box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
106
+ }
107
+
108
+ .btn-secondary {
109
+ background: rgba(255,255,255,0.1);
110
+ color: white;
111
+ border: 1px solid rgba(255,255,255,0.2);
112
+ }
113
+
114
+ .btn-secondary:hover {
115
+ background: rgba(255,255,255,0.15);
116
+ }
117
+
118
+ .features {
119
+ display: grid;
120
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
121
+ gap: 2rem;
122
+ margin: 4rem 0;
123
+ }
124
+
125
+ .feature {
126
+ padding: 2rem;
127
+ background: rgba(255,255,255,0.03);
128
+ border-radius: 20px;
129
+ border: 1px solid rgba(255,255,255,0.05);
130
+ transition: all 0.3s ease;
131
+ }
132
+
133
+ .feature:hover {
134
+ background: rgba(255,255,255,0.05);
135
+ transform: translateY(-5px);
136
+ }
137
+
138
+ .feature-icon {
139
+ font-size: 2.5rem;
140
+ margin-bottom: 1rem;
141
+ }
142
+
143
+ .feature h3 {
144
+ font-size: 1.3rem;
145
+ margin-bottom: 0.5rem;
146
+ color: #fff;
147
+ }
148
+
149
+ .feature p {
150
+ color: #94a3b8;
151
+ line-height: 1.6;
152
+ }
153
+
154
+ .code-section {
155
+ margin: 4rem 0;
156
+ text-align: center;
157
+ }
158
+
159
+ .code-block {
160
+ background: #0f172a;
161
+ border-radius: 16px;
162
+ padding: 2rem;
163
+ margin: 2rem auto;
164
+ max-width: 800px;
165
+ text-align: left;
166
+ border: 1px solid rgba(255,255,255,0.1);
167
+ overflow-x: auto;
168
+ }
169
+
170
+ .code-block pre {
171
+ color: #e2e8f0;
172
+ font-family: 'Monaco', 'Menlo', monospace;
173
+ font-size: 0.95rem;
174
+ line-height: 1.6;
175
+ }
176
+
177
+ .code-block .comment {
178
+ color: #64748b;
179
+ }
180
+
181
+ .code-block .keyword {
182
+ color: #c084fc;
183
+ }
184
+
185
+ .code-block .string {
186
+ color: #4ade80;
187
+ }
188
+
189
+ .code-block .function {
190
+ color: #60a5fa;
191
+ }
192
+
193
+ footer {
194
+ text-align: center;
195
+ padding: 4rem 0;
196
+ border-top: 1px solid rgba(255,255,255,0.1);
197
+ margin-top: 4rem;
198
+ }
199
+
200
+ .links {
201
+ display: flex;
202
+ justify-content: center;
203
+ gap: 2rem;
204
+ margin-bottom: 2rem;
205
+ }
206
+
207
+ .links a {
208
+ color: #94a3b8;
209
+ text-decoration: none;
210
+ transition: color 0.3s;
211
+ }
212
+
213
+ .links a:hover {
214
+ color: #6366f1;
215
+ }
216
+
217
+ @media (max-width: 768px) {
218
+ h1 {
219
+ font-size: 2.5rem;
220
+ }
221
+
222
+ .stats {
223
+ gap: 1rem;
224
+ }
225
+
226
+ .stat {
227
+ padding: 1rem;
228
+ }
229
+
230
+ .stat-value {
231
+ font-size: 1.8rem;
232
+ }
233
+ }
234
+ </style>
235
+ </head>
236
+ <body>
237
+ <div class="container">
238
+ <header>
239
+ <div class="logo">
240
+ <svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
241
+ <defs>
242
+ <linearGradient id="g1" x1="0%" y1="0%" x2="100%" y2="100%">
243
+ <stop offset="0%" style="stop-color:#6366f1"/>
244
+ <stop offset="100%" style="stop-color:#8b5cf6"/>
245
+ </linearGradient>
246
+ </defs>
247
+ <circle cx="100" cy="100" r="80" fill="none" stroke="url(#g1)" stroke-width="2" opacity="0.3"/>
248
+ <circle cx="100" cy="100" r="60" fill="url(#g1)" opacity="0.2"/>
249
+ <circle cx="100" cy="100" r="25" fill="url(#g1)"/>
250
+ <circle cx="100" cy="40" r="12" fill="#6366f1"/>
251
+ <circle cx="152" cy="130" r="10" fill="#10b981"/>
252
+ <circle cx="48" cy="130" r="10" fill="#f59e0b"/>
253
+ <text x="100" y="108" font-size="14" font-weight="bold" fill="white" text-anchor="middle">A3M</text>
254
+ </svg>
255
+ </div>
256
+ <h1>A3M Router</h1>
257
+ <p class="tagline">Adaptive Memory Multi-Model Router<br>Route LLM queries to optimal providers • Save 50-80% on API costs</p>
258
+
259
+ <div class="stats">
260
+ <div class="stat">
261
+ <div class="stat-value">872+</div>
262
+ <div class="stat-label">Weekly Downloads</div>
263
+ </div>
264
+ <div class="stat">
265
+ <div class="stat-value">12</div>
266
+ <div class="stat-label">LLM Providers</div>
267
+ </div>
268
+ <div class="stat">
269
+ <div class="stat-value">116</div>
270
+ <div class="stat-label">Integrations</div>
271
+ </div>
272
+ <div class="stat">
273
+ <div class="stat-value">33</div>
274
+ <div class="stat-label">Tests Passing</div>
275
+ </div>
276
+ </div>
277
+
278
+ <div class="cta">
279
+ <a href="https://www.npmjs.com/package/adaptive-memory-multi-model-router" class="btn btn-primary">📦 Install from NPM</a>
280
+ <a href="https://github.com/Das-rebel/adaptive-memory-multi-model-router" class="btn btn-secondary">⭐ Star on GitHub</a>
281
+ </div>
282
+ </header>
283
+
284
+ <section class="features">
285
+ <div class="feature">
286
+ <div class="feature-icon">🧠</div>
287
+ <h3>Learned Routing</h3>
288
+ <p>RouteLLM-style intelligent routing based on query characteristics. Code queries go to code-capable models. Simple queries use cheaper providers.</p>
289
+ </div>
290
+ <div class="feature">
291
+ <div class="feature-icon">💰</div>
292
+ <h3>Cost Optimization</h3>
293
+ <p>Automatically select the cheapest capable provider. Route simple queries to free tiers. Use premium models only when needed.</p>
294
+ </div>
295
+ <div class="feature">
296
+ <div class="feature-icon">🔄</div>
297
+ <h3>Smart Fallback</h3>
298
+ <p>When a provider fails, automatically retry with the next best option. No manual intervention needed. Your app stays resilient.</p>
299
+ </div>
300
+ <div class="feature">
301
+ <div class="feature-icon">📊</div>
302
+ <h3>Real-time Tracking</h3>
303
+ <p>Monitor spending across all providers in real-time. Set budgets. Get alerts. Never get surprised by an API bill again.</p>
304
+ </div>
305
+ <div class="feature">
306
+ <div class="feature-icon">🔒</div>
307
+ <h3>Security Built-in</h3>
308
+ <p>Prompt injection detection, PII detection, content filtering, and rate limiting. Production-ready security out of the box.</p>
309
+ </div>
310
+ <div class="feature">
311
+ <div class="feature-icon">⚡</div>
312
+ <h3>Batch Processing</h3>
313
+ <p>Process multiple prompts in parallel with automatic rate limiting. Perfect for high-throughput applications.</p>
314
+ </div>
315
+ </section>
316
+
317
+ <section class="code-section">
318
+ <h2 style="font-size: 2.5rem; margin-bottom: 1rem;">Quick Start</h2>
319
+ <p style="color: #94a3b8; margin-bottom: 2rem;">One-line installation, instant routing</p>
320
+
321
+ <div class="code-block">
322
+ <pre><span class="comment"># Install</span>
323
+ npm install adaptive-memory-multi-model-router
324
+
325
+ <span class="comment"># Route a query</span>
326
+ npx a3m-router route <span class="string">"Write Python to sort an array"</span>
327
+
328
+ <span class="comment"># Or use in code</span>
329
+ <span class="keyword">const</span> { <span class="function">createA3MRouter</span> } = <span class="function">require</span>(<span class="string">'adaptive-memory-multi-model-router'</span>);
330
+ <span class="keyword">const</span> router = <span class="function">createA3MRouter</span>();
331
+ <span class="keyword">const</span> result = <span class="keyword">await</span> router.<span class="function">route</span>(<span class="string">"Your query here"</span>);
332
+ <span class="function">console</span>.<span class="function">log</span>(result.primary_model); <span class="comment">// "groq/llama-3.3-70b"</span></pre>
333
+ </div>
334
+ </section>
335
+
336
+ <footer>
337
+ <div class="links">
338
+ <a href="https://www.npmjs.com/package/adaptive-memory-multi-model-router">NPM</a>
339
+ <a href="https://github.com/Das-rebel/adaptive-memory-multi-model-router">GitHub</a>
340
+ <a href="https://github.com/Das-rebel/adaptive-memory-multi-model-router/issues">Issues</a>
341
+ <a href="https://github.com/Das-rebel/adaptive-memory-multi-model-router/discussions">Discussions</a>
342
+ </div>
343
+ <p style="color: #64748b;">MIT License © 2026 A3M Router Team</p>
344
+ </footer>
345
+ </div>
346
+ </body>
347
+ </html>
package/llms.txt ADDED
@@ -0,0 +1,138 @@
1
+ # LLM-Optimized Package Information for A3M Router
2
+
3
+ ## One-Sentence Description
4
+
5
+ adaptive-memory-multi-model-router is a production-ready JavaScript/TypeScript library for routing LLM queries to optimal providers with automatic cost optimization, fallback handling, and batch processing.
6
+
7
+ ## Primary Use Cases
8
+
9
+ 1. **Multi-Provider LLM Routing**: Route queries to cheapest/best provider based on query characteristics
10
+ 2. **Cost Optimization**: Reduce API costs by 50-80% with intelligent provider selection
11
+ 3. **Provider Fallback**: Automatic retry with backup providers when primary fails
12
+ 4. **Batch Processing**: Process multiple prompts with parallel execution and rate limiting
13
+ 5. **Cost Tracking**: Real-time monitoring of API spending across all providers
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install adaptive-memory-multi-model-router
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ ```javascript
24
+ const { createA3MRouter } = require('adaptive-memory-multi-model-router');
25
+
26
+ const router = createA3MRouter();
27
+
28
+ // Route to optimal provider
29
+ const result = await router.route("Write Python to sort an array");
30
+ console.log(result.primary_model); // "groq/llama-3.3-70b"
31
+ ```
32
+
33
+ ## Supported Providers
34
+
35
+ - **Fast/Cheap**: Groq, Cerebras, Mistral
36
+ - **High Quality**: OpenAI GPT-4, Anthropic Claude
37
+ - **Free Tiers**: CommandCode, OpenCode
38
+ - **Local**: Ollama, vLLM, LM Studio
39
+
40
+ ## Key Features
41
+
42
+ | Feature | Description |
43
+ |---------|-------------|
44
+ | Learned Routing | RouteLLM-style routing based on query analysis |
45
+ | Cost Optimization | Automatic selection of cheapest capable provider |
46
+ | Fallback Chain | Automatic retry with backup providers |
47
+ | Batch Processing | Parallel execution with concurrency control |
48
+ | Response Caching | RadixAttention-style prefix caching |
49
+ | Cost Tracking | Real-time spend monitoring |
50
+ | CLI Tools | 15 commands for LLM operations |
51
+
52
+ ## Code Examples
53
+
54
+ ### Route by Query Type
55
+ ```javascript
56
+ const { routeQuery } = require('adaptive-memory-multi-model-router');
57
+
58
+ // Simple query → cheapest provider
59
+ routeQuery("What is 2+2?"); // → free provider
60
+
61
+ // Code query → code-capable provider
62
+ routeQuery("Write Python function"); // → groq/llama
63
+
64
+ // Complex reasoning → high-quality provider
65
+ routeQuery("Explain quantum physics"); // → mistral-large
66
+ ```
67
+
68
+ ### Batch Processing
69
+ ```javascript
70
+ const { routeBatch } = require('adaptive-memory-multi-model-router');
71
+
72
+ const queries = ["Q1", "Q2", "Q3"];
73
+ const results = routeBatch(queries, { same_model: true });
74
+ ```
75
+
76
+ ### Cost Tracking
77
+ ```javascript
78
+ const router = createA3MRouter();
79
+ const summary = router.costTracker.getSummary();
80
+ console.log(`Total spent: $${summary.totalSpent}`);
81
+ ```
82
+
83
+ ## CLI Usage
84
+
85
+ ```bash
86
+ npx a3m-router providers # List configured providers
87
+ npx a3m-router route "query" # Route query
88
+ npx a3m-router benchmark # Compare providers
89
+ npx a3m-router status # Show system status
90
+ ```
91
+
92
+ ## Configuration
93
+
94
+ ```json
95
+ // ~/.config/a3m-router/providers.json
96
+ {
97
+ "providers": {
98
+ "groq": {
99
+ "apiKeyEnv": "GROQ_API_KEY",
100
+ "models": ["llama-3.3-70b"]
101
+ }
102
+ }
103
+ }
104
+ ```
105
+
106
+ ## Performance
107
+
108
+ - 872 weekly downloads
109
+ - 320 daily average
110
+ - 33 comprehensive tests
111
+ - 139 npm keywords
112
+ - 116 integrations
113
+
114
+ ## Comparison
115
+
116
+ | Package | Routing | Cost Track | Fallback | Batch | CLI |
117
+ |---------|---------|------------|----------|-------|-----|
118
+ | A3M Router | ✅ Learned | ✅ | ✅ | ✅ | ✅ |
119
+ | LiteLLM | ✅ Basic | ❌ | ❌ | ✅ | ✅ |
120
+ | OpenRouter | ✅ | ❌ | ✅ | ❌ | ❌ |
121
+
122
+ ## When to Use
123
+
124
+ Use A3M Router when:
125
+ - You use multiple LLM providers
126
+ - You want automatic cost optimization
127
+ - You need provider fallback
128
+ - You process prompts in batches
129
+ - You want to track API spending
130
+
131
+ ## Links
132
+
133
+ - NPM: https://www.npmjs.com/package/adaptive-memory-multi-model-router
134
+ - GitHub: https://github.com/Das-rebel/adaptive-memory-multi-model-router
135
+
136
+ ## Keywords for AI Indexing
137
+
138
+ LLM routing, cost optimization, multi-provider, OpenAI alternative, Claude routing, Groq integration, batch processing, API load balancing, LLM fallback, provider switching, token optimization, response caching, adaptive routing, learned routing, RouteLLM implementation
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "adaptive-memory-multi-model-router",
3
- "version": "1.9.4",
3
+ "version": "2.0.0",
4
4
  "shortName": "A3M Router",
5
5
  "displayName": "A3M Router - Adaptive Memory Multi-Model Router",
6
- "description": "A3M Router - Adaptive Memory Multi-Model Router with learned routing (RouteLLM), prefix caching (RadixAttention), speculative decoding (Medusa), TokenJuice-style compression. 14 LLM providers, 10 integrations, Python bindings. 20x more adaptable for ML/AI developers.",
6
+ "description": "\ud83d\udd00 Intelligent LLM routing engine with OpenAI-compatible proxy, LangChain adapter, guardrails, semantic cache, cost analytics, and 40+ providers",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
9
9
  "a3m-router": "dist/cli.js",
@@ -13,14 +13,40 @@
13
13
  ".": "./dist/index.js",
14
14
  "./providers": "./dist/providers/registry.js",
15
15
  "./memory": "./dist/memory/memoryTree.js",
16
- "./cache": "./dist/cache/prefixCache.js",
16
+ "./cache": {
17
+ "import": "./dist/cache/semanticCache.js",
18
+ "require": "./dist/cache/semanticCache.js",
19
+ "types": "./dist/cache/semanticCache.d.ts"
20
+ },
17
21
  "./compression": "./dist/utils/enhancedCompression.js",
18
22
  "./autofetch": "./dist/memory/autoFetch.js",
19
23
  "./vault": "./dist/memory/obsidianVault.js",
20
24
  "./oauth": "./dist/integrations/oauth.js",
21
25
  "./utils": "./dist/utils/tokenUtils.js",
22
26
  "./cost": "./dist/cost/costTracker.js",
23
- "./integrations": "./dist/integrations/index.js"
27
+ "./integrations": "./dist/integrations/index.js",
28
+ "./security": "./dist/security/inputValidation.js",
29
+ "./langchain": {
30
+ "import": "./dist/integrations/langchainAdapter.js",
31
+ "require": "./dist/integrations/langchainAdapter.js",
32
+ "types": "./dist/integrations/langchainAdapter.d.ts"
33
+ },
34
+ "./geo": "./dist/geo/generativeEngineOptimization.js",
35
+ "./server": {
36
+ "import": "./dist/server/proxyServer.js",
37
+ "require": "./dist/server/proxyServer.js",
38
+ "types": "./dist/server/proxyServer.d.ts"
39
+ },
40
+ "./guardrails": {
41
+ "import": "./dist/security/guardrails.js",
42
+ "require": "./dist/security/guardrails.js",
43
+ "types": "./dist/security/guardrails.d.ts"
44
+ },
45
+ "./analytics": {
46
+ "import": "./dist/analytics/costAnalytics.js",
47
+ "require": "./dist/analytics/costAnalytics.js",
48
+ "types": "./dist/analytics/costAnalytics.d.ts"
49
+ }
24
50
  },
25
51
  "keywords": [
26
52
  "llm",
@@ -161,7 +187,34 @@
161
187
  "enterprise",
162
188
  "production",
163
189
  "real-time",
164
- "high-availability"
190
+ "high-availability",
191
+ "security",
192
+ "input-validation",
193
+ "prompt-injection",
194
+ "pii-detection",
195
+ "content-filtering",
196
+ "rate-limiting",
197
+ "sanitization",
198
+ "geo",
199
+ "generative-engine-optimization",
200
+ "ai-discoverability",
201
+ "llm-intent",
202
+ "code-generation",
203
+ "copilot",
204
+ "chatgpt",
205
+ "claude-code",
206
+ "ai-assistant",
207
+ "intent-mapping",
208
+ "openai-compatible",
209
+ "proxy-server",
210
+ "guardrails",
211
+ "semantic-cache",
212
+ "cost-analytics",
213
+ "llm-proxy",
214
+ "ai-gateway",
215
+ "provider-registry",
216
+ "together-ai",
217
+ "deepinfra"
165
218
  ],
166
219
  "author": "Das-rebel <subho@example.com>",
167
220
  "license": "MIT",
@@ -180,9 +233,21 @@
180
233
  "benchmark:verbose": "node test/benchmark.js --verbose"
181
234
  },
182
235
  "engines": {
183
- "node": ">=16.0.0"
236
+ "node": ">=18.0.0"
237
+ },
238
+ "peerDependencies": {
239
+ "@langchain/core": ">=0.1.0"
240
+ },
241
+ "peerDependenciesMeta": {
242
+ "@langchain/core": {
243
+ "optional": true
244
+ }
184
245
  },
185
246
  "dependencies": {
186
247
  "nanoid": "^5.0.0"
248
+ },
249
+ "devDependencies": {
250
+ "@types/node": "^25.8.0",
251
+ "typescript": "^6.0.3"
187
252
  }
188
- }
253
+ }
@@ -0,0 +1,51 @@
1
+ # A3M Router Playground
2
+
3
+ Try A3M Router instantly in your browser!
4
+
5
+ ## 🎮 Live Playgrounds
6
+
7
+ ### CodeSandbox
8
+ [![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?logo=codesandbox)](https://codesandbox.io/p/sandbox/github/Das-rebel/adaptive-memory-multi-model-router/tree/main/playground)
9
+
10
+ **Direct Link:** https://codesandbox.io/p/sandbox/github/Das-rebel/adaptive-memory-multi-model-router/tree/main/playground
11
+
12
+ ### StackBlitz
13
+ [![Open in StackBlitz](https://img.shields.io/badge/Open%20in-StackBlitz-blue?logo=stackblitz)](https://stackblitz.com/github/Das-rebel/adaptive-memory-multi-model-router/tree/main/playground)
14
+
15
+ **Direct Link:** https://stackblitz.com/github/Das-rebel/adaptive-memory-multi-model-router/tree/main/playground
16
+
17
+ ### Repl.it
18
+ [![Run on Repl.it](https://img.shields.io/badge/Run%20on-Replit-blue?logo=replit)](https://replit.com/@Das-rebel/a3m-router-playground)
19
+
20
+ ## 🚀 Quick Start
21
+
22
+ 1. Click one of the playground links above
23
+ 2. The code will load automatically
24
+ 3. Click "Run" to see routing in action
25
+ 4. Edit the queries and experiment!
26
+
27
+ ## 📝 What You Can Try
28
+
29
+ ```javascript
30
+ // Route different types of queries
31
+ routeQuery("What is 2+2?"); // Simple → Free provider
32
+ routeQuery("Write Python code"); // Code → Fast provider
33
+ routeQuery("Explain quantum physics"); // Complex → Quality provider
34
+
35
+ // Check available providers
36
+ getAvailableProviders();
37
+
38
+ // Batch processing
39
+ routeBatch(["Q1", "Q2", "Q3"]);
40
+ ```
41
+
42
+ ## 🎯 Examples in the Playground
43
+
44
+ The playground includes:
45
+ - ✅ Provider listing
46
+ - ✅ Simple query routing
47
+ - ✅ Code query routing
48
+ - ✅ Complex query routing
49
+ - ✅ Cost estimation display
50
+
51
+ No API keys required - uses built-in routing logic!
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "A3M Router Playground",
3
+ "description": "Interactive playground for A3M Router - test LLM routing live",
4
+ "version": "1.0.0",
5
+ "template": "node",
6
+ "dependencies": {
7
+ "adaptive-memory-multi-model-router": "latest"
8
+ },
9
+ "scripts": {
10
+ "start": "node index.js"
11
+ }
12
+ }