adaptive-memory-multi-model-router 2.1.1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/FUNDING.yml +2 -0
- package/.well-known/ai-plugin.json +16 -0
- package/CONTRIBUTING.md +21 -93
- package/README.md +401 -143
- package/SECURITY.md +14 -54
- package/articles/FRESH_devto.md +460 -0
- package/articles/FRESH_hackernews.md +14 -0
- package/articles/FRESH_reddit_ml.md +90 -0
- package/articles/FRESH_reddit_node.md +198 -0
- package/articles/FRESH_reddit_sideproject.md +72 -0
- package/articles/FRESH_reddit_webdev.md +130 -0
- package/docs/GEO.md +53 -111
- package/docs/index.html +63 -88
- package/docs/openapi.json +139 -0
- package/docs/robots.txt +37 -0
- package/docs/sitemap.xml +21 -0
- package/llms-full.txt +155 -0
- package/llms.txt +37 -71
- package/package.json +70 -27
package/llms.txt
CHANGED
|
@@ -1,85 +1,51 @@
|
|
|
1
1
|
# A3M Router
|
|
2
|
-
> LLM
|
|
2
|
+
> Intelligent LLM routing with adaptive memory — 99.5% ±1 tier accuracy, zero ML, zero GPU. OpenAI-compatible proxy across 36 providers with semantic cache, guardrails, and cost analytics.
|
|
3
3
|
|
|
4
|
-
##
|
|
5
|
-
|
|
6
|
-
-
|
|
7
|
-
|
|
8
|
-
- Only router besides RouteLLM with **published benchmarks**
|
|
9
|
-
- 200-query MMLU-based benchmark with 4-tier routing (free/cheap/mid/premium)
|
|
4
|
+
## Three Core Capabilities
|
|
5
|
+
1. **Adaptive Memory** — Learns from usage patterns. Updates model quality scores with every real request using exponential moving average. No retraining needed.
|
|
6
|
+
2. **Multi-Signal Routing** — 5-signal complexity scoring: domain detection (legal, medical, finance, security, architecture, ML), task indicators (code, math, creative, multilingual), query structure, action verb intensity, multi-step detection. All regex + keyword, zero ML.
|
|
7
|
+
3. **Production Protections** — Semantic cache (trigram Jaccard similarity), 17-pattern prompt injection detection, PII redaction, content filtering, hallucination checks, cost analytics with budget alerts, circuit breaker with auto-failover.
|
|
10
8
|
|
|
11
|
-
##
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
## What
|
|
17
|
-
A3M Router is an OpenAI-compatible proxy that analyzes each query and routes it to the cheapest capable LLM provider. Keyword-based routing achieves near-ML accuracy at a fraction of the cost. Zero config. Zero GPU.
|
|
9
|
+
## Benchmark
|
|
10
|
+
- 64.5% exact tier match, 99.5% ±1 tier accuracy (200 queries, 4 tiers)
|
|
11
|
+
- 61.6% cost savings vs premium-only routing
|
|
12
|
+
- RouteLLM-inspired methodology, self-benchmarked
|
|
18
13
|
|
|
19
14
|
## Install
|
|
20
15
|
```bash
|
|
21
|
-
npm install adaptive-memory-multi-model-router
|
|
22
|
-
|
|
16
|
+
npm install adaptive-memory-multi-model-router # TypeScript/Node
|
|
17
|
+
pip install a3m-router # Python
|
|
18
|
+
npx a3m-router serve # Proxy at localhost:8787
|
|
23
19
|
```
|
|
24
20
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
## Interfaces
|
|
22
|
+
- **TypeScript SDK:** `import { A3MRouter } from 'adaptive-memory-multi-model-router/sdk'`
|
|
23
|
+
- **Python SDK:** `from a3m import A3MRouter` (async) or `from a3m import A3MRouterSync`
|
|
24
|
+
- **CLI:** `npx a3m-router route/serve/benchmark/health/cost/compare`
|
|
25
|
+
- **Proxy:** OpenAI-compatible at `localhost:8787/v1`
|
|
26
|
+
- **REST API:** POST /v1/route, POST /v1/chat/completions, GET /v1/models, GET /health
|
|
27
|
+
- **LangChain:** `import { A3MChatModel } from 'adaptive-memory-multi-model-router/langchain'`
|
|
28
|
+
|
|
29
|
+
## 36 Providers by Tier
|
|
30
|
+
- **Free (6):** CommandCode, Ollama, LM Studio, vLLM, OpenCode, Google (free tier)
|
|
31
|
+
- **Cheap (15):** Groq, Cerebras, DeepInfra, Together, Fireworks, Novita, SambaNova, Anyscale, Replicate, OpenRouter, Zhipu (GLM), Moonshot (Kimi), Yi, Baichuan, MiniMax
|
|
32
|
+
- **Mid (9):** DeepSeek, Mistral, Perplexity, Cohere, AI21, Qwen, StepFun, AlephAlpha, Deepset
|
|
33
|
+
- **Premium (3):** OpenAI, Anthropic, xAI (Grok)
|
|
34
|
+
- **Enterprise (3):** Azure OpenAI, AWS Bedrock, Google Vertex
|
|
34
35
|
|
|
35
36
|
## Features
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
- Semantic cache
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
## Providers by Cost
|
|
47
|
-
- FREE: CommandCode, Ollama, LM Studio, vLLM
|
|
48
|
-
- $0.59-0.60/1M tokens: Groq, Cerebras
|
|
49
|
-
- $1.50-2.80/1M tokens: DeepSeek, MiniMax, Mistral, Qwen, GLM-4
|
|
50
|
-
- $10-30/1M tokens: Google, Anthropic, OpenAI
|
|
51
|
-
|
|
52
|
-
## API
|
|
53
|
-
```javascript
|
|
54
|
-
const { createA3MRouter } = require('adaptive-memory-multi-model-router');
|
|
55
|
-
const router = createA3MRouter();
|
|
56
|
-
const result = await router.route("Your query");
|
|
57
|
-
console.log(result.primary_model); // "groq/llama-3.3-70b"
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## CLI
|
|
61
|
-
```bash
|
|
62
|
-
npx a3m-router serve # Start OpenAI-compatible proxy on :8787
|
|
63
|
-
npx a3m-router route "query" # Route a single query
|
|
64
|
-
npx a3m-router benchmark # Benchmark all providers
|
|
65
|
-
npx a3m-router providers # List configured providers
|
|
66
|
-
npx a3m-router status # Show router status
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Use Cases
|
|
70
|
-
- Reduce OpenAI API costs by 50-80%
|
|
71
|
-
- LLM routing without GPU
|
|
72
|
-
- Drop-in OpenAI proxy with cost optimization
|
|
73
|
-
- Route between local (Ollama) and cloud models
|
|
74
|
-
- Build multi-provider AI applications
|
|
75
|
-
- Add guardrails and caching to existing LLM setups
|
|
76
|
-
|
|
77
|
-
## Competitive Positioning
|
|
78
|
-
- vs RouteLLM: Matches accuracy within 2.5%, no GPU needed, includes proxy+cache+guardrails
|
|
79
|
-
- vs LiteLLM: Published benchmarks, zero-config, built-in semantic cache
|
|
80
|
-
- vs OpenRouter: Self-hosted, no middleman fees, open source
|
|
37
|
+
- Multi-signal routing with 5 weighted signals (domain, task, structure, verbs, specificity)
|
|
38
|
+
- Online learning via exponential moving average on model quality scores
|
|
39
|
+
- Semantic cache using character trigram Jaccard similarity (no vector DB, no embeddings)
|
|
40
|
+
- Guardrails: 17-pattern injection detection, PII detection/redaction (email, phone, SSN, CC, API keys, IP), content filtering, hallucination heuristics
|
|
41
|
+
- Cost analytics: per-provider spend tracking, budget alerts (daily/monthly/per-model), savings vs GPT-4o baseline
|
|
42
|
+
- Circuit breaker: 3 failures → 60s cooldown, automatic provider failover
|
|
43
|
+
- OpenAI-compatible proxy auto-detects provider format (OpenAI, Anthropic, Google, Ollama)
|
|
44
|
+
- LangChain adapter (A3MChatModel drop-in for ChatOpenAI)
|
|
45
|
+
- Streaming support (SSE relay)
|
|
46
|
+
- Obsidian vault integration for decision logging
|
|
81
47
|
|
|
82
48
|
## Links
|
|
83
49
|
- GitHub: https://github.com/Das-rebel/adaptive-memory-multi-model-router
|
|
84
|
-
-
|
|
50
|
+
- npm: https://www.npmjs.org/package/adaptive-memory-multi-model-router
|
|
85
51
|
- License: MIT
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adaptive-memory-multi-model-router",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"shortName": "A3M Router",
|
|
5
5
|
"displayName": "A3M Router - Adaptive Memory Multi-Model Router",
|
|
6
|
-
"description": "99.5% ±1 tier routing accuracy
|
|
6
|
+
"description": "LLM router & AI gateway — 4,200+ npm downloads, 99.5% ±1 tier routing accuracy. Multi-signal classification (domain, complexity, verbs), 36 providers, semantic cache, guardrails, cost analytics. TypeScript SDK + Python SDK + CLI + REST API + OpenAI proxy.",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"bin": {
|
|
9
9
|
"a3m-router": "dist/cli.js",
|
|
@@ -53,35 +53,71 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"keywords": [
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"openai-proxy",
|
|
60
|
-
"cost-optimization",
|
|
56
|
+
"ai",
|
|
57
|
+
"ai-agent",
|
|
58
|
+
"ai-cost-optimization",
|
|
61
59
|
"ai-gateway",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"multi-provider",
|
|
68
|
-
"openai-compatible",
|
|
69
|
-
"llm-proxy",
|
|
70
|
-
"llm-orchestration",
|
|
71
|
-
"groq",
|
|
72
|
-
"cerebras",
|
|
73
|
-
"mistral",
|
|
74
|
-
"deepseek",
|
|
60
|
+
"ai-guardrails",
|
|
61
|
+
"ai-load-balancer",
|
|
62
|
+
"ai-proxy",
|
|
63
|
+
"ai-router",
|
|
64
|
+
"ai-sdk",
|
|
75
65
|
"anthropic",
|
|
66
|
+
"anthropic-proxy",
|
|
76
67
|
"benchmark",
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
68
|
+
"cerebras",
|
|
69
|
+
"cerebras-proxy",
|
|
70
|
+
"chatbot",
|
|
71
|
+
"chatgpt",
|
|
72
|
+
"claude",
|
|
73
|
+
"claude-proxy",
|
|
74
|
+
"cost-optimization",
|
|
75
|
+
"deepseek",
|
|
76
|
+
"deepseek-proxy",
|
|
77
|
+
"domain-routing",
|
|
78
|
+
"gpt",
|
|
79
|
+
"groq",
|
|
80
|
+
"groq-proxy",
|
|
81
|
+
"guardrails",
|
|
82
|
+
"helicone",
|
|
80
83
|
"keyword-routing",
|
|
81
|
-
"
|
|
84
|
+
"langchain",
|
|
85
|
+
"language-model",
|
|
86
|
+
"lightweight",
|
|
87
|
+
"litellm-alternative",
|
|
82
88
|
"llm",
|
|
89
|
+
"llm-gateway",
|
|
90
|
+
"llm-load-balancer",
|
|
91
|
+
"llm-manager",
|
|
92
|
+
"llm-orchestration",
|
|
93
|
+
"llm-proxy",
|
|
94
|
+
"llm-router",
|
|
95
|
+
"llm-routing",
|
|
96
|
+
"mistral",
|
|
97
|
+
"mistral-proxy",
|
|
98
|
+
"model-router",
|
|
99
|
+
"model-routing",
|
|
100
|
+
"multi-llm",
|
|
101
|
+
"multi-provider",
|
|
83
102
|
"nlp",
|
|
84
|
-
"
|
|
103
|
+
"no-gpu",
|
|
104
|
+
"ollama",
|
|
105
|
+
"ollama-proxy",
|
|
106
|
+
"openai",
|
|
107
|
+
"openai-api",
|
|
108
|
+
"openai-compatible",
|
|
109
|
+
"openai-proxy",
|
|
110
|
+
"openai-sdk",
|
|
111
|
+
"openrouter",
|
|
112
|
+
"portkey-alternative",
|
|
113
|
+
"provider-fallback",
|
|
114
|
+
"query-routing",
|
|
115
|
+
"routellm-alternative",
|
|
116
|
+
"routing-accuracy",
|
|
117
|
+
"semantic-cache",
|
|
118
|
+
"smart-routing",
|
|
119
|
+
"token-counter",
|
|
120
|
+
"vercel-ai"
|
|
85
121
|
],
|
|
86
122
|
"author": "Das-rebel <subho@example.com>",
|
|
87
123
|
"license": "MIT",
|
|
@@ -116,5 +152,12 @@
|
|
|
116
152
|
"devDependencies": {
|
|
117
153
|
"@types/node": "^25.8.0",
|
|
118
154
|
"typescript": "^6.0.3"
|
|
119
|
-
}
|
|
120
|
-
|
|
155
|
+
},
|
|
156
|
+
"changelog": [
|
|
157
|
+
{
|
|
158
|
+
"version": "2.2.1",
|
|
159
|
+
"date": "2026-05-19",
|
|
160
|
+
"note": "4,200+ downloads milestone. Updated description with download count."
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
}
|