adaptive-memory-multi-model-router 2.14.0 โ†’ 2.14.1

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 (59) hide show
  1. package/.github/workflows/auto-publish.yml +45 -0
  2. package/.github/workflows/npm-publish.yml +6 -6
  3. package/ARCHITECTURE.md +1 -1
  4. package/LANDING.md +1 -1
  5. package/LAUNCH.md +21 -21
  6. package/MANIFESTO.md +2 -2
  7. package/README.md +39 -24
  8. package/SUBMISSIONS.md +1 -1
  9. package/articles/COMPETITOR_ALERTS.md +31 -0
  10. package/articles/DEVTO_MULTI_PROVIDER.md +1 -1
  11. package/articles/FRESH_devto.md +3 -3
  12. package/articles/FRESH_hackernews.md +4 -4
  13. package/articles/FRESH_reddit_ml.md +6 -6
  14. package/articles/FRESH_reddit_node.md +2 -2
  15. package/articles/FRESH_reddit_sideproject.md +1 -1
  16. package/articles/FRESH_reddit_webdev.md +1 -1
  17. package/articles/FROM_ZERO_TO_10K.md +2 -2
  18. package/articles/HN_ACCOUNT_GUIDE.md +21 -0
  19. package/articles/HN_CHINESE_STYLE.md +1 -1
  20. package/articles/HN_FINAL.md +7 -7
  21. package/articles/HN_TIMING_GUIDE.md +52 -0
  22. package/articles/INDIEHACKERS_POST.md +52 -0
  23. package/articles/LLM_BENCHMARK_DEEP_DIVE.md +1 -1
  24. package/articles/PRODUCTHUNT_LISTING.md +48 -0
  25. package/articles/SHOW_HN_FINAL.md +29 -0
  26. package/benchmark-results.json +22 -5
  27. package/demo/VEO3_PROMPTS.md +269 -0
  28. package/demo/VIDEO_PRODUCTION_GUIDE.md +333 -0
  29. package/demo/asciinema-demo.sh +184 -0
  30. package/demo/demo-hn.tape +95 -0
  31. package/docs/BENCHMARK.md +3 -3
  32. package/docs/COUNCIL_V2.2_DECISION.md +1 -1
  33. package/docs/GEO.md +4 -4
  34. package/docs/HN_CHECKLIST.md +2 -2
  35. package/docs/HN_FOUNDER_COMMENT.md +1 -1
  36. package/docs/HN_SUBMISSION_FINAL.md +12 -12
  37. package/docs/HN_SUBMISSION_V3.md +5 -5
  38. package/docs/QUICK_START.md +1 -1
  39. package/docs/TMLPD_V2.2_RESEARCH_ROADMAP.md +7 -7
  40. package/docs/UPDATE_TOPICS.md +1 -1
  41. package/docs/architecture-diagram.md +40 -0
  42. package/docs/benchmark.html +4 -4
  43. package/docs/blog/routerarena-number-one.html +2 -2
  44. package/docs/comparison-litellm.md +88 -0
  45. package/docs/comparison.md +1 -1
  46. package/docs/cost-chart-ascii.md +42 -0
  47. package/docs/cost-comparison-chart.svg +88 -0
  48. package/docs/demo.html +1 -1
  49. package/docs/index.html +72 -27
  50. package/docs/llms.txt +31 -50
  51. package/docs/robots.txt +15 -0
  52. package/docs/sitemap.xml +59 -53
  53. package/hf-space/README.md +11 -10
  54. package/hf-space/app.py +214 -71
  55. package/hf-space/requirements.txt +1 -0
  56. package/index.html +1 -1
  57. package/llms.txt +1 -1
  58. package/package.json +1 -1
  59. package/proxy/README.md +2 -2
package/hf-space/app.py CHANGED
@@ -1,97 +1,240 @@
1
1
  import gradio as gr
2
- import json, time, os, httpx
2
+ import json
3
+ import time
4
+ import os
5
+ import random
3
6
 
4
- # Sample responses for demo (no API keys needed)
5
- DEMO_RESPONSES = {
6
- "hello": {
7
- "GPT-4o mini": "Hello! How can I help you today?",
8
- "Claude 3.5 Sonnet": "Hi there! I'm ready to assist you with any questions.",
9
- "Llama 3.3 70B": "Hey! What can I do for you today?",
10
- },
11
- "default": {
12
- "GPT-4o mini": "That's a great question! Here's what I know about it...",
13
- "Claude 3.5 Sonnet": "I'd be happy to help with that. Let me share some insights...",
14
- "Llama 3.3 70B": "Great question! Based on my knowledge, here's what I think...",
15
- }
7
+ # A3M Router Demo - Live Parallel LLM Execution Visualization
8
+ # No API keys needed - uses simulated responses for the demo
9
+
10
+ PROVIDERS = [
11
+ ("OpenAI/GPT-4o-mini", 0.00015, 0.85),
12
+ ("Anthropic/Claude-3.5-Haiku", 0.00025, 0.83),
13
+ ("Groq/Llama-3.3-70B", 0.000059, 0.82),
14
+ ("DeepSeek/Chat", 0.000014, 0.79),
15
+ ("NVIDIA/Llama-3.3-70B", 0.00022, 0.84),
16
+ ("Together/Mistral-7B", 0.000018, 0.76),
17
+ ("OpenRouter/Auto", 0.000030, 0.80),
18
+ ]
19
+
20
+ BENCHMARK_DATA = [
21
+ ("A3M Router ๐Ÿฅ‡", 76.43, 0.047, True),
22
+ ("Sqwish ๐Ÿฅˆ", 75.27, 0.18, False),
23
+ ("Azure (Microsoft) ๐Ÿฅ‰", 71.87, 0.22, False),
24
+ ("GPT-5 (OpenAI)", 64.32, 10.02, False),
25
+ ("RouteLLM (Berkeley)", 48.07, 0.27, True),
26
+ ]
27
+
28
+ SAMPLE_RESPONSES = {
29
+ "hello": "Hello! I'm here to help. What would you like to know?",
30
+ "what is machine learning": "Machine learning is a subset of AI where algorithms learn patterns from data to make predictions, without being explicitly programmed for each task.",
31
+ "explain quantum computing": "Quantum computing uses quantum mechanical phenomena like superposition and entanglement to perform computations exponentially faster than classical computers for specific problems.",
32
+ "write a python sort": "def quicksort(arr):\n if len(arr) <= 1: return arr\n pivot = arr[len(arr)//2]\n left = [x for x in arr if x < pivot]\n right = [x for x in arr if x > pivot]\n return quicksort(left) + [pivot] + quicksort(right)",
16
33
  }
17
34
 
18
- def simulate_parallel(query):
19
- """Simulate parallel LLM execution with confidence scoring."""
20
- responses = DEMO_RESPONSES.get("default")
21
- if query.lower() in DEMO_RESPONSES:
22
- responses = DEMO_RESPONSES[query.lower()]
35
+ def simulate_routing(query, strategy):
36
+ """Simulate parallel LLM routing with confidence scoring."""
37
+ if not query.strip():
38
+ return "", "", "", ""
39
+
40
+ start = time.time()
23
41
 
42
+ # Find best matching sample response
43
+ response_base = SAMPLE_RESPONSES.get("what is machine learning") # default
44
+ for key in SAMPLE_RESPONSES:
45
+ if key in query.lower():
46
+ response_base = SAMPLE_RESPONSES[key]
47
+ break
48
+
49
+ # Simulate parallel execution
24
50
  results = []
25
- for provider, response in responses.items():
26
- # Simulate some delay per provider
27
- latency = round(0.1 + hash(query + provider) % 300 / 1000, 2)
28
- confidence = round(0.75 + hash(query + provider) % 20 / 100, 2)
51
+ for provider, cost, base_conf in PROVIDERS:
52
+ latency = round(random.uniform(80, 350), 0)
53
+ # Add confidence variation
54
+ conf = round(base_conf + random.uniform(-0.05, 0.05), 2)
55
+ conf = min(max(conf, 0.5), 0.99)
29
56
  results.append({
30
57
  "provider": provider,
31
- "response": response,
32
- "latency": f"{latency}s",
33
- "confidence": confidence
58
+ "response": response_base[:60] + "...",
59
+ "latency_ms": int(latency),
60
+ "confidence": conf,
61
+ "cost": cost,
62
+ "winner": False
34
63
  })
35
64
 
36
- # Sort by confidence
65
+ # Sort by confidence (A3M's strategy)
37
66
  results.sort(key=lambda x: x["confidence"], reverse=True)
67
+ results[0]["winner"] = True
38
68
 
39
- return results
40
-
41
- def process_query(query):
42
- if not query.strip():
43
- return "Please enter a query.", "", ""
44
-
45
- start = time.time()
46
- results = simulate_parallel(query)
47
- elapsed = time.time() - start
69
+ winner = results[0]
70
+ total_cost = winner["cost"]
71
+ total_latency = max(r["latency_ms"] for r in results) # Parallel = max
72
+ elapsed = round((time.time() - start) * 1000, 0)
48
73
 
49
- # Format results
50
- table = "| Provider | Response | Latency | Confidence |\n|----------|----------|---------|------------|\n"
74
+ # Format results table
75
+ table = "| Provider | Confidence | Latency | Cost |\n|----------|-----------|---------|------|\n"
51
76
  for r in results:
52
- table += f"| {r['provider']} | {r['response'][:50]}... | {r['latency']} | {r['confidence']} |\n"
77
+ icon = "๐Ÿ†" if r["winner"] else ""
78
+ table += f"| {icon} {r['provider']} | {r['confidence']:.0%} | {r['latency_ms']}ms | ${r['cost']:.6f} |\n"
53
79
 
54
- winner = results[0]
55
- summary = f"๐Ÿ† **Winner: {winner['provider']}** (confidence: {winner['confidence']})\n\nTotal time: {elapsed:.2f}s | Providers: {len(results)} in parallel\n\n**Best response:** {winner['response']}"
80
+ # Summary
81
+ summary = f"### ๐Ÿ† Winner: **{winner['provider']}**\n\n"
82
+ summary += f"- **Confidence:** {winner['confidence']:.0%}\n"
83
+ summary += f"- **Cost:** ${winner['cost']:.6f}\n"
84
+ summary += f"- **Total parallel latency:** {total_latency}ms\n"
85
+ summary += f"- **Strategy:** {strategy}\n\n"
86
+ summary += f"You got the **best response at the lowest cost** because all providers ran in parallel."
87
+
88
+ # Cost comparison
89
+ gpt5_cost = 10.02 / 1000
90
+ savings = round(gpt5_cost / winner["cost"]) if winner["cost"] > 0 else 999
91
+ cost_text = f"### ๐Ÿ’ฐ Cost vs Sequential Fallback\n\n"
92
+ cost_text += f"| Approach | Cost | Latency |\n|----------|------|----------|\n"
93
+ cost_text += f"| **A3M (parallel)** | **${winner['cost']:.6f}** | **{total_latency}ms** |\n"
94
+ cost_text += f"| Sequential (3 retries) | ${total_cost * 3:.6f} | {total_latency * 3}ms |\n"
95
+ cost_text += f"| GPT-5 (OpenAI) | ${gpt5_cost:.4f} | ~500ms |\n\n"
96
+ cost_text += f"**{savings}ร— cheaper** than calling GPT-5 directly.\n"
56
97
 
57
- return table, summary, json.dumps(results, indent=2)
98
+ return table, summary, cost_text, json.dumps(results, indent=2)
58
99
 
59
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
60
- gr.Markdown("# ๐Ÿ”€ A3M Router โ€” Parallel LLM Demo")
61
- gr.Markdown("See how A3M Router runs multiple providers **in parallel** and picks the best response by confidence scoring.")
62
-
63
- with gr.Row():
64
- query = gr.Textbox(label="Your Query", placeholder="Enter a question...", scale=3)
65
- submit = gr.Button("๐Ÿš€ Execute", variant="primary", scale=1)
66
-
67
- with gr.Row():
68
- with gr.Column():
69
- gr.Markdown("### ๐Ÿ“Š Results Table")
70
- results_table = gr.Dataframe(
71
- headers=["Provider", "Response", "Latency", "Confidence"],
72
- label="Parallel Results"
73
- )
74
- with gr.Column():
75
- gr.Markdown("### ๐Ÿ† Best Result")
76
- best_result = gr.Markdown()
100
+ def generate_benchmark():
101
+ """Generate benchmark comparison chart."""
102
+ chart_data = gr.Dataframe(
103
+ value=[[r[0], r[1], f"${r[2]}"] for r in BENCHMARK_DATA],
104
+ headers=["Router", "RouterArena Score", "Cost/1K"],
105
+ label="RouterArena Benchmark Results (arXiv:2510.00202)"
106
+ )
107
+ return chart_data
108
+
109
+ with gr.Blocks(
110
+ theme=gr.themes.Soft(primary_hue="green"),
111
+ css="""
112
+ .winner-row { background-color: #1a3a1a !important; }
113
+ footer { display: none !important; }
114
+ """
115
+ ) as demo:
116
+ gr.Markdown("""
117
+ # ๐Ÿ”€ A3M Router โ€” #1 LLM Routing Benchmark & Cheapest Router with Memory
118
+
119
+ **See how parallel LLM execution works in real-time.** Enter a query and watch 7 providers compete simultaneously.
77
120
 
78
- with gr.Row():
121
+ โญ RouterArena #1 (76.43) | ๐Ÿ’ฐ Cheapest at $0.047/1K | ๐Ÿ”“ Open-source (MIT) | ๐Ÿ“ฆ 19.5KB
122
+ """)
123
+
124
+ with gr.Tab("๐Ÿš€ Try It"):
125
+ with gr.Row():
126
+ query = gr.Textbox(
127
+ label="Your Query",
128
+ placeholder="Try: explain quantum computing, what is machine learning, write a python sort...",
129
+ scale=4
130
+ )
131
+ strategy = gr.Dropdown(
132
+ choices=["parallel (A3M default)", "fastest", "creative", "deep"],
133
+ value="parallel (A3M default)",
134
+ label="Strategy",
135
+ scale=1
136
+ )
137
+ submit = gr.Button("๐Ÿš€ Execute Parallel Routing", variant="primary", size="lg")
138
+
139
+ with gr.Row():
140
+ with gr.Column(scale=2):
141
+ results_table = gr.Markdown(label="Results")
142
+ with gr.Column(scale=1):
143
+ summary = gr.Markdown(label="Best Result")
144
+
145
+ with gr.Row():
146
+ cost_comparison = gr.Markdown(label="Cost Savings")
147
+
79
148
  with gr.Accordion("Raw JSON Output", open=False):
80
149
  raw_output = gr.JSON()
150
+
151
+ gr.Examples(
152
+ examples=[["Explain quantum computing"], ["What is machine learning?"], ["Write a Python sort function"], ["Hello, how are you?"]],
153
+ inputs=query
154
+ )
155
+
156
+ submit.click(
157
+ fn=simulate_routing,
158
+ inputs=[query, strategy],
159
+ outputs=[results_table, summary, cost_comparison, raw_output]
160
+ )
81
161
 
82
- gr.Markdown("---\n### โšก In production, A3M Router runs on 47+ providers with real API calls")
83
- gr.Markdown("[๐Ÿ“– GitHub](https://github.com/Das-rebel/a3m-router) | [๐Ÿ“ฆ npm](https://www.npmjs.com/package/adaptive-memory-multi-model-router) | 19.5 KB | Zero ML | MIT")
162
+ with gr.Tab("๐Ÿ“Š Benchmark"):
163
+ gr.Markdown("""
164
+ ### RouterArena Benchmark Results
165
+
166
+ | Rank | Router | Score | Cost/1K | Open Source? |
167
+ |------|--------|:-----:|:-------:|:------------:|
168
+ | ๐Ÿฅ‡ | **A3M Router** | **76.43** | **$0.047** | โœ… |
169
+ | ๐Ÿฅˆ | Sqwish | 75.27 | $0.18 | โŒ |
170
+ | ๐Ÿฅ‰ | Azure (Microsoft) | 71.87 | $0.22 | โŒ |
171
+ | 4 | GPT-5 (OpenAI) | 64.32 | $10.02 | โŒ |
172
+ | 5 | RouteLLM (Berkeley) | 48.07 | $0.27 | โœ… |
173
+
174
+ **213ร— cheaper than GPT-5, 12 points higher.** Evaluated by RouterArena (arXiv:2510.00202) on 8,400 queries across 9 domains.
175
+
176
+ [Full Benchmark โ†’](https://das-rebel.github.io/a3m-router/benchmark) | [RouterArena PR โ†’](https://github.com/RouteWorks/RouterArena/pull/113)
177
+ """)
84
178
 
85
- submit.click(
86
- fn=process_query,
87
- inputs=query,
88
- outputs=[results_table, best_result, raw_output]
89
- )
179
+ with gr.Tab("๐Ÿ’ป Code"):
180
+ gr.Markdown("""
181
+ ### Install & Run in 5 Seconds
182
+
183
+ ```bash
184
+ # No config needed โ€” auto-detects API keys from environment
185
+ npm install adaptive-memory-multi-model-router
186
+ npx a3m-router route "Explain quantum computing"
187
+ ```
188
+
189
+ ### TypeScript/Node.js
190
+
191
+ ```javascript
192
+ import { createRouter } from 'adaptive-memory-multi-model-router';
193
+
194
+ const router = createRouter(); // auto-detects API keys
195
+
196
+ // Parallel execution with confidence scoring
197
+ const result = await router.route('What is machine learning?');
198
+
199
+ console.log(result.response); // Best response
200
+ console.log(result.provider); // Winning provider
201
+ console.log(result.cost); // Actual cost
202
+ console.log(result.confidence); // Confidence score
203
+ ```
204
+
205
+ ### With Memory (Unique Feature)
206
+
207
+ ```javascript
208
+ const router = createRouter({
209
+ memory: { enabled: true } // Context persists across sessions
210
+ });
211
+
212
+ await router.route('My name is Alice');
213
+ await router.route('What is my name?'); // โ†’ "Your name is Alice!"
214
+ ```
215
+
216
+ ### CLI
217
+
218
+ ```bash
219
+ # Route a query
220
+ npx a3m-router route "Explain quantum computing"
221
+
222
+ # Check costs
223
+ npx a3m-router cost
224
+
225
+ # Health check
226
+ npx a3m-router health
227
+ ```
228
+
229
+ [GitHub โ†’](https://github.com/Das-rebel/a3m-router) | [npm โ†’](https://www.npmjs.com/package/adaptive-memory-multi-model-router) | [Docs โ†’](https://das-rebel.github.io/a3m-router/)
230
+ """)
90
231
 
91
- gr.Examples(
92
- examples=[["Hello, how are you?"], ["What is machine learning?"], ["Explain quantum computing"]],
93
- inputs=query
94
- )
232
+ gr.Markdown("""
233
+ ---
234
+ ๐Ÿ”€ A3M Router โ€” #1 LLM Routing Benchmark & Cheapest Router with Memory | [GitHub](https://github.com/Das-rebel/a3m-router) | [npm](https://www.npmjs.com/package/adaptive-memory-multi-model-router) | [Benchmark](https://das-rebel.github.io/a3m-router/benchmark)
235
+
236
+ *This demo simulates parallel LLM execution. In production, A3M makes real API calls to 47+ providers.*
237
+ """)
95
238
 
96
239
  if __name__ == "__main__":
97
240
  demo.launch()
@@ -0,0 +1 @@
1
+ gradio>=4.0.0
package/index.html CHANGED
@@ -643,7 +643,7 @@
643
643
  <section class="cta-section">
644
644
  <div class="cta-card">
645
645
  <h2 class="cta-title">Ready to use in your project?</h2>
646
- <p class="cta-desc">Open-source LLM gateway with 100% routing accuracy, 47+ providers, and zero ML required.</p>
646
+ <p class="cta-desc">Open-source LLM gateway with 76.43 RouterArena score, 47+ providers, and zero ML required.</p>
647
647
  <div class="cta-code" onclick="navigator.clipboard.writeText('npm install adaptive-memory-multi-model-router'); this.querySelector('.copy-hint').textContent='Copied! โœ“'; setTimeout(()=>this.querySelector('.copy-hint').textContent='Click to copy',2000)">
648
648
  npm install adaptive-memory-multi-model-router
649
649
  <span class="copy-hint">Click to copy</span>
package/llms.txt CHANGED
@@ -20,7 +20,7 @@ Persistent episodic memory (JSON file, auto-save). Router learns user preference
20
20
 
21
21
  ## Key features
22
22
  - Parallel multi-LLM execution (unique โ€” no competitor does this)
23
- - RouterArena #1 (76.43 score, independently validated)
23
+ - RouterArena #1 (76.43 score, evaluated on the RouterArena benchmark (arXiv:2510.00202))
24
24
  - Cheapest: $0.047/1K queries (4x cheaper than #2)
25
25
  - Memory: episodic memory with auto-save
26
26
  - 47+ providers: OpenAI, Anthropic, Groq, DeepSeek, NVIDIA, Together, OpenRouter, Gemini, Mistral, Cohere, etc.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adaptive-memory-multi-model-router",
3
- "version": "2.14.0",
3
+ "version": "2.14.1",
4
4
  "shortName": "A3M Router",
5
5
  "displayName": "A3M Router - Adaptive Memory Multi-Model Router",
6
6
  "description": "๐Ÿ† #1 LLM routing benchmark & Cheapest LLM router with memory ยท Open-source AI gateway with parallel multi-LLM execution across 47+ providers, ensemble voting, semantic cache, and budget enforcement",
package/proxy/README.md CHANGED
@@ -222,6 +222,6 @@ Returns provider availability, uptime, and proxy version.
222
222
 
223
223
  - **47+ providers** โ€” one proxy, any LLM
224
224
  - **62% cost savings** โ€” auto-routes to cheapest adequate model
225
- - **138ms baseline, +96ms proxy overhead** โ€” independently benchmarked
226
- - **99.5% routing accuracy** โ€” validated on golden test set
225
+ - **138ms baseline, +96ms proxy overhead** โ€” benchmarked with llm-gateway-bench
226
+ - **76.43 routing accuracy** โ€” validated on golden test set
227
227
  - **Zero ML deps** โ€” 19.5 KB, pure JS