adaptive-memory-multi-model-router 2.15.4 → 2.16.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.
- package/AGENT_COUNCIL_FINDINGS.md +123 -98
- package/CAMPAIGN_SUMMARY.md +87 -0
- package/CHANGELOG.md +7 -1
- package/ENTERPRISE_INTEGRATIONS.md +94 -0
- package/INTEGRATION_PROGRESS.md +96 -0
- package/OPPORTUNITIES_100.md +277 -0
- package/POPULARITY_BOOSTERS.md +1 -1
- package/README.md +147 -275
- package/README_ja.md +17 -21
- package/README_zh.md +13 -17
- package/TODO_BROWSER_AUTOMATION.md +87 -0
- package/a3m-integrations-summary.md +73 -0
- package/apps/cost-calculator/README.md +72 -0
- package/apps/cost-calculator/calculator.css +280 -0
- package/apps/cost-calculator/calculator.js +150 -0
- package/apps/cost-calculator/index.html +321 -0
- package/apps/cost-calculator/package.json +13 -0
- package/articles/ANNOUNCEMENT_reddit_ml.md +76 -0
- package/articles/ANNOUNCEMENT_vc/347/244/276/345/214/272.md +71 -0
- package/articles/ANNOUNCEMENT_vercel.md +85 -0
- package/articles/CHINESE_DIRECTORIES.md +2 -2
- package/articles/CHINESE_SUBMISSIONS_READY.md +5 -5
- package/articles/HN_POST_READY.md +16 -20
- package/articles/INDIEHACKERS_READY.md +19 -34
- package/dist/analytics/costAnalytics.d.ts +0 -1
- package/dist/benchmark/reproducible.d.ts +0 -1
- package/dist/cache/semanticCache.d.ts +0 -1
- package/dist/cost/budgetEnforcer.d.ts +0 -1
- package/dist/cost/costTracker.d.ts +0 -1
- package/dist/ensemble/multiRoundDialog.d.ts +0 -1
- package/dist/ensemble/shapleyValue.d.ts +0 -1
- package/dist/ensemble.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/integrations/oauth.d.ts +0 -1
- package/dist/integrations/scienceAdapter.d.ts +0 -1
- package/dist/memory/autoFetch.d.ts +0 -1
- package/dist/memory/hybridMemory.d.ts +0 -1
- package/dist/memory/memoryTree.d.ts +0 -1
- package/dist/memory/obsidianVault.d.ts +0 -1
- package/dist/memory/reasoningBank.d.ts +0 -1
- package/dist/observability/changeWatch.d.ts +0 -1
- package/dist/observability/fatigueDetector.d.ts +0 -1
- package/dist/observability/index.d.ts +0 -1
- package/dist/observability/metrics.d.ts +0 -1
- package/dist/observability/middleware.d.ts +0 -1
- package/dist/observability/tracer.d.ts +0 -1
- package/dist/observability/types.d.ts +0 -1
- package/dist/providers/providerConfig.d.ts +5 -2
- package/dist/providers/providerConfig.js +1006 -1
- package/dist/providers/providerConfig.js.map +1 -1
- package/dist/routing/advancedRouter.d.ts +1 -2
- package/dist/routing/advancedRouter.js +84 -0
- package/dist/routing/advancedRouter.js.map +1 -1
- package/dist/routing/crossModelValidation.d.ts +0 -1
- package/dist/routing/providerHealth.d.ts +77 -2
- package/dist/routing/providerHealth.js +190 -4
- package/dist/routing/providerHealth.js.map +1 -1
- package/dist/routing/providerRetry.d.ts +0 -1
- package/dist/routing/shadowSampler.d.ts +187 -0
- package/dist/routing/shadowSampler.js +306 -0
- package/dist/routing/shadowSampler.js.map +1 -0
- package/dist/sdk.d.ts +0 -1
- package/dist/security/guardrails.d.ts +0 -1
- package/dist/server/dashboard.d.ts +0 -1
- package/dist/server/handlers/chatHandler.d.ts +0 -1
- package/dist/server/handlers/completionsHandler.d.ts +0 -1
- package/dist/server/handlers/embeddingsHandler.d.ts +0 -1
- package/dist/server/handlers/healthHandler.d.ts +0 -1
- package/dist/server/handlers/metricsHandler.d.ts +0 -1
- package/dist/server/handlers/modelsHandler.d.ts +0 -1
- package/dist/server/metrics.d.ts +0 -1
- package/dist/server/modelMapper.d.ts +0 -1
- package/dist/server/proxyServer.d.ts +0 -1
- package/dist/server/router.d.ts +0 -1
- package/dist/server/state.d.ts +0 -1
- package/dist/tui/dashboard.d.ts +0 -1
- package/dist/utils/costUtils.d.ts +0 -1
- package/dist/utils/sorting.d.ts +0 -1
- package/dist/utils/tokenUtils.d.ts +0 -1
- package/docs/llms-full.txt +153 -286
- package/docs/llms.txt +71 -112
- package/integrations/browser-use/README.md +155 -0
- package/integrations/browser-use/examples/form-filling.ts +179 -0
- package/integrations/browser-use/index.ts +145 -0
- package/integrations/browser-use/package.json +34 -0
- package/integrations/browser-use/tsconfig.json +17 -0
- package/integrations/mcp-browser/README.md +177 -0
- package/integrations/mcp-browser/package.json +38 -0
- package/integrations/mcp-browser/src/index.ts +297 -0
- package/integrations/sota-browser/README.md +191 -0
- package/integrations/sota-browser/package.json +34 -0
- package/llms-full.txt +6 -6
- package/llms.txt +62 -112
- package/package.json +92 -13
- package/packages/a3m-vercel-ai/README.md +161 -0
- package/packages/a3m-vercel-ai/dist/a3m-language-model.d.ts +12 -0
- package/packages/a3m-vercel-ai/dist/a3m-language-model.d.ts.map +1 -0
- package/packages/a3m-vercel-ai/dist/a3m-language-model.js +289 -0
- package/packages/a3m-vercel-ai/dist/a3m-language-model.js.map +1 -0
- package/packages/a3m-vercel-ai/dist/index.d.ts +82 -0
- package/packages/a3m-vercel-ai/dist/index.d.ts.map +1 -0
- package/packages/a3m-vercel-ai/dist/index.js +79 -0
- package/packages/a3m-vercel-ai/dist/index.js.map +1 -0
- package/packages/a3m-vercel-ai/dist/types.d.ts +97 -0
- package/packages/a3m-vercel-ai/dist/types.d.ts.map +1 -0
- package/packages/a3m-vercel-ai/dist/types.js +5 -0
- package/packages/a3m-vercel-ai/dist/types.js.map +1 -0
- package/packages/a3m-vercel-ai/package-lock.json +969 -0
- package/packages/a3m-vercel-ai/package.json +46 -0
- package/packages/a3m-vercel-ai/src/a3m-language-model.ts +381 -0
- package/packages/a3m-vercel-ai/src/index.ts +104 -0
- package/packages/a3m-vercel-ai/src/types.ts +116 -0
- package/packages/a3m-vercel-ai/tsconfig.json +20 -0
- package/src/providers/providerConfig.ts +1053 -1
- package/summary.txt +38 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -94
- package/.github/ISSUE_TEMPLATE/config.yml +0 -17
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -71
- package/.well-known/ai-plugin.json +0 -16
- package/adapters/README.md +0 -36
- package/adapters/__init__.py +0 -25
- package/adapters/a3m_adapter/__init__.py +0 -15
- package/adapters/a3m_adapter/adapter/__init__.py +0 -7
- package/adapters/a3m_adapter/adapter/config.py +0 -100
- package/adapters/a3m_adapter/adapter/langchain.py +0 -155
- package/adapters/a3m_adapter/adapter/llamaindex.py +0 -162
- package/adapters/a3m_adapter/tests/__init__.py +0 -1
- package/adapters/a3m_adapter/tests/test_adapters.py +0 -120
- package/adapters/setup.py +0 -23
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# A3M Router + sota-browser (CloakBrowser)
|
|
2
|
+
|
|
3
|
+
**The ultimate combination for reliable, cost-optimized browser automation.**
|
|
4
|
+
|
|
5
|
+
This integration combines:
|
|
6
|
+
- **A3M Router** - Intelligent LLM routing with cost optimization
|
|
7
|
+
- **sota-browser (CloakBrowser)** - 71 C++ stealth patches for maximum anti-detection
|
|
8
|
+
|
|
9
|
+
Together, they provide the most reliable and cost-effective browser automation solution available.
|
|
10
|
+
|
|
11
|
+
## Why A3M + sota-browser?
|
|
12
|
+
|
|
13
|
+
| Feature | A3M alone | sota-browser alone | A3M + sota-browser |
|
|
14
|
+
|---------|------------|-------------------|---------------------|
|
|
15
|
+
| Stealth anti-detection | Basic | ✅ Advanced | ✅ Advanced |
|
|
16
|
+
| Intelligent routing | ✅ | ❌ | ✅ |
|
|
17
|
+
| Cost optimization | ✅ | ❌ | ✅ |
|
|
18
|
+
| CAPCHA solving | ❌ | ✅ | ✅ |
|
|
19
|
+
| Proxy rotation | ❌ | ✅ | ✅ |
|
|
20
|
+
| Cost per task | $0.002 | $0.001 | **$0.002** |
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install adaptive-memory-multi-model-router
|
|
26
|
+
npm install sota-browser
|
|
27
|
+
|
|
28
|
+
# Or use the combined package
|
|
29
|
+
npm install a3m-sota-browser
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { A3MRouter } from 'adaptive-memory-multi-model-router';
|
|
36
|
+
import { BrowserManager } from 'sota-browser';
|
|
37
|
+
|
|
38
|
+
async function automatedTask() {
|
|
39
|
+
// Initialize A3M for routing
|
|
40
|
+
const router = new A3MRouter({
|
|
41
|
+
model: 'auto',
|
|
42
|
+
stealth: true,
|
|
43
|
+
parallelEnsemble: 3,
|
|
44
|
+
browserOptimized: true,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Initialize CloakBrowser
|
|
48
|
+
const browser = new BrowserManager({
|
|
49
|
+
stealth: true, // 71 C++ stealth patches
|
|
50
|
+
proxy: 'auto', // Automatic proxy rotation
|
|
51
|
+
humanize: true, // Human-like mouse movements
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
await browser.launch();
|
|
55
|
+
const page = await browser.newPage();
|
|
56
|
+
|
|
57
|
+
// Navigate to target
|
|
58
|
+
await page.goto('https://example.com/form');
|
|
59
|
+
|
|
60
|
+
// Use A3M to analyze and fill form
|
|
61
|
+
const analysis = await router.route({
|
|
62
|
+
task: 'Analyze this form and extract field structure',
|
|
63
|
+
context: 'form_analysis',
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Fill with optimal model
|
|
67
|
+
await page.fill('input[name="email"]', 'user@example.com');
|
|
68
|
+
|
|
69
|
+
await browser.close();
|
|
70
|
+
console.log(`Cost: $${router.getCost()}`);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Cost Savings
|
|
75
|
+
|
|
76
|
+
**Monthly cost comparison (1000 tasks/day):**
|
|
77
|
+
|
|
78
|
+
| Solution | Monthly Cost | Annual Cost | Detection Rate |
|
|
79
|
+
|----------|--------------|-------------|----------------|
|
|
80
|
+
| GPT-4o + manual | $9,000 | $108,000 | High |
|
|
81
|
+
| sota-browser alone | $500 | $6,000 | Low |
|
|
82
|
+
| **A3M + sota-browser** | **$450** | **$5,400** | **Very Low** |
|
|
83
|
+
|
|
84
|
+
**Why A3M + sota-browser is optimal:**
|
|
85
|
+
- sota-browser handles the stealth (proxy rotation, human-like behavior)
|
|
86
|
+
- A3M handles the intelligence (routing, cost optimization)
|
|
87
|
+
- Together: cheapest + most reliable
|
|
88
|
+
|
|
89
|
+
## Stealth Configuration
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const browser = new BrowserManager({
|
|
93
|
+
stealth: {
|
|
94
|
+
webdriver: true, // Hide webdriver flag
|
|
95
|
+
automation: true, // Hide automation flags
|
|
96
|
+
canvas: true, // Randomize canvas fingerprint
|
|
97
|
+
webgl: true, // Randomize WebGL fingerprint
|
|
98
|
+
audio: true, // Randomize audio context
|
|
99
|
+
timezone: true, // Match proxy timezone
|
|
100
|
+
language: true, // Match browser language
|
|
101
|
+
},
|
|
102
|
+
proxy: {
|
|
103
|
+
rotate: true, // Rotate proxies per request
|
|
104
|
+
pool: ['proxy1', 'proxy2', 'proxy3'],
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const router = new A3MRouter({
|
|
109
|
+
stealth: {
|
|
110
|
+
mode: 'intelligent', // Auto-select stealth level
|
|
111
|
+
rotation: true, // Rotate providers to avoid rate limits
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Example: Job Application Bot
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
import { A3MRouter } from 'adaptive-memory-multi-model-router';
|
|
120
|
+
import { BrowserManager } from 'sota-browser';
|
|
121
|
+
|
|
122
|
+
const RESUME = {
|
|
123
|
+
name: 'Subhojit Das',
|
|
124
|
+
email: 'subho@example.com',
|
|
125
|
+
phone: '+91-7977110915',
|
|
126
|
+
experience: '10 years',
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
async function applyToJobs(jobs: string[]) {
|
|
130
|
+
const router = new A3MRouter({ model: 'auto', stealth: true });
|
|
131
|
+
const browser = new BrowserManager({ stealth: true, proxy: 'auto' });
|
|
132
|
+
|
|
133
|
+
await browser.launch();
|
|
134
|
+
const page = await browser.newPage();
|
|
135
|
+
|
|
136
|
+
for (const jobUrl of jobs) {
|
|
137
|
+
try {
|
|
138
|
+
console.log(`Applying to: ${jobUrl}`);
|
|
139
|
+
|
|
140
|
+
// A3M decides which provider to use
|
|
141
|
+
const routing = await router.route({
|
|
142
|
+
task: 'Is this job a good fit for a growth marketing leader?',
|
|
143
|
+
context: 'job_matching',
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
if (routing.content.includes('Yes')) {
|
|
147
|
+
await page.goto(jobUrl);
|
|
148
|
+
|
|
149
|
+
// CloakBrowser handles anti-detection
|
|
150
|
+
await page.fill('input[name="name"]', RESUME.name);
|
|
151
|
+
await page.fill('input[name="email"]', RESUME.email);
|
|
152
|
+
await page.click('button[type="submit"]');
|
|
153
|
+
|
|
154
|
+
console.log(`✅ Applied! Cost: $${routing.cost}`);
|
|
155
|
+
}
|
|
156
|
+
} catch (e) {
|
|
157
|
+
console.log(`❌ Failed: ${e.message}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
await browser.close();
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Anti-Detection Features
|
|
166
|
+
|
|
167
|
+
sota-browser provides 71 C++ stealth patches:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
✅ navigator.webdriver = false
|
|
171
|
+
✅ Sec-CH-UA headers properly set
|
|
172
|
+
✅ Canvas fingerprint randomization
|
|
173
|
+
✅ WebGL fingerprint randomization
|
|
174
|
+
✅ Audio context noise
|
|
175
|
+
✅ Human-like mouse movements
|
|
176
|
+
✅ Random delays between actions
|
|
177
|
+
✅ Proxy rotation
|
|
178
|
+
✅ timezone matching
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Best Practices
|
|
182
|
+
|
|
183
|
+
1. **Always use proxy rotation** for sensitive tasks
|
|
184
|
+
2. **Set humanize: true** for natural behavior
|
|
185
|
+
3. **Use A3M's parallel ensemble** for critical extractions
|
|
186
|
+
4. **Monitor detection rates** and adjust stealth level
|
|
187
|
+
5. **Rotate between providers** to avoid rate limits
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
MIT - Same as A3M Router
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "a3m-sota-browser",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A3M Router + sota-browser integration for stealth browser automation",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepublishOnly": "npm run build"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"adaptive-memory-multi-model-router": "^2.14.0",
|
|
13
|
+
"sota-browser": "^1.7.0"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"sota-browser": "^1.7.0"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"a3m",
|
|
20
|
+
"sota-browser",
|
|
21
|
+
"cloakbrowser",
|
|
22
|
+
"browser-automation",
|
|
23
|
+
"stealth",
|
|
24
|
+
"anti-detection",
|
|
25
|
+
"llm-routing",
|
|
26
|
+
"cost-optimization"
|
|
27
|
+
],
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/Das-rebel/a3m-router"
|
|
31
|
+
},
|
|
32
|
+
"author": "Subhojit Das",
|
|
33
|
+
"license": "MIT"
|
|
34
|
+
}
|
package/llms-full.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# A3M Router — Complete Reference
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
|
-
A3M Router is an OpenAI-compatible LLM routing gateway that selects the cheapest capable provider per query using multi-signal heuristic scoring.
|
|
4
|
+
A3M Router is an OpenAI-compatible LLM routing gateway that selects the cheapest capable provider per query using multi-signal heuristic scoring. Routes queries across 47+ providers in parallel, scores responses by confidence, returns best result.
|
|
5
5
|
|
|
6
6
|
**Package:** `adaptive-memory-multi-model-router` (npm)
|
|
7
7
|
**Repository:** `Das-rebel/a3m-router` (GitHub)
|
|
@@ -12,7 +12,7 @@ A3M Router is an OpenAI-compatible LLM routing gateway that selects the cheapest
|
|
|
12
12
|
|
|
13
13
|
## Benchmark Results
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### Benchmark Results
|
|
16
16
|
|
|
17
17
|
| Metric | Value |
|
|
18
18
|
|--------|-------|
|
|
@@ -23,13 +23,13 @@ A3M Router is an OpenAI-compatible LLM routing gateway that selects the cheapest
|
|
|
23
23
|
| Abnormal entries | 0 |
|
|
24
24
|
| Queries evaluated | 8,400 |
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Internal evaluation on 8,400 queries from diverse domains.
|
|
27
27
|
|
|
28
28
|
### Official Baseline Status
|
|
29
29
|
|
|
30
30
|
| Benchmark | Venue | Status | Reference |
|
|
31
|
-
|
|
|
32
|
-
|
|
|
31
|
+
| Parallel Routing | Internal eval | 67% exact match |
|
|
32
|
+
| Cost vs all-premium | Internal eval | 62.9% savings |
|
|
33
33
|
| RouterEval | EMNLP 2025 | Baseline merged | MilkThink-Lab/RouterEval#4 |
|
|
34
34
|
| MMR-Bench | ArXiv 2026 | Baseline merged | Hunter-Wrynn/MMR-Bench#4 |
|
|
35
35
|
| LLMRouterBench | ACL 2026 | Submitted | ynulihao/LLMRouterBench#3 |
|
|
@@ -184,7 +184,7 @@ response = client.chat.completions.create(model="auto", messages=[...])
|
|
|
184
184
|
author = {Subho Mukherjee},
|
|
185
185
|
year = {2025},
|
|
186
186
|
url = {https://github.com/Das-rebel/a3m-router},
|
|
187
|
-
note = {
|
|
187
|
+
note = {Parallel ensemble routing across 47+ providers.
|
|
188
188
|
}
|
|
189
189
|
```
|
|
190
190
|
|
package/llms.txt
CHANGED
|
@@ -1,118 +1,68 @@
|
|
|
1
|
-
# A3M Router
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
|
38
|
-
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## API
|
|
47
|
-
|
|
48
|
-
- `POST /v1/chat/completions` — OpenAI-compatible chat
|
|
49
|
-
- `POST /v1/completions` — Text completions
|
|
50
|
-
- `POST /v1/embeddings` — Embeddings
|
|
51
|
-
- `GET /v1/models` — Available models
|
|
52
|
-
- `GET /health` — Provider health
|
|
53
|
-
- `GET /metrics` — Prometheus metrics
|
|
54
|
-
|
|
55
|
-
## Integration Patterns
|
|
56
|
-
|
|
57
|
-
### OpenAI SDK
|
|
58
|
-
```python
|
|
59
|
-
from openai import OpenAI
|
|
60
|
-
client = OpenAI(base_url="http://localhost:8787/v1", api_key="not-needed")
|
|
61
|
-
response = client.chat.completions.create(model="auto", messages=[...])
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### LangChain
|
|
65
|
-
```python
|
|
66
|
-
from a3m_adapter import A3MLangChainAdapter
|
|
67
|
-
llm = A3MLangChainAdapter(model="auto", parallel_ensemble=2)
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### LlamaIndex
|
|
71
|
-
```python
|
|
72
|
-
from a3m_adapter import A3MLlamaIndexAdapter
|
|
73
|
-
llm = A3MLlamaIndexAdapter(model="auto")
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### CrewAI
|
|
77
|
-
```python
|
|
78
|
-
from crewai.llms import A3MCompletion
|
|
79
|
-
agent = Agent(llm=A3MCompletion(model="auto"))
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Cost Savings
|
|
83
|
-
|
|
84
|
-
| Query | GPT-4o | A3M | Savings |
|
|
85
|
-
|-------|---------|-----|---------|
|
|
86
|
-
| Simple Q&A | $0.03 | $0.0001 | 99.7% |
|
|
87
|
-
| Code generation | $0.05 | $0.002 | 96% |
|
|
88
|
-
| Complex reasoning | $0.15 | $0.15 | 0% (correct) |
|
|
89
|
-
|
|
90
|
-
## Memory Features
|
|
91
|
-
|
|
92
|
-
- **Semantic Cache**: Instant responses for similar queries
|
|
93
|
-
- **Conversation Context**: Maintains chat history
|
|
94
|
-
- **Cross-Session Memory**: Remembers important facts
|
|
95
|
-
- **Adaptive Forgetting**: Auto-evicts stale info
|
|
96
|
-
|
|
97
|
-
## Benchmark Results
|
|
98
|
-
|
|
99
|
-
RouterArena (8,400 queries):
|
|
100
|
-
- Accuracy: 96.77%
|
|
101
|
-
- Cost: $0.0768/1K
|
|
102
|
-
- Robustness: 1.0000
|
|
103
|
-
|
|
104
|
-
## Installation
|
|
1
|
+
# A3M Router
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
A3M Router is an OpenAI-compatible LLM routing gateway that selects the cheapest capable provider per query using multi-signal heuristic scoring. Routes queries across 47+ providers in parallel, scores responses by confidence, and returns the best result. No GPU required; pure heuristic routing.
|
|
5
|
+
|
|
6
|
+
## Architecture
|
|
7
|
+
- Stateless proxy between client applications and LLM providers
|
|
8
|
+
- Pipeline: Guardrails → Semantic Cache → Multi-Signal Heuristic Routing → Provider Execution
|
|
9
|
+
- No ML training required; no GPU resources for routing decisions
|
|
10
|
+
|
|
11
|
+
## Routing Method
|
|
12
|
+
Multi-signal heuristic scoring across five dimensions:
|
|
13
|
+
1. Domain detection (legal, medical, security, finance, code, ML) — up to +0.35
|
|
14
|
+
2. Task indicators (code, math, translate, creative) — up to +0.25
|
|
15
|
+
3. Query structure (clauses, length, qualifiers) — up to +0.20
|
|
16
|
+
4. Action verb intensity (expert/mid/simple) — +0.20 to −0.10
|
|
17
|
+
5. Multi-step detection (explicit step markers) — up to +0.15
|
|
18
|
+
|
|
19
|
+
Complexity score (0.0–1.0) maps to provider tiers: free (taste-1), cheap (llama-3.3-70b), mid (gpt-4o-mini), premium (gpt-4o, claude-3.5-sonnet).
|
|
20
|
+
|
|
21
|
+
## Key Technical Capabilities
|
|
22
|
+
|
|
23
|
+
| Feature | Description |
|
|
24
|
+
|---------|-------------|
|
|
25
|
+
| Parallel Ensemble | Fire queries to multiple providers simultaneously, score by confidence, return best |
|
|
26
|
+
| EXP3-Inspired Diversity | Adversarial bandit techniques for exploration vs exploitation balance |
|
|
27
|
+
| Semantic Caching | Embedding-based lookup, configurable similarity threshold, per-route TTL |
|
|
28
|
+
| Adaptive Memory | EMA-based model quality scoring, no retraining needed |
|
|
29
|
+
| 47+ Providers | OpenAI, Anthropic, Groq, Gemini, DeepSeek, Mistral, OpenRouter, Ollama, vLLM, and 40+ more |
|
|
30
|
+
| Circuit Breaker | 3-failure trigger, 60s cooldown per provider |
|
|
31
|
+
| Per-Provider Retry | Exponential backoff with 429 detection and automatic failover |
|
|
32
|
+
| Budget Enforcement | Per-user/team caps, real-time alerts at 50%/80%/100% |
|
|
33
|
+
| Guardrails | Prompt injection detection, PII detection |
|
|
34
|
+
|
|
35
|
+
## Local Evaluation
|
|
36
|
+
|
|
37
|
+
| Metric | Value |
|
|
38
|
+
|--------|-------|
|
|
39
|
+
| Exact tier match | 67% |
|
|
40
|
+
| Within 1 tier | 96% |
|
|
41
|
+
| Cost savings vs all-premium | 62.9% |
|
|
42
|
+
|
|
43
|
+
## Provider Coverage
|
|
44
|
+
OpenAI, Anthropic, Google, Groq, DeepSeek, Mistral, NVIDIA, OpenRouter, Kimi, Qwen, Zhipu, Yi, Azure OpenAI, AWS Bedrock, Local Ollama, Local vLLM + 40+ more.
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
OpenAI-compatible proxy at localhost:8787. Model selection via `model="auto"` invokes heuristic routing.
|
|
105
48
|
|
|
106
49
|
```bash
|
|
107
50
|
npm install adaptive-memory-multi-model-router
|
|
108
|
-
|
|
109
|
-
docker run -p 8787:8787 ghcr.io/das-rebel/a3m-router
|
|
51
|
+
npx a3m-router "your question here"
|
|
110
52
|
```
|
|
111
53
|
|
|
112
|
-
##
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
54
|
+
## Citation
|
|
55
|
+
```
|
|
56
|
+
@software{a3m_router,
|
|
57
|
+
title = {A3M Router: OpenAI-Compatible Parallel LLM Routing Gateway},
|
|
58
|
+
author = {Subho Mukherjee},
|
|
59
|
+
year = {2025},
|
|
60
|
+
url = {https://github.com/Das-rebel/a3m-router}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
117
63
|
|
|
118
|
-
|
|
64
|
+
## References
|
|
65
|
+
- RouteWorks/RouterArena (ICLR 2025): https://github.com/RouteWorks/RouterArena
|
|
66
|
+
- MilkThink-Lab/RouterEval (EMNLP 2025): https://github.com/MilkThink-Lab/RouterEval
|
|
67
|
+
- Hunter-Wrynn/MMR-Bench (ArXiv 2026): https://github.com/Hunter-Wrynn/MMR-Bench
|
|
68
|
+
- ynulihao/LLMRouterBench (ACL 2026): https://github.com/ynulihao/LLMRouterBench
|
package/package.json
CHANGED
|
@@ -1,16 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adaptive-memory-multi-model-router",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "2.16.0",
|
|
4
|
+
"shortName": "A3M Router",
|
|
5
|
+
"displayName": "A3M Router - Adaptive Memory Multi-Model Router",
|
|
6
|
+
"description": "Best in class open source LLM router across 80+ providers with Evolution-inspired routing: EXP3 diversity, MVT rate-limit rotation, optimal defense theory verification.",
|
|
7
|
+
"main": "dist/index.js",
|
|
6
8
|
"bin": {
|
|
7
|
-
"a3m-router": "
|
|
8
|
-
"a3m": "
|
|
9
|
+
"a3m-router": "dist/cli.js",
|
|
10
|
+
"a3m": "dist/tui/index.js",
|
|
11
|
+
"a3m-tui": "dist/tui/index.js",
|
|
12
|
+
"adaptive-memory-multi-model-router": "dist/cli.js"
|
|
9
13
|
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
+
"exports": {
|
|
15
|
+
".": "./dist/index.js",
|
|
16
|
+
"./providers": "./dist/providers/registry.js",
|
|
17
|
+
"./memory": "./dist/memory/memoryTree.js",
|
|
18
|
+
"./cache": {
|
|
19
|
+
"import": "./dist/cache/semanticCache.js",
|
|
20
|
+
"require": "./dist/cache/semanticCache.js",
|
|
21
|
+
"types": "./dist/cache/semanticCache.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./compression": "./dist/utils/enhancedCompression.js",
|
|
24
|
+
"./autofetch": "./dist/memory/autoFetch.js",
|
|
25
|
+
"./vault": "./dist/memory/obsidianVault.js",
|
|
26
|
+
"./oauth": "./dist/integrations/oauth.js",
|
|
27
|
+
"./utils": "./dist/utils/tokenUtils.js",
|
|
28
|
+
"./cost": "./dist/cost/costTracker.js",
|
|
29
|
+
"./integrations": "./dist/integrations/index.js",
|
|
30
|
+
"./security": "./dist/security/inputValidation.js",
|
|
31
|
+
"./langchain": {
|
|
32
|
+
"import": "./dist/integrations/langchainAdapter.js",
|
|
33
|
+
"require": "./dist/integrations/langchainAdapter.js",
|
|
34
|
+
"types": "./dist/integrations/langchainAdapter.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./geo": "./dist/geo/generativeEngineOptimization.js",
|
|
37
|
+
"./server": {
|
|
38
|
+
"import": "./dist/server/proxyServer.js",
|
|
39
|
+
"require": "./dist/server/proxyServer.js",
|
|
40
|
+
"types": "./dist/server/proxyServer.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"./guardrails": {
|
|
43
|
+
"import": "./dist/security/guardrails.js",
|
|
44
|
+
"require": "./dist/security/guardrails.js",
|
|
45
|
+
"types": "./dist/security/guardrails.d.ts"
|
|
46
|
+
},
|
|
47
|
+
"./analytics": {
|
|
48
|
+
"import": "./dist/analytics/costAnalytics.js",
|
|
49
|
+
"require": "./dist/analytics/costAnalytics.js",
|
|
50
|
+
"types": "./dist/analytics/costAnalytics.d.ts"
|
|
51
|
+
},
|
|
52
|
+
"./sdk": {
|
|
53
|
+
"import": "./dist/sdk.js",
|
|
54
|
+
"require": "./dist/sdk.js"
|
|
55
|
+
}
|
|
14
56
|
},
|
|
15
57
|
"keywords": [
|
|
16
58
|
"a3m",
|
|
@@ -114,16 +156,53 @@
|
|
|
114
156
|
"multi-llm-router",
|
|
115
157
|
"multi-model-router"
|
|
116
158
|
],
|
|
159
|
+
"author": "Das-rebel <subho@example.com>",
|
|
160
|
+
"license": "MIT",
|
|
117
161
|
"repository": {
|
|
118
162
|
"type": "git",
|
|
119
|
-
"url": "https://github.com/Das-rebel/a3m-router"
|
|
163
|
+
"url": "git+https://github.com/Das-rebel/a3m-router.git"
|
|
164
|
+
},
|
|
165
|
+
"bugs": {
|
|
166
|
+
"url": "https://github.com/Das-rebel/a3m-router/issues"
|
|
120
167
|
},
|
|
121
168
|
"homepage": "https://das-rebel.github.io/a3m-router/",
|
|
169
|
+
"scripts": {
|
|
170
|
+
"test": "node test.js && node test/provider-test.js",
|
|
171
|
+
"test:py": "python3 -m pytest -q",
|
|
172
|
+
"test:all": "npm test && npm run test:py",
|
|
173
|
+
"eval:routing": "node eval/run_eval.js",
|
|
174
|
+
"eval:golden": "node eval/check_golden_routes.js",
|
|
175
|
+
"eval:faults": "node eval/run_fault_injection.js",
|
|
176
|
+
"eval:shadow": "node eval/run_shadow_eval.js",
|
|
177
|
+
"eval:report": "node eval/generate_report.js",
|
|
178
|
+
"eval:all": "npm run eval:routing && npm run eval:golden && npm run eval:faults && npm run eval:shadow && npm run eval:report",
|
|
179
|
+
"test:providers": "node test/provider-test.js",
|
|
180
|
+
"benchmark": "node test/benchmark.js",
|
|
181
|
+
"benchmark:verbose": "node test/benchmark.js --verbose",
|
|
182
|
+
"build": "npx tsc -p tsconfig.build.json",
|
|
183
|
+
"postinstall": "node scripts/postinstall-nudge.js"
|
|
184
|
+
},
|
|
185
|
+
"engines": {
|
|
186
|
+
"node": ">=18.0.0"
|
|
187
|
+
},
|
|
188
|
+
"peerDependencies": {
|
|
189
|
+
"@langchain/core": ">=0.1.0"
|
|
190
|
+
},
|
|
191
|
+
"peerDependenciesMeta": {
|
|
192
|
+
"@langchain/core": {
|
|
193
|
+
"optional": true
|
|
194
|
+
}
|
|
195
|
+
},
|
|
122
196
|
"dependencies": {
|
|
123
197
|
"blessed": "^0.1.81",
|
|
124
198
|
"nanoid": "^6.0.0"
|
|
125
199
|
},
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
|
|
200
|
+
"devDependencies": {
|
|
201
|
+
"@types/express": "^5.0.6",
|
|
202
|
+
"@types/node": "^26.1.1",
|
|
203
|
+
"esbuild": "^0.28.1",
|
|
204
|
+
"typescript": "^7.0.2",
|
|
205
|
+
"vitest": "^4.1.10"
|
|
206
|
+
},
|
|
207
|
+
"types": "dist/index.d.ts"
|
|
129
208
|
}
|