adaptive-memory-multi-model-router 1.9.5 → 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 (121) 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/hashnode-llm-cost-optimization.md +125 -0
  42. package/articles/medium-building-llm-router.md +205 -0
  43. package/articles/twitter-thread-cost-savings.md +98 -0
  44. package/articles/youtube-tutorial-script.md +262 -0
  45. package/assets/banner.svg +109 -0
  46. package/assets/logo.svg +68 -0
  47. package/assets/social-preview.svg +64 -0
  48. package/demo/demo-script.md +53 -0
  49. package/dist/analytics/costAnalytics.d.ts +77 -0
  50. package/dist/analytics/costAnalytics.d.ts.map +1 -0
  51. package/dist/analytics/costAnalytics.js +219 -0
  52. package/dist/analytics/costAnalytics.js.map +1 -0
  53. package/dist/cache/semanticCache.d.ts +62 -0
  54. package/dist/cache/semanticCache.d.ts.map +1 -0
  55. package/dist/cache/semanticCache.js +176 -0
  56. package/dist/cache/semanticCache.js.map +1 -0
  57. package/dist/cli.js +35 -0
  58. package/dist/index.d.ts +4 -723
  59. package/dist/index.js +11 -362
  60. package/dist/index.js.map +1 -1
  61. package/dist/integrations/langchainAdapter.d.ts +146 -0
  62. package/dist/integrations/langchainAdapter.d.ts.map +1 -0
  63. package/dist/integrations/langchainAdapter.js +731 -0
  64. package/dist/integrations/langchainAdapter.js.map +1 -0
  65. package/dist/integrations/oauth.d.ts +69 -0
  66. package/dist/integrations/oauth.d.ts.map +1 -0
  67. package/dist/integrations/oauth.js +225 -21
  68. package/dist/integrations/oauth.js.map +1 -0
  69. package/dist/memory/autoFetch.d.ts +39 -0
  70. package/dist/memory/autoFetch.d.ts.map +1 -0
  71. package/dist/memory/autoFetch.js +80 -88
  72. package/dist/memory/autoFetch.js.map +1 -0
  73. package/dist/memory/memoryTree.d.ts +76 -0
  74. package/dist/memory/memoryTree.d.ts.map +1 -0
  75. package/dist/memory/memoryTree.js +185 -130
  76. package/dist/memory/memoryTree.js.map +1 -0
  77. package/dist/memory/obsidianVault.d.ts +71 -0
  78. package/dist/memory/obsidianVault.d.ts.map +1 -0
  79. package/dist/memory/obsidianVault.js +207 -22
  80. package/dist/memory/obsidianVault.js.map +1 -0
  81. package/dist/providers/providerConfig.d.ts +49 -0
  82. package/dist/providers/providerConfig.d.ts.map +1 -0
  83. package/dist/providers/providerConfig.js +806 -401
  84. package/dist/providers/providerConfig.js.map +1 -0
  85. package/dist/security/guardrails.d.ts +76 -0
  86. package/dist/security/guardrails.d.ts.map +1 -0
  87. package/dist/security/guardrails.js +479 -0
  88. package/dist/security/guardrails.js.map +1 -0
  89. package/dist/server/dashboard.d.ts +58 -0
  90. package/dist/server/dashboard.d.ts.map +1 -0
  91. package/dist/server/dashboard.js +553 -0
  92. package/dist/server/dashboard.js.map +1 -0
  93. package/dist/server/modelMapper.d.ts +43 -0
  94. package/dist/server/modelMapper.d.ts.map +1 -0
  95. package/dist/server/modelMapper.js +154 -0
  96. package/dist/server/modelMapper.js.map +1 -0
  97. package/dist/server/proxyServer.d.ts +41 -0
  98. package/dist/server/proxyServer.d.ts.map +1 -0
  99. package/dist/server/proxyServer.js +932 -0
  100. package/dist/server/proxyServer.js.map +1 -0
  101. package/dist/skills/__tests__/skill_manager.test.d.ts +2 -0
  102. package/dist/skills/__tests__/skill_manager.test.d.ts.map +1 -0
  103. package/dist/skills/__tests__/skill_manager.test.js +268 -0
  104. package/dist/skills/__tests__/skill_manager.test.js.map +1 -0
  105. package/docs-site/index.html +347 -0
  106. package/package.json +53 -7
  107. package/playground/README.md +51 -0
  108. package/playground/codesandbox.json +12 -0
  109. package/playground/index.js +39 -0
  110. package/scripts/update-npm-badges.js +158 -0
  111. package/src/analytics/costAnalytics.ts +304 -0
  112. package/src/cache/semanticCache.ts +221 -0
  113. package/src/index.ts +6 -0
  114. package/src/integrations/langchainAdapter.ts +955 -0
  115. package/src/providers/providerConfig.ts +923 -0
  116. package/src/security/guardrails.ts +585 -0
  117. package/src/server/dashboard.ts +610 -0
  118. package/src/server/modelMapper.ts +182 -0
  119. package/src/server/proxyServer.ts +1105 -0
  120. package/src/types/langchain.d.ts +83 -0
  121. 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/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "adaptive-memory-multi-model-router",
3
- "version": "1.9.5",
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,7 +13,11 @@
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",
@@ -22,7 +26,27 @@
22
26
  "./cost": "./dist/cost/costTracker.js",
23
27
  "./integrations": "./dist/integrations/index.js",
24
28
  "./security": "./dist/security/inputValidation.js",
25
- "./geo": "./dist/geo/generativeEngineOptimization.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
+ }
26
50
  },
27
51
  "keywords": [
28
52
  "llm",
@@ -180,7 +204,17 @@
180
204
  "chatgpt",
181
205
  "claude-code",
182
206
  "ai-assistant",
183
- "intent-mapping"
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"
184
218
  ],
185
219
  "author": "Das-rebel <subho@example.com>",
186
220
  "license": "MIT",
@@ -199,9 +233,21 @@
199
233
  "benchmark:verbose": "node test/benchmark.js --verbose"
200
234
  },
201
235
  "engines": {
202
- "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
+ }
203
245
  },
204
246
  "dependencies": {
205
247
  "nanoid": "^5.0.0"
248
+ },
249
+ "devDependencies": {
250
+ "@types/node": "^25.8.0",
251
+ "typescript": "^6.0.3"
206
252
  }
207
- }
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
+ }
@@ -0,0 +1,39 @@
1
+ // A3M Router Playground - Try it live!
2
+ const { createA3MRouter, routeQuery, getAvailableProviders } = require('adaptive-memory-multi-model-router');
3
+
4
+ console.log('šŸš€ A3M Router Playground\n');
5
+ console.log('═══════════════════════════════════════════════════════════════\n');
6
+
7
+ // Show available providers
8
+ console.log('šŸ“” Available Providers:');
9
+ const providers = getAvailableProviders();
10
+ for (const [id, p] of Object.entries(providers)) {
11
+ console.log(` āœ… ${id}: ${p.models.length} models (${p.type})`);
12
+ }
13
+
14
+ console.log('\nšŸ”€ Routing Examples:\n');
15
+
16
+ // Example 1: Simple query
17
+ const simple = routeQuery("What is 2+2?");
18
+ console.log('1. "What is 2+2?"');
19
+ console.log(` → ${simple.primary_model}`);
20
+ console.log(` → Est. Cost: $${simple.estimated_cost.toFixed(6)}`);
21
+ console.log(` → Reason: ${simple.reasoning}\n`);
22
+
23
+ // Example 2: Code query
24
+ const code = routeQuery("Write Python to reverse a string");
25
+ console.log('2. "Write Python to reverse a string"');
26
+ console.log(` → ${code.primary_model}`);
27
+ console.log(` → Est. Cost: $${code.estimated_cost.toFixed(6)}`);
28
+ console.log(` → Reason: ${code.reasoning}\n`);
29
+
30
+ // Example 3: Complex query
31
+ const complex = routeQuery("Explain quantum entanglement");
32
+ console.log('3. "Explain quantum entanglement"');
33
+ console.log(` → ${complex.primary_model}`);
34
+ console.log(` → Est. Cost: $${complex.estimated_cost.toFixed(6)}`);
35
+ console.log(` → Reason: ${complex.reasoning}\n`);
36
+
37
+ console.log('═══════════════════════════════════════════════════════════════');
38
+ console.log('Try editing the queries above and see how routing changes!');
39
+ console.log('═══════════════════════════════════════════════════════════════');