adaptive-memory-multi-model-router 2.15.4 → 2.15.5
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/adapters-ci.yml +142 -0
- package/.github/workflows/ci.yml +2 -5
- package/.github/workflows/pypi-publish.yml +102 -0
- 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 +137 -142
- 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/adapters/a3m_adapter/__init__.py +39 -3
- package/adapters/a3m_adapter/adapter/__init__.py +16 -1
- package/adapters/a3m_adapter/adapter/autogen.py +169 -0
- package/adapters/a3m_adapter/adapter/haystack.py +197 -0
- package/adapters/a3m_adapter/adapter/langgraph.py +196 -0
- package/adapters/a3m_adapter/adapter/pinecone.py +217 -0
- package/adapters/a3m_adapter/adapter/vercel.py +188 -0
- package/adapters/a3m_adapter/tests/test_adapters.py +29 -31
- package/adapters/a3m_adapter/tests/test_integration.py +80 -0
- package/adapters/requirements-dev.txt +6 -0
- package/adapters/requirements.txt +4 -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/demo.py +251 -0
- 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/docker-compose.yml +84 -60
- package/docs/comparison.md +2 -2
- package/docs/llms-full.txt +89 -0
- package/docs/llms.txt +25 -67
- package/docs-site/index.html +9 -9
- 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 +25 -67
- package/package.json +34 -5
- 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/packages/agentkit-adapter/LICENSE +21 -0
- package/packages/agentkit-adapter/README.md +126 -0
- package/packages/agentkit-adapter/examples/agentkit-example.ts +139 -0
- package/packages/agentkit-adapter/package.json +57 -0
- package/packages/agentkit-adapter/src/adapter.ts +381 -0
- package/packages/agentkit-adapter/src/index.ts +36 -0
- package/packages/agentkit-adapter/src/types.ts +105 -0
- package/packages/agentkit-adapter/src/util.ts +13 -0
- package/packages/agentkit-adapter/tsconfig.json +22 -0
- package/prometheus.yml +8 -0
- package/python/README.md +92 -65
- package/python/a3m/__init__.py +32 -3
- package/python/a3m/adapters/__init__.py +21 -0
- package/python/a3m/adapters/langchain.py +190 -0
- package/python/a3m/adapters/llamaindex.py +249 -0
- package/python/a3m/adapters/qdrant.py +240 -0
- package/python/a3m/adapters/weaviate.py +263 -0
- package/python/a3m/client.py +5 -0
- package/python/a3m_router.egg-info/PKG-INFO +172 -0
- package/python/a3m_router.egg-info/SOURCES.txt +17 -0
- package/python/a3m_router.egg-info/dependency_links.txt +1 -0
- package/python/a3m_router.egg-info/requires.txt +24 -0
- package/python/a3m_router.egg-info/top_level.txt +1 -0
- package/python/build_verify.sh +32 -0
- package/python/dist/a3m_router-2.2.1-py3-none-any.whl +0 -0
- package/python/dist/a3m_router-2.2.1.tar.gz +0 -0
- package/python/dist/a3m_router-2.2.2-py3-none-any.whl +0 -0
- package/python/dist/a3m_router-2.2.2.tar.gz +0 -0
- package/python/mcp-server/README.md +172 -0
- package/python/mcp-server/a3m_mcp/__init__.py +15 -0
- package/python/mcp-server/a3m_mcp/__main__.py +15 -0
- package/python/mcp-server/a3m_mcp/server.py +339 -0
- package/python/mcp-server/pyproject.toml +24 -0
- package/python/pyproject.toml +56 -5
- package/python/setup.py +3 -28
- package/src/providers/providerConfig.ts +1053 -1
- package/summary.txt +38 -0
- package/tsconfig.build.json +1 -2
- 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
|
@@ -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
|
@@ -2,7 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## What is A3M Router?
|
|
4
4
|
|
|
5
|
-
A3M Router is an intelligent LLM routing proxy that automatically selects the cheapest capable model for each request across 47+ providers.
|
|
5
|
+
A3M Router is an intelligent LLM routing proxy that automatically selects the cheapest capable model for each request across 47+ providers. Saves 70-95% on AI costs.
|
|
6
|
+
|
|
7
|
+
## Framework Adapters (8 Total)
|
|
8
|
+
|
|
9
|
+
| Adapter | Framework | Use Case |
|
|
10
|
+
|---------|-----------|---------|
|
|
11
|
+
| A3MLangChainAdapter | LangChain | Chain-based AI workflows |
|
|
12
|
+
| A3MLlamaIndexAdapter | LlamaIndex | RAG and document qa |
|
|
13
|
+
| A3MAutoGenAdapter | AutoGen | Multi-agent conversations |
|
|
14
|
+
| A3MVercelAdapter | Vercel AI SDK | Next.js apps |
|
|
15
|
+
| A3MHaystackAdapter | Haystack | RAG pipelines |
|
|
16
|
+
| A3MPineconeAdapter | Pinecone | Vector search + RAG |
|
|
17
|
+
| A3MLangGraphAdapter | LangGraph | Stateful agents |
|
|
18
|
+
| A3MCompletion | CrewAI | Multi-agent systems |
|
|
6
19
|
|
|
7
20
|
## Core Capabilities
|
|
8
21
|
|
|
@@ -19,7 +32,7 @@ A3M Router is an intelligent LLM routing proxy that automatically selects the ch
|
|
|
19
32
|
- Use case: "best answer regardless of cost" mode
|
|
20
33
|
|
|
21
34
|
### 3. Biology-Inspired Routing
|
|
22
|
-
- EXP3: Prevents provider monoculture
|
|
35
|
+
- EXP3: Prevents provider monoculture
|
|
23
36
|
- Charnov MVT: Optimal rate-limit rotation timing
|
|
24
37
|
- ODT Shadow Verification: Probabilistic verification for high-stakes queries
|
|
25
38
|
|
|
@@ -31,53 +44,16 @@ A3M Router is an intelligent LLM routing proxy that automatically selects the ch
|
|
|
31
44
|
|
|
32
45
|
## Supported Providers (47+)
|
|
33
46
|
|
|
34
|
-
|
|
35
|
-
|----------|------|---------------|
|
|
36
|
-
| OpenAI | Premium, Mid | gpt-4o, gpt-4o-mini |
|
|
37
|
-
| Anthropic | Premium, Mid | claude-3.5-sonnet, claude-3-haiku |
|
|
38
|
-
| Google | Premium, Mid | gemini-1.5-pro, gemini-1.5-flash |
|
|
39
|
-
| Groq | Cheap | llama-3.3-70b, llama-3.1-8b |
|
|
40
|
-
| DeepSeek | Cheap, Mid | deepseek-chat, deepseek-coder |
|
|
41
|
-
| Mistral | Cheap, Mid | mistral-large, mistral-small |
|
|
42
|
-
| NVIDIA | Premium | nemotron |
|
|
43
|
-
| Ollama | All | Local models |
|
|
44
|
-
| vLLM | All | Self-hosted |
|
|
47
|
+
OpenAI, Anthropic, Google, Groq, DeepSeek, Mistral, NVIDIA, Ollama, vLLM, Azure OpenAI, AWS Bedrock, and 37 more.
|
|
45
48
|
|
|
46
49
|
## API Endpoints
|
|
47
50
|
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
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
|
-
```
|
|
51
|
+
- POST /v1/chat/completions — OpenAI-compatible chat
|
|
52
|
+
- POST /v1/completions — Text completions
|
|
53
|
+
- POST /v1/embeddings — Embeddings
|
|
54
|
+
- GET /v1/models — Available models
|
|
55
|
+
- GET /health — Provider health
|
|
56
|
+
- GET /metrics — Prometheus metrics
|
|
81
57
|
|
|
82
58
|
## Cost Savings
|
|
83
59
|
|
|
@@ -87,32 +63,14 @@ agent = Agent(llm=A3MCompletion(model="auto"))
|
|
|
87
63
|
| Code generation | $0.05 | $0.002 | 96% |
|
|
88
64
|
| Complex reasoning | $0.15 | $0.15 | 0% (correct) |
|
|
89
65
|
|
|
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
66
|
## Installation
|
|
105
67
|
|
|
106
68
|
```bash
|
|
107
69
|
npm install adaptive-memory-multi-model-router
|
|
108
|
-
pip install
|
|
109
|
-
docker
|
|
70
|
+
pip install adapters/
|
|
71
|
+
docker-compose up -d
|
|
110
72
|
```
|
|
111
73
|
|
|
112
74
|
## Keywords
|
|
113
75
|
|
|
114
|
-
llm-router, ai-gateway, model-routing, cost-optimization, multi-provider, openai-compatible, langchain, llamaindex, crewai, parallel-execution, semantic-cache, adaptive-routing, failover, guardrails, cache, budget-alerts, streaming, retries, circuit-breaker
|
|
115
|
-
|
|
116
|
-
## License
|
|
117
|
-
|
|
118
|
-
MIT
|
|
76
|
+
llm-router, ai-gateway, model-routing, cost-optimization, multi-provider, openai-compatible, langchain, llamaindex, autogena, vercel-ai, haystack, pinecone, langgraph, crewai, parallel-execution, semantic-cache, adaptive-routing, failover, guardrails, cache, budget-alerts, streaming, retries, circuit-breaker, multi-agent, rag, embeddings, vector-search
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adaptive-memory-multi-model-router",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.5",
|
|
4
4
|
"description": "Best in class open source LLM router across 47+ providers with Evolution-inspired routing: EXP3 diversity, MVT rate-limit rotation, optimal defense theory verification.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"a3m-router": "./
|
|
8
|
-
"a3m": "./
|
|
7
|
+
"a3m-router": "./dist/cli.js",
|
|
8
|
+
"a3m": "./dist/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"start": "node
|
|
11
|
+
"start": "node dist/cli.js serve",
|
|
12
12
|
"test": "node --test",
|
|
13
13
|
"lint": "eslint src/"
|
|
14
14
|
},
|
|
@@ -112,7 +112,32 @@
|
|
|
112
112
|
"llm-failover",
|
|
113
113
|
"api-cost-reduction",
|
|
114
114
|
"multi-llm-router",
|
|
115
|
-
"multi-model-router"
|
|
115
|
+
"multi-model-router",
|
|
116
|
+
"llm-proxy",
|
|
117
|
+
"api-gateway",
|
|
118
|
+
"reverse-proxy",
|
|
119
|
+
"kubernetes",
|
|
120
|
+
"docker",
|
|
121
|
+
"browser-automation",
|
|
122
|
+
"playwright",
|
|
123
|
+
"puppeteer",
|
|
124
|
+
"web-scraping",
|
|
125
|
+
"anti-detection",
|
|
126
|
+
"stealth-browser",
|
|
127
|
+
"crawling",
|
|
128
|
+
"text-extraction",
|
|
129
|
+
"data-extraction",
|
|
130
|
+
"form-filling",
|
|
131
|
+
"content-generation",
|
|
132
|
+
"model-selection",
|
|
133
|
+
"provider-aggregation",
|
|
134
|
+
"langchain-adapter",
|
|
135
|
+
"llamaindex-adapter",
|
|
136
|
+
"vector-search",
|
|
137
|
+
"embeddings",
|
|
138
|
+
"nvidia-nim",
|
|
139
|
+
"ollama",
|
|
140
|
+
"vllm"
|
|
116
141
|
],
|
|
117
142
|
"repository": {
|
|
118
143
|
"type": "git",
|
|
@@ -125,5 +150,9 @@
|
|
|
125
150
|
},
|
|
126
151
|
"engines": {
|
|
127
152
|
"node": ">=18.0.0"
|
|
153
|
+
},
|
|
154
|
+
"devDependencies": {
|
|
155
|
+
"@types/node": "^26.1.2",
|
|
156
|
+
"typescript": "^7.0.2"
|
|
128
157
|
}
|
|
129
158
|
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# a3m-vercel-ai
|
|
2
|
+
|
|
3
|
+
**A3M Router provider for Vercel AI SDK** — intelligent cost-based routing with parallel execution, automatic fallback, and 60%+ cost savings.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔀 **Automatic Model Selection** — Routes to the cheapest capable provider automatically
|
|
8
|
+
- ⚡ **Parallel Ensemble** — Runs multiple providers simultaneously, picks the best result
|
|
9
|
+
- 💰 **60%+ Cost Savings** — Routes simple queries to free/cheap providers automatically
|
|
10
|
+
- 🔄 **Automatic Fallback** — If primary provider fails, routes to next best option
|
|
11
|
+
- 🛡️ **Circuit Breakers** — Skips degraded providers automatically
|
|
12
|
+
- 📊 **Cost Tracking** — Per-request cost visibility in response metadata
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install a3m-vercel-ai ai
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { createA3MProvider } from 'a3m-vercel-ai';
|
|
24
|
+
import { generateText } from 'ai';
|
|
25
|
+
|
|
26
|
+
const a3m = createA3MProvider();
|
|
27
|
+
|
|
28
|
+
const result = await generateText({
|
|
29
|
+
model: a3m('auto'),
|
|
30
|
+
prompt: 'What is the capital of France?',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
console.log(result.text);
|
|
34
|
+
// A3M automatically routes to the cheapest capable provider
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
const a3m = createA3MProvider({
|
|
41
|
+
// A3M Router endpoint (default: http://localhost:8787)
|
|
42
|
+
baseURL: process.env.A3M_ROUTER_URL || 'http://localhost:8787',
|
|
43
|
+
|
|
44
|
+
// API key (default: 'not-needed' for local)
|
|
45
|
+
apiKey: process.env.A3M_API_KEY,
|
|
46
|
+
|
|
47
|
+
// Enable parallel ensemble execution
|
|
48
|
+
parallelEnsemble: true,
|
|
49
|
+
|
|
50
|
+
// Number of providers to run in parallel (default: 3)
|
|
51
|
+
parallelCount: 3,
|
|
52
|
+
|
|
53
|
+
// Enable stealth mode for browser automation
|
|
54
|
+
stealth: false,
|
|
55
|
+
|
|
56
|
+
// Cache configuration
|
|
57
|
+
cache: {
|
|
58
|
+
enabled: true,
|
|
59
|
+
ttl: 3600, // 1 hour
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
// Provider API keys (if not using environment variables)
|
|
63
|
+
providers: {
|
|
64
|
+
openai: { apiKey: process.env.OPENAI_API_KEY },
|
|
65
|
+
anthropic: { apiKey: process.env.ANTHROPIC_API_KEY },
|
|
66
|
+
groq: { apiKey: process.env.GROQ_API_KEY },
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Next.js App Router Example
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// app/api/chat/route.ts
|
|
75
|
+
import { createA3MProvider } from 'a3m-vercel-ai';
|
|
76
|
+
import { streamText } from 'ai';
|
|
77
|
+
|
|
78
|
+
const a3m = createA3MProvider({
|
|
79
|
+
parallelEnsemble: true,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export async function POST(req: Request) {
|
|
83
|
+
const { messages } = await req.json();
|
|
84
|
+
|
|
85
|
+
const result = await streamText({
|
|
86
|
+
model: a3m('auto'),
|
|
87
|
+
messages,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return result.toDataStreamResponse();
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Streaming Response
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
const result = await streamText({
|
|
98
|
+
model: a3m('auto'),
|
|
99
|
+
prompt: 'Write a story about a robot...',
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Stream to response
|
|
103
|
+
return result.toDataStreamResponse();
|
|
104
|
+
|
|
105
|
+
// Or accumulate and use
|
|
106
|
+
const { text } = await result.consumeStream();
|
|
107
|
+
console.log(text);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## How It Works
|
|
111
|
+
|
|
112
|
+
A3M Router analyzes each request and routes to the optimal provider:
|
|
113
|
+
|
|
114
|
+
| Request Type | Example | Routed To | Why |
|
|
115
|
+
|-------------|---------|-----------|-----|
|
|
116
|
+
| Simple Q&A | "What is 2+2?" | Groq (free) | Basic math,不需要高级模型 |
|
|
117
|
+
| Code generation | "Write a sorting function" | DeepSeek Coder | 专用代码模型 |
|
|
118
|
+
| Complex analysis | "Analyze this legal contract" | Claude 3.5 | 需要长上下文 |
|
|
119
|
+
| Creative writing | "Write a poem" | GPT-4o | 创意任务 |
|
|
120
|
+
|
|
121
|
+
## Cost Savings
|
|
122
|
+
|
|
123
|
+
| Setup | Monthly Cost (100K requests) |
|
|
124
|
+
|-------|-------------------------------|
|
|
125
|
+
| GPT-4o only | $3,000 |
|
|
126
|
+
| Claude only | $2,500 |
|
|
127
|
+
| **A3M Router** | **$800** |
|
|
128
|
+
|
|
129
|
+
## Environment Variables
|
|
130
|
+
|
|
131
|
+
Configure your provider API keys:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# .env.local
|
|
135
|
+
A3M_ROUTER_URL=http://localhost:8787
|
|
136
|
+
OPENAI_API_KEY=sk-...
|
|
137
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
138
|
+
GROQ_API_KEY=gsk_...
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Requirements
|
|
142
|
+
|
|
143
|
+
- Node.js 18+
|
|
144
|
+
- Vercel AI SDK 3.0+
|
|
145
|
+
- A3M Router running (or use hosted version)
|
|
146
|
+
|
|
147
|
+
## Start A3M Router
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Install A3M Router
|
|
151
|
+
npm install -g adaptive-memory-multi-model-router
|
|
152
|
+
|
|
153
|
+
# Start the router
|
|
154
|
+
a3m-router serve
|
|
155
|
+
|
|
156
|
+
# Router now running at http://localhost:8787
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
MIT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A3M Router Language Model for Vercel AI SDK (v3)
|
|
3
|
+
*
|
|
4
|
+
* Implements the LanguageModelV1 interface from @ai-sdk/provider
|
|
5
|
+
*/
|
|
6
|
+
import { LanguageModelV1 } from '@ai-sdk/provider';
|
|
7
|
+
import type { A3MRouterConfig } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Create an A3M Router Language Model for Vercel AI SDK
|
|
10
|
+
*/
|
|
11
|
+
export declare function createA3MLanguageModel(config?: A3MRouterConfig): LanguageModelV1;
|
|
12
|
+
//# sourceMappingURL=a3m-language-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"a3m-language-model.d.ts","sourceRoot":"","sources":["../src/a3m-language-model.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EAOhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA6C/C;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,GAAE,eAAoB,mBA6TlE"}
|