adaptive-memory-multi-model-router 2.4.0 β 2.4.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/README.md +49 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
[π¨π³ δΈζ](./README_zh.md) Β· [π―π΅ ζ₯ζ¬θͺ](./README_ja.md) Β· [English](./README.md)
|
|
2
2
|
|
|
3
|
-
# A3M Router
|
|
3
|
+
# A3M Router
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/adaptive-memory-multi-model-router)
|
|
6
6
|
[](https://www.npmjs.com/package/adaptive-memory-multi-model-router)
|
|
7
|
-
[](https://github.com/Das-rebel/adaptive-memory-multi-model-router)
|
|
8
|
-
[](LICENSE)
|
|
9
7
|
[](test.js)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://github.com/Das-rebel/adaptive-memory-multi-model-router)
|
|
10
|
+
[](https://discord.gg/a3m-router)
|
|
11
|
+
[](docs/API.md)
|
|
12
|
+
|
|
13
|
+
[Documentation](docs/API.md) Β· [GitHub](https://github.com/Das-rebel/adaptive-memory-multi-model-router) Β· [npm](https://www.npmjs.com/package/adaptive-memory-multi-model-router)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## What is A3M Router?
|
|
18
|
+
|
|
19
|
+
**Intelligent LLM routing with adaptive memory** β routes every query to the cheapest capable model across 36+ providers. 99.5% Β±1 tier accuracy. Zero ML weights. Zero GPU. Starts in <100ms.
|
|
10
20
|
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
> OpenAI-compatible proxy. Routes to cheapest capable model across 36+ providers.
|
|
14
|
-
> Adaptive memory learns from usage. Built-in cache, guardrails, cost analytics.
|
|
21
|
+
A3M Router is an OpenAI-compatible proxy that uses multi-signal heuristic routing to classify query complexity and automatically select the most cost-effective provider.
|
|
15
22
|
|
|
16
23
|
## Install
|
|
17
24
|
|
|
@@ -21,19 +28,6 @@ pip install a3m-router # Python
|
|
|
21
28
|
npx a3m-router serve # Start proxy: localhost:8787
|
|
22
29
|
```
|
|
23
30
|
|
|
24
|
-
## How It Works
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
Query β Guardrails (<1ms) β Cache (<1ms) β Classify (2ms) β Route
|
|
28
|
-
β
|
|
29
|
-
βββββββββββββββββΌββββββββββββββββ
|
|
30
|
-
βΌ βΌ βΌ
|
|
31
|
-
FREE CHEAP PREMIUM
|
|
32
|
-
Groq, etc. Llama, Mistral GPT-4o, Claude
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**Routing signals:** Domain (legal, medical, code) + Task type + Query structure β Tier β Cheapest available
|
|
36
|
-
|
|
37
31
|
## Quick Start
|
|
38
32
|
|
|
39
33
|
### TypeScript
|
|
@@ -68,9 +62,9 @@ async with A3MRouter() as router:
|
|
|
68
62
|
### CLI
|
|
69
63
|
|
|
70
64
|
```bash
|
|
71
|
-
npx a3m-router route "Explain quantum computing"
|
|
65
|
+
npx a3m-router route "Explain quantum computing" # Get routing decision
|
|
72
66
|
npx a3m-router serve --port 8787 # Start proxy
|
|
73
|
-
npx a3m-router benchmark
|
|
67
|
+
npx a3m-router benchmark # Run accuracy test
|
|
74
68
|
```
|
|
75
69
|
|
|
76
70
|
### REST API
|
|
@@ -81,16 +75,30 @@ curl http://localhost:8787/v1/chat/completions \
|
|
|
81
75
|
-d '{"model": "auto", "messages": [{"role": "user", "content": "Hi"}]}'
|
|
82
76
|
```
|
|
83
77
|
|
|
78
|
+
## How It Works
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Query β Guardrails (<1ms) β Cache (<1ms) β Classify (2ms) β Route
|
|
82
|
+
β
|
|
83
|
+
βββββββββββββββββΌββββββββββββββββ
|
|
84
|
+
βΌ βΌ βΌ
|
|
85
|
+
FREE CHEAP PREMIUM
|
|
86
|
+
Groq, etc. Llama, Mistral GPT-4o, Claude
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Routing signals:** Domain + Task type + Query structure β Tier β Cheapest available
|
|
90
|
+
|
|
84
91
|
## Features
|
|
85
92
|
|
|
86
|
-
|
|
|
87
|
-
|
|
88
|
-
| **
|
|
89
|
-
| **
|
|
90
|
-
| **
|
|
91
|
-
| **
|
|
92
|
-
| **
|
|
93
|
-
| **
|
|
93
|
+
| | |
|
|
94
|
+
|---|---|
|
|
95
|
+
| **Adaptive Memory** | Learns from usage. EMA quality scoring. No retraining. |
|
|
96
|
+
| **Multi-Signal Routing** | 12 signals across 5 dimensions. Zero ML weights. |
|
|
97
|
+
| **Semantic Cache** | Trigram Jaccard similarity. 30% hit rate. |
|
|
98
|
+
| **Guardrails** | 17-pattern injection detection. PII redaction. |
|
|
99
|
+
| **Circuit Breaker** | 3 failures β 60s cooldown. Auto failover. |
|
|
100
|
+
| **Cost Analytics** | Per-provider spend. Budget alerts. Savings tracking. |
|
|
101
|
+
| **OpenAI-Compatible** | Drop-in for any OpenAI SDK. |
|
|
94
102
|
|
|
95
103
|
## Benchmark
|
|
96
104
|
|
|
@@ -109,21 +117,21 @@ Run: `node scripts/routing-benchmark-v2.js`
|
|
|
109
117
|
|
|
110
118
|
| Tier | Score | Examples |
|
|
111
119
|
|------|-------|----------|
|
|
112
|
-
| **FREE** | <0.20 | Groq (LLaMA 3.3 70B), DeepSeek Chat |
|
|
113
|
-
| **CHEAP** | 0.20-0.45 | Mistral 7B, Qwen 2.5, Yi Large |
|
|
114
|
-
| **MID** | 0.45-0.65 | Claude 3 Haiku, GPT-4o-mini |
|
|
115
|
-
| **PREMIUM** | >0.65 | Claude 3.5 Sonnet, GPT-4o |
|
|
120
|
+
| **FREE** | <0.20 | Groq (LLaMA 3.3 70B), DeepSeek Chat, Fireworks |
|
|
121
|
+
| **CHEAP** | 0.20-0.45 | Mistral 7B, Qwen 2.5, Yi Large, DeepSeek Coder |
|
|
122
|
+
| **MID** | 0.45-0.65 | Claude 3 Haiku, GPT-4o-mini, Gemini Pro |
|
|
123
|
+
| **PREMIUM** | >0.65 | Claude 3.5 Sonnet, GPT-4o, Gemini Ultra |
|
|
116
124
|
|
|
117
|
-
**Chinese:** Kimi (Moonshot), Zhipu GLM, Qwen, Yi, Baichuan, StepFun
|
|
125
|
+
**Chinese providers:** Kimi (Moonshot), Zhipu GLM, Qwen, Yi, Baichuan, StepFun
|
|
118
126
|
|
|
119
127
|
## Comparison
|
|
120
128
|
|
|
121
129
|
| | A3M Router | LiteLLM | Portkey |
|
|
122
130
|
|--|:--:|:--:|:--:|
|
|
123
131
|
| Auto Routing | β | Manual | Manual |
|
|
124
|
-
| Semantic Cache | β 30% |
|
|
125
|
-
| Guardrails | β 17 patterns |
|
|
126
|
-
| Circuit Breaker | β |
|
|
132
|
+
| Semantic Cache | β 30% | β | Limited |
|
|
133
|
+
| Guardrails | β 17 patterns | β | Limited |
|
|
134
|
+
| Circuit Breaker | β | β | β |
|
|
127
135
|
| Package Size | 19.5 KB | ~50 MB | ~30 MB |
|
|
128
136
|
| Startup | <100ms | ~500ms | ~300ms |
|
|
129
137
|
|
|
@@ -136,9 +144,9 @@ Run: `node scripts/routing-benchmark-v2.js`
|
|
|
136
144
|
|
|
137
145
|
## Links
|
|
138
146
|
|
|
139
|
-
- [
|
|
140
|
-
- [
|
|
141
|
-
- [
|
|
147
|
+
- [Documentation](docs/API.md)
|
|
148
|
+
- [npm package](https://www.npmjs.com/package/adaptive-memory-multi-model-router)
|
|
149
|
+
- [GitHub repo](https://github.com/Das-rebel/adaptive-memory-multi-model-router)
|
|
142
150
|
- [Contributing](CONTRIBUTING.md)
|
|
143
151
|
|
|
144
152
|
MIT License. `npm install` and go.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adaptive-memory-multi-model-router",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"shortName": "A3M Router",
|
|
5
5
|
"displayName": "A3M Router - Adaptive Memory Multi-Model Router",
|
|
6
6
|
"description": "LLM router & AI gateway with 99.5% routing accuracy β supports 47 providers including DeepSeek, Kimi (Moonshot), Qwen, Zhipu GLM, Yi, Baichuan, MiniMax, StepFun. Zero ML, 19.5KB. Multi-signal routing, semantic cache, guardrails, cost analytics. MIT. TypeScript SDK + Python SDK + OpenAI proxy.",
|