adaptive-memory-multi-model-router 2.2.0 → 2.2.2

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/llms.txt CHANGED
@@ -1,85 +1,51 @@
1
1
  # A3M Router
2
- > LLM router with 82.5% routing accuracy without ML matches RouteLLM BERT within 2.5%. 30x more efficient than GPU-based routing. Drop-in OpenAI proxy, 39 providers.
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
- ## Benchmark Results
5
- - **82.5% adjacent routing accuracy** without ML or GPU
6
- - Matches RouteLLM BERT within **2.5 percentage points** (85% vs 82.5%)
7
- - **30x more efficient** than GPU-based routing (no model weights, no training, no GPU)
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
- ## Growth & Adoption
12
- - **2,775 downloads in 3 days**
13
- - **245% growth**, zero marketing budget
14
- - 39 providers (OpenAI, Anthropic, Groq, Cerebras, DeepSeek, Mistral, Ollama, etc.)
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
- npx a3m-router serve
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
- ## Key Metrics
26
- | Metric | Value |
27
- |--------|-------|
28
- | Routing accuracy (adjacent) | 82.5% |
29
- | Gap to RouteLLM BERT | 2.5% |
30
- | Efficiency vs GPU routing | 30x |
31
- | Cost savings vs premium-only | 50-80% |
32
- | Providers | 39 |
33
- | Downloads (3 days) | 2,775 |
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
- - OpenAI-compatible proxy (drop-in for any SDK)
37
- - Keyword-based routing with near-ML accuracy
38
- - Semantic cache (trigram Jaccard similarity)
39
- - Security guardrails (PII, prompt injection, content filter)
40
- - Real-time cost analytics dashboard
41
- - LangChain adapter (A3MChatModel)
42
- - Circuit breaker with automatic fallback
43
- - Batch processing with rate limiting
44
- - 39 providers from free to premium
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
- - NPM: https://www.npmjs.com/package/adaptive-memory-multi-model-router
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.2.0",
3
+ "version": "2.2.2",
4
4
  "shortName": "A3M Router",
5
5
  "displayName": "A3M Router - Adaptive Memory Multi-Model Router",
6
- "description": "LLM router & AI gateway with OpenAI-compatible proxy. 99.5% routing accuracy, 40 providers (Groq, Cerebras, Ollama, DeepSeek, Mistral). Semantic cache, guardrails, cost optimization. Drop-in for LangChain, Vercel AI SDK.",
6
+ "description": "LLM router & AI gateway 99.5% routing accuracy, 47 Chinese LLM providers (DeepSeek, Kimi, Zhipu, Qwen, Yi, Baichuan, MiniMax). Multi-signal routing, semantic cache, guardrails, cost analytics. TypeScript SDK + Python SDK + CLI + OpenAI proxy.",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
9
9
  "a3m-router": "dist/cli.js",
@@ -53,71 +53,89 @@
53
53
  }
54
54
  },
55
55
  "keywords": [
56
+ "llm-proxy",
57
+ "claude",
56
58
  "ai",
57
- "ai-agent",
58
- "ai-cost-optimization",
59
- "ai-gateway",
60
- "ai-guardrails",
61
- "ai-load-balancer",
62
- "ai-proxy",
63
- "ai-router",
64
- "ai-sdk",
65
- "anthropic",
66
- "anthropic-proxy",
67
- "benchmark",
59
+ "openai-compatible",
60
+ "no-gpu",
61
+ "openai",
62
+ "routing-accuracy",
63
+ "minimax",
64
+ "portkey-alternative",
65
+ "中文llm",
66
+ "provider-fallback",
67
+ "nlp",
68
+ "ollama",
68
69
  "cerebras",
70
+ "openai-sdk",
71
+ "ai-sdk",
72
+ "openai-proxy",
69
73
  "cerebras-proxy",
70
- "chatbot",
71
- "chatgpt",
72
- "claude",
73
- "claude-proxy",
74
- "cost-optimization",
74
+ "深度求索",
75
+ "anthropic",
76
+ "ai-cost-optimization",
77
+ "model-router",
78
+ "model-routing",
79
+ "chinese-ai",
80
+ "vercel-ai",
81
+ "ai-load-balancer",
75
82
  "deepseek",
76
- "deepseek-proxy",
77
- "domain-routing",
78
- "gpt",
79
- "groq",
80
- "groq-proxy",
81
- "guardrails",
82
- "helicone",
83
+ "llm-routing",
84
+ "mistral",
85
+ "ollama-proxy",
86
+ "moonshot",
87
+ "stepfun",
88
+ "cost-optimization",
83
89
  "keyword-routing",
84
- "langchain",
85
- "language-model",
86
- "lightweight",
87
- "litellm-alternative",
90
+ "zhipu",
91
+ "llm-manager",
92
+ "ai-router",
93
+ "multi-provider",
94
+ "yi-llm",
95
+ "chinese-llm",
96
+ "glms",
88
97
  "llm",
89
- "llm-gateway",
90
98
  "llm-load-balancer",
91
- "llm-manager",
92
- "llm-orchestration",
93
- "llm-proxy",
94
- "llm-router",
95
- "llm-routing",
96
- "mistral",
99
+ "language-model",
100
+ "claude-proxy",
101
+ "lightweight",
102
+ "chatgpt",
103
+ "smart-routing",
104
+ "阿里qwen",
105
+ "zh-llm",
106
+ "中文ai",
107
+ "benchmark",
108
+ "helicone",
97
109
  "mistral-proxy",
98
- "model-router",
99
- "model-routing",
110
+ "llm-orchestration",
111
+ "openrouter",
112
+ "kimi",
113
+ "moonshot-kimi",
114
+ "guardrails",
115
+ "ai-agent",
116
+ "baichuan",
117
+ "routellm-alternative",
118
+ "anthropic-proxy",
119
+ "token-counter",
120
+ "deepseek-proxy",
121
+ "llm-gateway",
100
122
  "multi-llm",
101
- "multi-provider",
102
- "nlp",
103
- "no-gpu",
104
- "ollama",
105
- "ollama-proxy",
106
- "openai",
123
+ "ai-gateway",
124
+ "groq",
125
+ "litellm-alternative",
126
+ "ai-proxy",
127
+ "llm-router",
128
+ "domain-routing",
129
+ "groq-proxy",
130
+ "qwen",
131
+ "gpt",
107
132
  "openai-api",
108
- "openai-compatible",
109
- "openai-proxy",
110
- "openai-sdk",
111
- "openrouter",
112
- "portkey-alternative",
113
- "provider-fallback",
114
133
  "query-routing",
115
- "routellm-alternative",
116
- "routing-accuracy",
134
+ "aleph-alpha",
117
135
  "semantic-cache",
118
- "smart-routing",
119
- "token-counter",
120
- "vercel-ai"
136
+ "langchain",
137
+ "ai-guardrails",
138
+ "chatbot"
121
139
  ],
122
140
  "author": "Das-rebel <subho@example.com>",
123
141
  "license": "MIT",
@@ -153,4 +171,4 @@
153
171
  "@types/node": "^25.8.0",
154
172
  "typescript": "^6.0.3"
155
173
  }
156
- }
174
+ }