adaptive-memory-multi-model-router 2.12.0 → 2.12.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.
- package/.github/workflows/pages.yml +37 -0
- package/Awesome-LLM/LICENSE.md +121 -0
- package/Awesome-LLM/README.md +625 -0
- package/Awesome-LLM/contributing.md +24 -0
- package/Awesome-LLM/paper_list/RLHF.md +1 -0
- package/Awesome-LLM/paper_list/Retrieval_Augmented_Generation.md +6 -0
- package/Awesome-LLM/paper_list/acceleration.md +10 -0
- package/Awesome-LLM/paper_list/alignment.md +20 -0
- package/Awesome-LLM/paper_list/application.md +19 -0
- package/Awesome-LLM/paper_list/augmentation.md +14 -0
- package/Awesome-LLM/paper_list/chain_of_thougt.md +16 -0
- package/Awesome-LLM/paper_list/code_pretraining.md +0 -0
- package/Awesome-LLM/paper_list/detection.md +11 -0
- package/Awesome-LLM/paper_list/evaluation.md +64 -0
- package/Awesome-LLM/paper_list/in_context_learning.md +4 -0
- package/Awesome-LLM/paper_list/instruction-tuning.md +35 -0
- package/Awesome-LLM/paper_list/moe.md +0 -0
- package/Awesome-LLM/paper_list/prompt_learning.md +15 -0
- package/Awesome-LLM/resources/DeepSpeed_light.svg +27 -0
- package/Awesome-LLM/resources/alpa-logo-cropped.png +0 -0
- package/Awesome-LLM/resources/colossal-ai_logo_vertical.png +0 -0
- package/Awesome-LLM/resources/creepy_llm.jpeg +0 -0
- package/Awesome-LLM/resources/image8.gif +0 -0
- package/Awesome-LLM/resources/jax_logo_250px.png +0 -0
- package/Awesome-LLM/resources/logo.png +0 -0
- package/Awesome-LLM/resources/nvidia.png +0 -0
- package/Awesome-LLM/resources/tensorflow.png +0 -0
- package/Awesome-LLM/resources//345/244/247/345/236/213/350/257/255/350/250/200/346/250/241/345/236/213/347/232/204/350/203/275/345/212/233/345/210/206/346/236/220/344/270/216/345/272/224/347/224/250 - 30min.pdf +0 -0
- package/README.md +3 -3
- package/SUBMISSIONS.md +43 -0
- package/assets/chart-cost-v2.svg +91 -0
- package/assets/chart-cost-v3.svg +143 -0
- package/assets/chart-features-v2.svg +132 -0
- package/assets/chart-features-v3.svg +211 -0
- package/assets/chart-growth-v2.svg +122 -0
- package/assets/chart-growth-v3.svg +189 -0
- package/assets/cost-simple.svg +64 -0
- package/assets/growth-simple.svg +69 -0
- package/assets/hero-diagram.svg +81 -0
- package/assets/logo-new.svg +21 -0
- package/assets/social-preview-new.svg +100 -0
- package/assets/social-v2.svg +130 -0
- package/assets/social-v3.svg +212 -0
- package/awesome-ai-gateways/CONTRIBUTING.md +49 -0
- package/awesome-ai-gateways/LICENSE +3 -0
- package/awesome-ai-gateways/README.md +190 -0
- package/awesome-selfhosted/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/awesome-selfhosted/.github/PULL_REQUEST_TEMPLATE.md +1 -0
- package/awesome-selfhosted/LICENSE +376 -0
- package/awesome-selfhosted/README.md +2303 -0
- package/awesome-selfhosted/_static/awesome.png +0 -0
- package/awesome-selfhosted/non-free.md +377 -0
- package/demo-new.tape +71 -0
- package/demo-real.sh +198 -0
- package/demo-simple.tape +205 -0
- package/demo.html +520 -0
- package/demo.tape +259 -0
- package/dist/cli/tui.js +152 -0
- package/docs/demo-auto.html +264 -0
- package/docs/demo.html +416 -0
- package/docs/index.html +112 -599
- package/index.html +667 -0
- package/package.json +21 -168
- package/docs/assets/cost-comparison.svg +0 -134
- package/docs/assets/growth-chart-animated.svg +0 -76
- package/docs/assets/og-banner.svg +0 -194
- package/docs/assets/social-preview.svg +0 -194
package/demo.tape
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# A3M Router VHS Demo - 90 Second Terminal Demo
|
|
2
|
+
# Target: 60-90 seconds
|
|
3
|
+
# Output: a3m-demo.gif
|
|
4
|
+
|
|
5
|
+
# =============================================================================
|
|
6
|
+
# SETUP
|
|
7
|
+
# =============================================================================
|
|
8
|
+
|
|
9
|
+
Output demo.gif
|
|
10
|
+
Set FontSize 16
|
|
11
|
+
Set Width 1200
|
|
12
|
+
Set Height 675
|
|
13
|
+
Set TypingSpeed 30ms
|
|
14
|
+
Set Shell bash
|
|
15
|
+
Set FontFamily "JetBrains Mono"
|
|
16
|
+
|
|
17
|
+
# Theme - dark terminal
|
|
18
|
+
Set ThemeFlavor catppuccin-mocha
|
|
19
|
+
|
|
20
|
+
# =============================================================================
|
|
21
|
+
# SCENE 1: THE PROBLEM (0-15s)
|
|
22
|
+
# =============================================================================
|
|
23
|
+
|
|
24
|
+
Type "#!/bin/bash"
|
|
25
|
+
Enter
|
|
26
|
+
|
|
27
|
+
Sleep 500ms
|
|
28
|
+
|
|
29
|
+
Type "# Your LLM app today — costs $0.015 per request, no fallback"
|
|
30
|
+
Enter
|
|
31
|
+
|
|
32
|
+
Type "cat << 'EOF'"
|
|
33
|
+
Enter
|
|
34
|
+
Sleep 100ms
|
|
35
|
+
Type "// Without A3M: you manage everything manually"
|
|
36
|
+
Enter
|
|
37
|
+
Type "const response = await openai.chat.completions.create({"
|
|
38
|
+
Enter
|
|
39
|
+
Type " model: \"gpt-4o\", // Always expensive"
|
|
40
|
+
Enter
|
|
41
|
+
Type " messages: [{ role: \"user\", content: \"Explain quantum entanglement\" }]"
|
|
42
|
+
Enter
|
|
43
|
+
Type "});"
|
|
44
|
+
Enter
|
|
45
|
+
Type "// If OpenAI goes down → your app crashes"
|
|
46
|
+
Enter
|
|
47
|
+
Type "// You pay $0.015 per request forever"
|
|
48
|
+
Enter
|
|
49
|
+
Type "EOF"
|
|
50
|
+
Enter
|
|
51
|
+
|
|
52
|
+
Sleep 1s
|
|
53
|
+
|
|
54
|
+
# Red X marks
|
|
55
|
+
Type "echo \"❌ Problem: $0.015/req, no fallback, manual management\""
|
|
56
|
+
Enter
|
|
57
|
+
|
|
58
|
+
Sleep 2s
|
|
59
|
+
|
|
60
|
+
# =============================================================================
|
|
61
|
+
# SCENE 2: WITH A3M - ONE LINE CHANGE (15-35s)
|
|
62
|
+
# =============================================================================
|
|
63
|
+
|
|
64
|
+
Ctrl+L
|
|
65
|
+
Sleep 500ms
|
|
66
|
+
|
|
67
|
+
Type "# With A3M: one line change, infinite benefits"
|
|
68
|
+
Enter
|
|
69
|
+
|
|
70
|
+
Type "cat << 'EOF'"
|
|
71
|
+
Enter
|
|
72
|
+
Sleep 100ms
|
|
73
|
+
Type "// Same request with A3M router"
|
|
74
|
+
Enter
|
|
75
|
+
Type "const response = await fetch(\"http://localhost:8787/v1/chat/completions\", {"
|
|
76
|
+
Enter
|
|
77
|
+
Type " method: \"POST\","
|
|
78
|
+
Enter
|
|
79
|
+
Type " headers: { \"Content-Type\": \"application/json\" },"
|
|
80
|
+
Enter
|
|
81
|
+
Type " body: JSON.stringify({"
|
|
82
|
+
Enter
|
|
83
|
+
Type " model: \"auto\", // ← A3M picks the best model"
|
|
84
|
+
Enter
|
|
85
|
+
Type " messages: [{ role: \"user\", content: \"Explain quantum entanglement\" }]"
|
|
86
|
+
Enter
|
|
87
|
+
Type " })"
|
|
88
|
+
Enter
|
|
89
|
+
Type "});"
|
|
90
|
+
Enter
|
|
91
|
+
Type "EOF"
|
|
92
|
+
Enter
|
|
93
|
+
|
|
94
|
+
Sleep 1s
|
|
95
|
+
|
|
96
|
+
# Show routing decision
|
|
97
|
+
Enter
|
|
98
|
+
Type "# A3M analyzes and decides:"
|
|
99
|
+
Enter
|
|
100
|
+
Sleep 200ms
|
|
101
|
+
Type "echo \"📊 Task: explanation → Complexity: simple → Budget: minimize\""
|
|
102
|
+
Enter
|
|
103
|
+
Sleep 500ms
|
|
104
|
+
Type "echo \"\""
|
|
105
|
+
Enter
|
|
106
|
+
Sleep 200ms
|
|
107
|
+
Type "echo \"✅ Routed to: Groq (FREE, 847ms)\""
|
|
108
|
+
Enter
|
|
109
|
+
Sleep 500ms
|
|
110
|
+
Type "echo \" Cost: $0.00 | Quality: 94%\""
|
|
111
|
+
Enter
|
|
112
|
+
|
|
113
|
+
Sleep 2s
|
|
114
|
+
|
|
115
|
+
# =============================================================================
|
|
116
|
+
# SCENE 3: FAILURE RECOVERY (35-55s)
|
|
117
|
+
# =============================================================================
|
|
118
|
+
|
|
119
|
+
Ctrl+L
|
|
120
|
+
Sleep 500ms
|
|
121
|
+
|
|
122
|
+
Type "# But what happens when a provider fails?"
|
|
123
|
+
Enter
|
|
124
|
+
Sleep 1s
|
|
125
|
+
|
|
126
|
+
Type "# A3M gracefully handles failures..."
|
|
127
|
+
Enter
|
|
128
|
+
|
|
129
|
+
Sleep 1s
|
|
130
|
+
|
|
131
|
+
# Simulate the failure scenario
|
|
132
|
+
Type "echo \"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\""
|
|
133
|
+
Enter
|
|
134
|
+
Sleep 300ms
|
|
135
|
+
Type "echo \" [Groq] — Attempting connection...\""
|
|
136
|
+
Enter
|
|
137
|
+
Sleep 1s
|
|
138
|
+
Type "echo \" [Groq] — ✗ FAILED — 503 Service Unavailable\""
|
|
139
|
+
Enter
|
|
140
|
+
Sleep 500ms
|
|
141
|
+
Type "echo \" [Circuit Breaker] — Tripped after 3 failures\""
|
|
142
|
+
Enter
|
|
143
|
+
Sleep 500ms
|
|
144
|
+
Type "echo \" [DeepSeek] — HEALTHY — Switching...\""
|
|
145
|
+
Enter
|
|
146
|
+
Sleep 1s
|
|
147
|
+
Type "echo \"\""
|
|
148
|
+
Enter
|
|
149
|
+
Sleep 300ms
|
|
150
|
+
Type "echo \"✅ Response delivered via DeepSeek fallback\""
|
|
151
|
+
Enter
|
|
152
|
+
Sleep 500ms
|
|
153
|
+
Type "echo \" Your app: never knew there was a problem\""
|
|
154
|
+
Enter
|
|
155
|
+
Sleep 500ms
|
|
156
|
+
Type "echo \"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\""
|
|
157
|
+
Enter
|
|
158
|
+
|
|
159
|
+
Sleep 2s
|
|
160
|
+
|
|
161
|
+
# =============================================================================
|
|
162
|
+
# SCENE 4: COST SAVINGS (55-70s)
|
|
163
|
+
# =============================================================================
|
|
164
|
+
|
|
165
|
+
Ctrl+L
|
|
166
|
+
Sleep 500ms
|
|
167
|
+
|
|
168
|
+
Type "# Same query. Dramatically different costs."
|
|
169
|
+
Enter
|
|
170
|
+
Sleep 500ms
|
|
171
|
+
|
|
172
|
+
Type "echo \"\""
|
|
173
|
+
Enter
|
|
174
|
+
Sleep 200ms
|
|
175
|
+
Type "echo \" WITHOUT A3M WITH A3M\""
|
|
176
|
+
Enter
|
|
177
|
+
Sleep 200ms
|
|
178
|
+
Type "echo \" ───────────────── ────────────────\""
|
|
179
|
+
Enter
|
|
180
|
+
Sleep 200ms
|
|
181
|
+
Type "echo \" GPT-4o @ $3.00/1K Groq @ $0.00/1K\""
|
|
182
|
+
Enter
|
|
183
|
+
Sleep 200ms
|
|
184
|
+
Type "echo \" 500 tokens = $0.0015 500 tokens = $0.00\""
|
|
185
|
+
Enter
|
|
186
|
+
Sleep 1s
|
|
187
|
+
Type "echo \"\""
|
|
188
|
+
Enter
|
|
189
|
+
Sleep 200ms
|
|
190
|
+
Type "echo \"💰 SAVINGS: 100% per query\""
|
|
191
|
+
Enter
|
|
192
|
+
Sleep 300ms
|
|
193
|
+
Type "echo \" At 1000 queries/day → $1.50 saved daily\""
|
|
194
|
+
Enter
|
|
195
|
+
Sleep 300ms
|
|
196
|
+
Type "echo \" At 1000 queries/day → $547 saved yearly\""
|
|
197
|
+
Enter
|
|
198
|
+
|
|
199
|
+
Sleep 2s
|
|
200
|
+
|
|
201
|
+
# =============================================================================
|
|
202
|
+
# SCENE 5: ONE COMMAND (70-90s)
|
|
203
|
+
# =============================================================================
|
|
204
|
+
|
|
205
|
+
Ctrl+L
|
|
206
|
+
Sleep 500ms
|
|
207
|
+
|
|
208
|
+
Type "echo \"\""
|
|
209
|
+
Enter
|
|
210
|
+
Sleep 200ms
|
|
211
|
+
Type "echo \"╔═══════════════════════════════════════════════════╗\""
|
|
212
|
+
Enter
|
|
213
|
+
Sleep 100ms
|
|
214
|
+
Type "echo \"║ Get started in 10 seconds: ║\""
|
|
215
|
+
Enter
|
|
216
|
+
Sleep 100ms
|
|
217
|
+
Type "echo \"╚═══════════════════════════════════════════════════╝\""
|
|
218
|
+
Enter
|
|
219
|
+
Sleep 500ms
|
|
220
|
+
Type "echo \"\""
|
|
221
|
+
Enter
|
|
222
|
+
Sleep 200ms
|
|
223
|
+
Type "echo \" npm install -g adaptive-memory-multi-model-router\""
|
|
224
|
+
Enter
|
|
225
|
+
Sleep 300ms
|
|
226
|
+
Type "echo \"\""
|
|
227
|
+
Enter
|
|
228
|
+
Sleep 200ms
|
|
229
|
+
Type "echo \" # Auto-detects your API keys, zero config\""
|
|
230
|
+
Enter
|
|
231
|
+
Sleep 300ms
|
|
232
|
+
Type "echo \" npx a3m-router serve\""
|
|
233
|
+
Enter
|
|
234
|
+
Sleep 500ms
|
|
235
|
+
Type "echo \"\""
|
|
236
|
+
Enter
|
|
237
|
+
Sleep 200ms
|
|
238
|
+
Type "echo \" # Change: model: 'gpt-4o' → model: 'auto'\""
|
|
239
|
+
Enter
|
|
240
|
+
Sleep 500ms
|
|
241
|
+
Type "echo \"\""
|
|
242
|
+
Enter
|
|
243
|
+
Sleep 300ms
|
|
244
|
+
Type "echo \" GitHub: github.com/Das-rebel/adaptive-memory-multi-model-router\""
|
|
245
|
+
Enter
|
|
246
|
+
Sleep 200ms
|
|
247
|
+
Type "echo \" npm: npmjs.com/package/adaptive-memory-multi-model-router\""
|
|
248
|
+
Enter
|
|
249
|
+
|
|
250
|
+
Sleep 2s
|
|
251
|
+
|
|
252
|
+
# Final pulse effect
|
|
253
|
+
Type "echo \"\""
|
|
254
|
+
Enter
|
|
255
|
+
Sleep 200ms
|
|
256
|
+
Type "echo \"✨ One prompt in. The right model out. ✨\""
|
|
257
|
+
Enter
|
|
258
|
+
|
|
259
|
+
Sleep 1s
|
package/dist/cli/tui.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* A3M Router Quick TUI
|
|
4
|
+
* Zero-config experience - no API key needed for free tier
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
|
|
9
|
+
if (args.length === 0) {
|
|
10
|
+
console.log(`
|
|
11
|
+
╔══════════════════════════════════════════════╗
|
|
12
|
+
║ 🔀 A3M Router - Zero Config ║
|
|
13
|
+
╠══════════════════════════════════════════════╣
|
|
14
|
+
║ ║
|
|
15
|
+
║ One prompt in. The right model out. ║
|
|
16
|
+
║ ║
|
|
17
|
+
║ Usage: ║
|
|
18
|
+
║ a3m hello world # Route a query ║
|
|
19
|
+
║ a3m --serve # Start proxy ║
|
|
20
|
+
║ a3m --setup # Configure API keys ║
|
|
21
|
+
║ a3m --demo # Try without keys ║
|
|
22
|
+
║ ║
|
|
23
|
+
╚══════════════════════════════════════════════╝
|
|
24
|
+
`);
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const command = args[0];
|
|
29
|
+
|
|
30
|
+
// Demo mode - works without API key
|
|
31
|
+
if (command === '--demo') {
|
|
32
|
+
console.log(`
|
|
33
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
34
|
+
🎮 A3M Router Demo Mode
|
|
35
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
36
|
+
|
|
37
|
+
Try these queries:
|
|
38
|
+
• "Write Python hello world"
|
|
39
|
+
• "Explain quantum physics"
|
|
40
|
+
• "Translate to Japanese: Hello"
|
|
41
|
+
• "Write a haiku about coding"
|
|
42
|
+
`);
|
|
43
|
+
|
|
44
|
+
const readline = require('readline');
|
|
45
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
46
|
+
|
|
47
|
+
const demoResults = [
|
|
48
|
+
{ provider: 'groq', model: 'llama-3.3-70b-versatile', tier: 'free', cost: '$0.00' },
|
|
49
|
+
{ provider: 'deepseek', model: 'deepseek-chat-v3', tier: 'cheap', cost: '$0.00' },
|
|
50
|
+
{ provider: 'kimi', model: 'moonshot-v1-8k', tier: 'cheap', cost: '$0.00' },
|
|
51
|
+
{ provider: 'openai', model: 'gpt-4o-mini', tier: 'paid', cost: '$0.00' },
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
let count = 0;
|
|
55
|
+
function ask() {
|
|
56
|
+
rl.question('\n🔀 Query: ', (q) => {
|
|
57
|
+
if (!q || q.toLowerCase() === 'exit') {
|
|
58
|
+
console.log('\n👋 Ready for the real thing? Run: npm install adaptive-memory-multi-model-router\n');
|
|
59
|
+
rl.close();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const r = demoResults[count++ % demoResults.length];
|
|
63
|
+
console.log(`\n 🏆 Best: ${r.provider} / ${r.model}`);
|
|
64
|
+
console.log(` 💰 Cost: ${r.cost} (${r.tier})`);
|
|
65
|
+
ask();
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
ask();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Serve mode
|
|
73
|
+
if (command === '--serve') {
|
|
74
|
+
console.log(`
|
|
75
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
76
|
+
🚀 A3M Router Proxy Server
|
|
77
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
78
|
+
|
|
79
|
+
Server: http://localhost:8787/v1/chat/completions
|
|
80
|
+
API: OpenAI-compatible
|
|
81
|
+
|
|
82
|
+
No API keys configured? Add free tier:
|
|
83
|
+
GROQ_API_KEY=your_key npx a3m-router serve
|
|
84
|
+
|
|
85
|
+
Or run setup: a3m --setup
|
|
86
|
+
`);
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
const server = require('./server/proxyServer.js');
|
|
90
|
+
const port = parseInt(args[1]) || 8787;
|
|
91
|
+
server.createProxyServer({ port });
|
|
92
|
+
console.log(`\n✅ Server running at http://localhost:${port}`);
|
|
93
|
+
} catch (e) {
|
|
94
|
+
console.log('\n⚠️ Run "npm install" first, then "npm run build"\n');
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Setup mode
|
|
100
|
+
if (command === '--setup') {
|
|
101
|
+
const wizard = require('./cli/setupWizard.js');
|
|
102
|
+
wizard.runWizard();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Zero-config mode - route with free tier defaults
|
|
107
|
+
const query = args.join(' ');
|
|
108
|
+
|
|
109
|
+
// Check for GROQ_API_KEY first (free tier)
|
|
110
|
+
if (process.env.GROQ_API_KEY) {
|
|
111
|
+
console.log('\n🔀 Routing: "' + query + '"');
|
|
112
|
+
console.log('📡 Using free tier (Groq)...\n');
|
|
113
|
+
|
|
114
|
+
// Quick route via groq
|
|
115
|
+
const { routeQuery } = require('./index.js');
|
|
116
|
+
routeQuery(query).then(r => {
|
|
117
|
+
console.log(` 🏆 Provider: ${r.provider || 'groq'}`);
|
|
118
|
+
console.log(` 🤖 Model: ${r.model || 'llama-3.3-70b-versatile'}`);
|
|
119
|
+
console.log(` 💰 Est: $${(r.estimated_cost || 0.0001).toFixed(6)}`);
|
|
120
|
+
}).catch(e => {
|
|
121
|
+
console.log(' ⚠️ Error:', e.message);
|
|
122
|
+
console.log(' Tip: Get free key at https://console.groq.com\n');
|
|
123
|
+
});
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// No API key - show helpful message
|
|
128
|
+
console.log(`
|
|
129
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
130
|
+
⚠️ No API key detected
|
|
131
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
132
|
+
|
|
133
|
+
A3M Router needs at least one API key to route queries.
|
|
134
|
+
|
|
135
|
+
🔥 FREE TIER OPTIONS:
|
|
136
|
+
1. Groq (fastest, 1000+ req/day free)
|
|
137
|
+
→ https://console.groq.com/apikeys
|
|
138
|
+
→ Set: export GROQ_API_KEY=your_key
|
|
139
|
+
|
|
140
|
+
2. Cerebras (fastest inference, free)
|
|
141
|
+
→ https://cerebras.ai/labs
|
|
142
|
+
→ Set: export CEREBRAS_API_KEY=your_key
|
|
143
|
+
|
|
144
|
+
3. Google AI (Gemini, free tier)
|
|
145
|
+
→ https://aistudio.google.com/app/apikey
|
|
146
|
+
→ Set: export GOOGLE_API_KEY=your_key
|
|
147
|
+
|
|
148
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
149
|
+
|
|
150
|
+
Quick setup: npx a3m --setup
|
|
151
|
+
Quick start: GROQ_API_KEY=your_key npx a3m-router serve
|
|
152
|
+
`);
|
|
@@ -0,0 +1,264 @@
|
|
|
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 - Auto-Playing Demo</title>
|
|
7
|
+
<style>
|
|
8
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
9
|
+
|
|
10
|
+
body {
|
|
11
|
+
background: #0d1117;
|
|
12
|
+
color: #e6edf3;
|
|
13
|
+
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, monospace;
|
|
14
|
+
min-height: 100vh;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
padding: 20px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.container { max-width: 900px; width: 100%; }
|
|
23
|
+
|
|
24
|
+
h1 { color: #58a6ff; margin-bottom: 8px; font-size: 1.8rem; }
|
|
25
|
+
.tagline { color: #8b949e; margin-bottom: 24px; }
|
|
26
|
+
|
|
27
|
+
.scene {
|
|
28
|
+
background: #161b22;
|
|
29
|
+
border: 1px solid #30363d;
|
|
30
|
+
border-radius: 12px;
|
|
31
|
+
padding: 24px;
|
|
32
|
+
margin: 16px 0;
|
|
33
|
+
animation: fadeIn 0.5s ease;
|
|
34
|
+
display: none;
|
|
35
|
+
}
|
|
36
|
+
.scene.active { display: block; }
|
|
37
|
+
|
|
38
|
+
@keyframes fadeIn {
|
|
39
|
+
from { opacity: 0; transform: translateY(20px); }
|
|
40
|
+
to { opacity: 1; transform: translateY(0); }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.line { margin: 6px 0; line-height: 1.5; }
|
|
44
|
+
.comment { color: #8b949e; }
|
|
45
|
+
.keyword { color: #ff7b72; }
|
|
46
|
+
.string { color: #a5d6ff; }
|
|
47
|
+
|
|
48
|
+
.error-text { color: #f85149; }
|
|
49
|
+
.success-text { color: #3fb950; }
|
|
50
|
+
.info-text { color: #58a6ff; }
|
|
51
|
+
.muted { color: #8b949e; }
|
|
52
|
+
.money { color: #3fb950; font-size: 1.3rem; font-weight: bold; }
|
|
53
|
+
|
|
54
|
+
.box {
|
|
55
|
+
background: #21262d;
|
|
56
|
+
border: 1px solid #30363d;
|
|
57
|
+
border-radius: 8px;
|
|
58
|
+
padding: 16px;
|
|
59
|
+
margin: 12px 0;
|
|
60
|
+
}
|
|
61
|
+
.box.error { border-color: #f85149; }
|
|
62
|
+
.box.success { border-color: #3fb950; }
|
|
63
|
+
|
|
64
|
+
.ascii {
|
|
65
|
+
background: #0d1117;
|
|
66
|
+
padding: 12px;
|
|
67
|
+
border-radius: 6px;
|
|
68
|
+
font-size: 0.85rem;
|
|
69
|
+
white-space: pre;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.cost-row { display: flex; gap: 16px; margin: 12px 0; }
|
|
73
|
+
.cost-card {
|
|
74
|
+
flex: 1;
|
|
75
|
+
background: #21262d;
|
|
76
|
+
border-radius: 8px;
|
|
77
|
+
padding: 16px;
|
|
78
|
+
text-align: center;
|
|
79
|
+
}
|
|
80
|
+
.cost-card.bad { border: 1px solid #f85149; }
|
|
81
|
+
.cost-card.good { border: 1px solid #3fb950; }
|
|
82
|
+
.cost-card .amount { font-size: 2rem; font-weight: bold; }
|
|
83
|
+
.cost-card.bad .amount { color: #f85149; }
|
|
84
|
+
.cost-card.good .amount { color: #3fb950; }
|
|
85
|
+
|
|
86
|
+
.install-box {
|
|
87
|
+
background: #161b22;
|
|
88
|
+
border: 2px solid #58a6ff;
|
|
89
|
+
border-radius: 12px;
|
|
90
|
+
padding: 24px;
|
|
91
|
+
text-align: center;
|
|
92
|
+
}
|
|
93
|
+
.install-cmd {
|
|
94
|
+
background: #0d1117;
|
|
95
|
+
padding: 12px 24px;
|
|
96
|
+
border-radius: 6px;
|
|
97
|
+
font-size: 1rem;
|
|
98
|
+
color: #3fb950;
|
|
99
|
+
margin: 12px 0;
|
|
100
|
+
font-family: monospace;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.footer {
|
|
104
|
+
margin-top: 24px;
|
|
105
|
+
color: #8b949e;
|
|
106
|
+
text-align: center;
|
|
107
|
+
font-size: 0.85rem;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.progress {
|
|
111
|
+
display: flex;
|
|
112
|
+
gap: 8px;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
margin: 20px 0;
|
|
115
|
+
}
|
|
116
|
+
.dot {
|
|
117
|
+
width: 10px; height: 10px;
|
|
118
|
+
background: #30363d;
|
|
119
|
+
border-radius: 50%;
|
|
120
|
+
}
|
|
121
|
+
.dot.done { background: #58a6ff; }
|
|
122
|
+
</style>
|
|
123
|
+
</head>
|
|
124
|
+
<body>
|
|
125
|
+
<div class="container">
|
|
126
|
+
<h1>🔀 A3M Router</h1>
|
|
127
|
+
<p class="tagline">One prompt in. The right model out.</p>
|
|
128
|
+
|
|
129
|
+
<!-- Scene 1 -->
|
|
130
|
+
<div class="scene active" id="s1">
|
|
131
|
+
<h2 style="color: #f85149;">❌ Without A3M</h2>
|
|
132
|
+
<div class="box error">
|
|
133
|
+
<div class="line comment">#!/bin/bash</div>
|
|
134
|
+
<div class="line comment"># Your LLM app today</div>
|
|
135
|
+
<div class="line"></div>
|
|
136
|
+
<div class="line"><span class="keyword">const</span> response = <span class="keyword">await</span> openai.chat.completions.create({</div>
|
|
137
|
+
<div class="line"> model: <span class="string">"gpt-4o"</span>, <span class="comment">// Always expensive</span></div>
|
|
138
|
+
<div class="line"> messages: [{ role: <span class="string">"user"</span>, content: <span class="string">"Explain quantum entanglement"</span> }]</div>
|
|
139
|
+
<div class="line">});</div>
|
|
140
|
+
</div>
|
|
141
|
+
<div class="box error">
|
|
142
|
+
<div class="line error-text">❌ Problem: $0.015 per request</div>
|
|
143
|
+
<div class="line error-text">❌ No fallback if OpenAI goes down</div>
|
|
144
|
+
<div class="line error-text">❌ Manual model selection forever</div>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
<!-- Scene 2 -->
|
|
149
|
+
<div class="scene" id="s2">
|
|
150
|
+
<h2 style="color: #3fb950;">✅ With A3M - One Line Change</h2>
|
|
151
|
+
<div class="box">
|
|
152
|
+
<div class="line comment"># With A3M: one line change</div>
|
|
153
|
+
<div class="line"><span class="keyword">const</span> response = <span class="keyword">await</span> fetch(<span class="string">"http://localhost:8787/v1/chat/completions"</span>, {</div>
|
|
154
|
+
<div class="line"> method: <span class="string">"POST"</span>,</div>
|
|
155
|
+
<div class="line"> body: JSON.stringify({</div>
|
|
156
|
+
<div class="line"> model: <span class="string">"auto"</span>, <span class="comment">// ← A3M picks the best</span></div>
|
|
157
|
+
<div class="line"> messages: [{ role: <span class="string">"user"</span>, content: <span class="string">"Explain quantum entanglement"</span> }]</div>
|
|
158
|
+
<div class="line"> })</div>
|
|
159
|
+
<div class="line">});</div>
|
|
160
|
+
</div>
|
|
161
|
+
<div class="box success">
|
|
162
|
+
<div class="line info-text">📊 Task: explanation → Complexity: simple → Budget: minimize</div>
|
|
163
|
+
<div class="line success-text">✅ Routed to: Groq (FREE, 847ms)</div>
|
|
164
|
+
<div class="line muted"> Cost: $0.00 | Quality: 94%</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<!-- Scene 3 -->
|
|
169
|
+
<div class="scene" id="s3">
|
|
170
|
+
<h2 style="color: #d29922;">🔄 Graceful Failover</h2>
|
|
171
|
+
<div class="line comment"># A3M gracefully handles provider failures...</div>
|
|
172
|
+
<div class="ascii">
|
|
173
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
174
|
+
[Groq] — Attempting connection...
|
|
175
|
+
[Groq] — ✗ FAILED — 503 Service Unavailable
|
|
176
|
+
[Circuit Breaker] — Tripped after 3 failures
|
|
177
|
+
[DeepSeek] — HEALTHY — Switching...
|
|
178
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
179
|
+
</div>
|
|
180
|
+
<div class="box success">
|
|
181
|
+
<div class="line success-text">✅ Response delivered via DeepSeek fallback</div>
|
|
182
|
+
<div class="line muted"> Your app: never knew there was a problem</div>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<!-- Scene 4 -->
|
|
187
|
+
<div class="scene" id="s4">
|
|
188
|
+
<h2 style="color: #3fb950;">💰 Cost Comparison</h2>
|
|
189
|
+
<div class="line comment"># Same query. Dramatically different costs.</div>
|
|
190
|
+
<div class="cost-row">
|
|
191
|
+
<div class="cost-card bad">
|
|
192
|
+
<div class="muted">WITHOUT A3M</div>
|
|
193
|
+
<div class="amount">$0.0015</div>
|
|
194
|
+
<div class="muted">GPT-4o @ $3.00/1K</div>
|
|
195
|
+
</div>
|
|
196
|
+
<div class="cost-card good">
|
|
197
|
+
<div class="muted">WITH A3M</div>
|
|
198
|
+
<div class="amount">$0.00</div>
|
|
199
|
+
<div class="muted">Groq @ $0.00/1K</div>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
<div class="box success">
|
|
203
|
+
<div class="line success-text">💰 SAVINGS: 100% per query</div>
|
|
204
|
+
<div class="line"> At 1000 queries/day → <strong>$1.50 saved daily</strong></div>
|
|
205
|
+
<div class="line"> At 1000 queries/day → <strong>$547 saved yearly</strong></div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<!-- Scene 5 -->
|
|
210
|
+
<div class="scene" id="s5">
|
|
211
|
+
<div class="install-box">
|
|
212
|
+
<div style="color: #58a6ff; font-size: 1.1rem;">Get started in 10 seconds:</div>
|
|
213
|
+
<div class="install-cmd">npm install -g adaptive-memory-multi-model-router</div>
|
|
214
|
+
<div class="muted"># Auto-detects your API keys, zero config</div>
|
|
215
|
+
<div class="install-cmd" style="color: #58a6ff;">npx a3m-router serve</div>
|
|
216
|
+
<div class="muted"># Change: model: 'gpt-4o' → model: 'auto'</div>
|
|
217
|
+
</div>
|
|
218
|
+
<div style="text-align: center; margin-top: 24px;">
|
|
219
|
+
<div class="muted">🔗 github.com/Das-rebel/adaptive-memory-multi-model-router</div>
|
|
220
|
+
<div class="muted">📦 npmjs.com/package/adaptive-memory-multi-model-router</div>
|
|
221
|
+
</div>
|
|
222
|
+
<div style="text-align: center; margin-top: 24px; color: #a371f7; font-size: 1.2rem;">
|
|
223
|
+
✨ One prompt in. The right model out. ✨
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
|
|
227
|
+
<div class="progress">
|
|
228
|
+
<div class="dot done" id="d1"></div>
|
|
229
|
+
<div class="dot" id="d2"></div>
|
|
230
|
+
<div class="dot" id="d3"></div>
|
|
231
|
+
<div class="dot" id="d4"></div>
|
|
232
|
+
<div class="dot" id="d5"></div>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<div class="footer">
|
|
236
|
+
Open Source LLM Router • 47+ Providers • Budget Enforcement • Semantic Cache
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
<script>
|
|
241
|
+
// Auto-playing demo - no button needed
|
|
242
|
+
const scenes = 5;
|
|
243
|
+
const delay = 8000; // 8 seconds per scene
|
|
244
|
+
|
|
245
|
+
function showScene(n) {
|
|
246
|
+
document.querySelectorAll('.scene').forEach(s => s.classList.remove('active'));
|
|
247
|
+
document.querySelectorAll('.dot').forEach(d => d.classList.remove('done'));
|
|
248
|
+
|
|
249
|
+
document.getElementById('s' + n).classList.add('active');
|
|
250
|
+
for (let i = 1; i <= n; i++) {
|
|
251
|
+
document.getElementById('d' + i).classList.add('done');
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
let current = 1;
|
|
256
|
+
showScene(current);
|
|
257
|
+
|
|
258
|
+
setInterval(() => {
|
|
259
|
+
current = current % scenes + 1;
|
|
260
|
+
showScene(current);
|
|
261
|
+
}, delay);
|
|
262
|
+
</script>
|
|
263
|
+
</body>
|
|
264
|
+
</html>
|