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.
Files changed (173) hide show
  1. package/.github/workflows/adapters-ci.yml +142 -0
  2. package/.github/workflows/ci.yml +2 -5
  3. package/.github/workflows/pypi-publish.yml +102 -0
  4. package/AGENT_COUNCIL_FINDINGS.md +123 -98
  5. package/CAMPAIGN_SUMMARY.md +87 -0
  6. package/CHANGELOG.md +7 -1
  7. package/ENTERPRISE_INTEGRATIONS.md +94 -0
  8. package/INTEGRATION_PROGRESS.md +96 -0
  9. package/OPPORTUNITIES_100.md +277 -0
  10. package/POPULARITY_BOOSTERS.md +1 -1
  11. package/README.md +137 -142
  12. package/README_ja.md +17 -21
  13. package/README_zh.md +13 -17
  14. package/TODO_BROWSER_AUTOMATION.md +87 -0
  15. package/a3m-integrations-summary.md +73 -0
  16. package/adapters/a3m_adapter/__init__.py +39 -3
  17. package/adapters/a3m_adapter/adapter/__init__.py +16 -1
  18. package/adapters/a3m_adapter/adapter/autogen.py +169 -0
  19. package/adapters/a3m_adapter/adapter/haystack.py +197 -0
  20. package/adapters/a3m_adapter/adapter/langgraph.py +196 -0
  21. package/adapters/a3m_adapter/adapter/pinecone.py +217 -0
  22. package/adapters/a3m_adapter/adapter/vercel.py +188 -0
  23. package/adapters/a3m_adapter/tests/test_adapters.py +29 -31
  24. package/adapters/a3m_adapter/tests/test_integration.py +80 -0
  25. package/adapters/requirements-dev.txt +6 -0
  26. package/adapters/requirements.txt +4 -0
  27. package/apps/cost-calculator/README.md +72 -0
  28. package/apps/cost-calculator/calculator.css +280 -0
  29. package/apps/cost-calculator/calculator.js +150 -0
  30. package/apps/cost-calculator/index.html +321 -0
  31. package/apps/cost-calculator/package.json +13 -0
  32. package/articles/ANNOUNCEMENT_reddit_ml.md +76 -0
  33. package/articles/ANNOUNCEMENT_vc/347/244/276/345/214/272.md +71 -0
  34. package/articles/ANNOUNCEMENT_vercel.md +85 -0
  35. package/articles/CHINESE_DIRECTORIES.md +2 -2
  36. package/articles/CHINESE_SUBMISSIONS_READY.md +5 -5
  37. package/articles/HN_POST_READY.md +16 -20
  38. package/articles/INDIEHACKERS_READY.md +19 -34
  39. package/demo.py +251 -0
  40. package/dist/analytics/costAnalytics.d.ts +0 -1
  41. package/dist/benchmark/reproducible.d.ts +0 -1
  42. package/dist/cache/semanticCache.d.ts +0 -1
  43. package/dist/cost/budgetEnforcer.d.ts +0 -1
  44. package/dist/cost/costTracker.d.ts +0 -1
  45. package/dist/ensemble/multiRoundDialog.d.ts +0 -1
  46. package/dist/ensemble/shapleyValue.d.ts +0 -1
  47. package/dist/ensemble.d.ts +0 -1
  48. package/dist/index.d.ts +0 -1
  49. package/dist/integrations/oauth.d.ts +0 -1
  50. package/dist/integrations/scienceAdapter.d.ts +0 -1
  51. package/dist/memory/autoFetch.d.ts +0 -1
  52. package/dist/memory/hybridMemory.d.ts +0 -1
  53. package/dist/memory/memoryTree.d.ts +0 -1
  54. package/dist/memory/obsidianVault.d.ts +0 -1
  55. package/dist/memory/reasoningBank.d.ts +0 -1
  56. package/dist/observability/changeWatch.d.ts +0 -1
  57. package/dist/observability/fatigueDetector.d.ts +0 -1
  58. package/dist/observability/index.d.ts +0 -1
  59. package/dist/observability/metrics.d.ts +0 -1
  60. package/dist/observability/middleware.d.ts +0 -1
  61. package/dist/observability/tracer.d.ts +0 -1
  62. package/dist/observability/types.d.ts +0 -1
  63. package/dist/providers/providerConfig.d.ts +5 -2
  64. package/dist/providers/providerConfig.js +1006 -1
  65. package/dist/providers/providerConfig.js.map +1 -1
  66. package/dist/routing/advancedRouter.d.ts +1 -2
  67. package/dist/routing/advancedRouter.js +84 -0
  68. package/dist/routing/advancedRouter.js.map +1 -1
  69. package/dist/routing/crossModelValidation.d.ts +0 -1
  70. package/dist/routing/providerHealth.d.ts +77 -2
  71. package/dist/routing/providerHealth.js +190 -4
  72. package/dist/routing/providerHealth.js.map +1 -1
  73. package/dist/routing/providerRetry.d.ts +0 -1
  74. package/dist/routing/shadowSampler.d.ts +187 -0
  75. package/dist/routing/shadowSampler.js +306 -0
  76. package/dist/routing/shadowSampler.js.map +1 -0
  77. package/dist/sdk.d.ts +0 -1
  78. package/dist/security/guardrails.d.ts +0 -1
  79. package/dist/server/dashboard.d.ts +0 -1
  80. package/dist/server/handlers/chatHandler.d.ts +0 -1
  81. package/dist/server/handlers/completionsHandler.d.ts +0 -1
  82. package/dist/server/handlers/embeddingsHandler.d.ts +0 -1
  83. package/dist/server/handlers/healthHandler.d.ts +0 -1
  84. package/dist/server/handlers/metricsHandler.d.ts +0 -1
  85. package/dist/server/handlers/modelsHandler.d.ts +0 -1
  86. package/dist/server/metrics.d.ts +0 -1
  87. package/dist/server/modelMapper.d.ts +0 -1
  88. package/dist/server/proxyServer.d.ts +0 -1
  89. package/dist/server/router.d.ts +0 -1
  90. package/dist/server/state.d.ts +0 -1
  91. package/dist/tui/dashboard.d.ts +0 -1
  92. package/dist/utils/costUtils.d.ts +0 -1
  93. package/dist/utils/sorting.d.ts +0 -1
  94. package/dist/utils/tokenUtils.d.ts +0 -1
  95. package/docker-compose.yml +84 -60
  96. package/docs/comparison.md +2 -2
  97. package/docs/llms-full.txt +89 -0
  98. package/docs/llms.txt +25 -67
  99. package/docs-site/index.html +9 -9
  100. package/integrations/browser-use/README.md +155 -0
  101. package/integrations/browser-use/examples/form-filling.ts +179 -0
  102. package/integrations/browser-use/index.ts +145 -0
  103. package/integrations/browser-use/package.json +34 -0
  104. package/integrations/browser-use/tsconfig.json +17 -0
  105. package/integrations/mcp-browser/README.md +177 -0
  106. package/integrations/mcp-browser/package.json +38 -0
  107. package/integrations/mcp-browser/src/index.ts +297 -0
  108. package/integrations/sota-browser/README.md +191 -0
  109. package/integrations/sota-browser/package.json +34 -0
  110. package/llms-full.txt +6 -6
  111. package/llms.txt +25 -67
  112. package/package.json +34 -5
  113. package/packages/a3m-vercel-ai/README.md +161 -0
  114. package/packages/a3m-vercel-ai/dist/a3m-language-model.d.ts +12 -0
  115. package/packages/a3m-vercel-ai/dist/a3m-language-model.d.ts.map +1 -0
  116. package/packages/a3m-vercel-ai/dist/a3m-language-model.js +289 -0
  117. package/packages/a3m-vercel-ai/dist/a3m-language-model.js.map +1 -0
  118. package/packages/a3m-vercel-ai/dist/index.d.ts +82 -0
  119. package/packages/a3m-vercel-ai/dist/index.d.ts.map +1 -0
  120. package/packages/a3m-vercel-ai/dist/index.js +79 -0
  121. package/packages/a3m-vercel-ai/dist/index.js.map +1 -0
  122. package/packages/a3m-vercel-ai/dist/types.d.ts +97 -0
  123. package/packages/a3m-vercel-ai/dist/types.d.ts.map +1 -0
  124. package/packages/a3m-vercel-ai/dist/types.js +5 -0
  125. package/packages/a3m-vercel-ai/dist/types.js.map +1 -0
  126. package/packages/a3m-vercel-ai/package-lock.json +969 -0
  127. package/packages/a3m-vercel-ai/package.json +46 -0
  128. package/packages/a3m-vercel-ai/src/a3m-language-model.ts +381 -0
  129. package/packages/a3m-vercel-ai/src/index.ts +104 -0
  130. package/packages/a3m-vercel-ai/src/types.ts +116 -0
  131. package/packages/a3m-vercel-ai/tsconfig.json +20 -0
  132. package/packages/agentkit-adapter/LICENSE +21 -0
  133. package/packages/agentkit-adapter/README.md +126 -0
  134. package/packages/agentkit-adapter/examples/agentkit-example.ts +139 -0
  135. package/packages/agentkit-adapter/package.json +57 -0
  136. package/packages/agentkit-adapter/src/adapter.ts +381 -0
  137. package/packages/agentkit-adapter/src/index.ts +36 -0
  138. package/packages/agentkit-adapter/src/types.ts +105 -0
  139. package/packages/agentkit-adapter/src/util.ts +13 -0
  140. package/packages/agentkit-adapter/tsconfig.json +22 -0
  141. package/prometheus.yml +8 -0
  142. package/python/README.md +92 -65
  143. package/python/a3m/__init__.py +32 -3
  144. package/python/a3m/adapters/__init__.py +21 -0
  145. package/python/a3m/adapters/langchain.py +190 -0
  146. package/python/a3m/adapters/llamaindex.py +249 -0
  147. package/python/a3m/adapters/qdrant.py +240 -0
  148. package/python/a3m/adapters/weaviate.py +263 -0
  149. package/python/a3m/client.py +5 -0
  150. package/python/a3m_router.egg-info/PKG-INFO +172 -0
  151. package/python/a3m_router.egg-info/SOURCES.txt +17 -0
  152. package/python/a3m_router.egg-info/dependency_links.txt +1 -0
  153. package/python/a3m_router.egg-info/requires.txt +24 -0
  154. package/python/a3m_router.egg-info/top_level.txt +1 -0
  155. package/python/build_verify.sh +32 -0
  156. package/python/dist/a3m_router-2.2.1-py3-none-any.whl +0 -0
  157. package/python/dist/a3m_router-2.2.1.tar.gz +0 -0
  158. package/python/dist/a3m_router-2.2.2-py3-none-any.whl +0 -0
  159. package/python/dist/a3m_router-2.2.2.tar.gz +0 -0
  160. package/python/mcp-server/README.md +172 -0
  161. package/python/mcp-server/a3m_mcp/__init__.py +15 -0
  162. package/python/mcp-server/a3m_mcp/__main__.py +15 -0
  163. package/python/mcp-server/a3m_mcp/server.py +339 -0
  164. package/python/mcp-server/pyproject.toml +24 -0
  165. package/python/pyproject.toml +56 -5
  166. package/python/setup.py +3 -28
  167. package/src/providers/providerConfig.ts +1053 -1
  168. package/summary.txt +38 -0
  169. package/tsconfig.build.json +1 -2
  170. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -94
  171. package/.github/ISSUE_TEMPLATE/config.yml +0 -17
  172. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -71
  173. 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. Evaluated on RouterArena across 8,400 queries: 96.77% accuracy, $0.0768/1K average cost, 1.0000 robustness, zero abnormal entries. Open-source, MIT licensed, 19.5 KB gzipped, zero ML dependencies.
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
- ### RouterArena (ICLR 2025)
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
- Source: RouteWorks/RouterArena#144 (merged, premium-tier evaluation)
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
- | RouterArena premium tier | ICLR 2025 | Baseline merged | RouteWorks/RouterArena#144 |
32
- | RouterArena free tier | ICLR 2025 | Submitted | RouteWorks/RouterArena#152 |
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 = {RouterArena evaluated: 96.77% accuracy, $0.0768/1K, 1.0000 robustness}
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 (negative frequency-dependent selection)
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
- | Provider | Tier | Example Models |
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
- - `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
- ```
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 adaptive-memory-multi-model-router
109
- docker run -p 8787:8787 ghcr.io/das-rebel/a3m-router
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.4",
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": "./bin/cli.js",
8
- "a3m": "./bin/cli.js"
7
+ "a3m-router": "./dist/cli.js",
8
+ "a3m": "./dist/cli.js"
9
9
  },
10
10
  "scripts": {
11
- "start": "node bin/cli.js serve",
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"}