adaptive-memory-multi-model-router 2.13.12 → 2.13.14

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,51 +1,54 @@
1
- # A3M Router
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.
1
+ # A3M Router — AI-Gateway & LLM Router
3
2
 
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.
3
+ ## One sentence
4
+ Open-source LLM router with parallel multi-LLM execution, 47+ providers, 99.5% routing accuracy, 62% cost savings. 19.5 KB, zero ML dependencies.
8
5
 
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
6
+ ## Core features
7
+ - Parallel multi-LLM execution (unique, no competitor does this)
8
+ - RouteLLM-style routing: 12 signals difficulty tier → cheapest capable model
9
+ - 47+ providers: OpenAI, Anthropic, Groq, DeepSeek, NVIDIA, Together, OpenRouter, Gemini, Mistral, Cohere, and more
10
+ - Semantic cache (30%+ hit rate)
11
+ - Budget enforcement with per-query cost tracking
12
+ - Circuit breaker with auto failover
13
+ - Prompt injection guardrails (17 patterns)
14
+ - Persistent episodic memory (JSON file, auto-save)
15
+ - Query-type presets: fast, creative, deep thinking, code
13
16
 
14
- ## Install
17
+ ## Quick start
15
18
  ```bash
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
19
+ npm install adaptive-memory-multi-model-router
20
+ npx a3m-router route "Write a Python sort function"
21
+ npx a3m-router serve # OpenAI-compatible proxy at :8787
19
22
  ```
20
23
 
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
35
-
36
- ## Features
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
47
-
48
- ## Links
49
- - GitHub: https://github.com/Das-rebel/a3m-router
50
- - npm: https://www.npmjs.org/package/adaptive-memory-multi-model-router
51
- - License: MIT
24
+ ## Key files
25
+ - `src/index.ts` Main entry, all exports
26
+ - `src/routing/ensembleVoting.ts` P0: Parallel ensemble voting
27
+ - `src/routing/queryTypePresets.ts` — P1: Query-type presets
28
+ - `src/memory/episodicMemory.ts` P3: Persistent memory
29
+ - `src/providers/providerConfig.ts` 47 provider configurations
30
+ - `src/routing/advancedRouter.ts` RouteLLM-style routing with 12 signals
31
+ - `docs/BENCHMARK.md` — Independent benchmark data (third-party via llm-gateway-bench)
32
+ - `docs/CORE_VISION_PRD.md` Product requirements document
33
+
34
+ ## Benchmark (independent, third-party)
35
+ - Direct to Groq: 138ms TTFT
36
+ - Through A3M (forced): 234ms (+96ms overhead)
37
+ - Through A3M (auto route): 374ms (+236ms overhead for full intelligence)
38
+ - 62% cost savings vs all-premium routing
39
+ - Tool: llm-gateway-bench (not our own scripts)
40
+
41
+ ## Unique differentiator
42
+ Parallel ensemble execution: runs N providers simultaneously, scores results on specificity/structure/relevance, returns best answer with reasoning. No other router (litellm, one-api, LibreChat, gpt-researcher) does this.
43
+
44
+ ## Competitive landscape
45
+ - litellm (48K★): Sequential fallback only, Python-only
46
+ - one-api (34K★): API key management, Chinese-focused
47
+ - LibreChat (20K★): UI-focused, single-provider
48
+ - gpt-researcher (20K★): Deep research, single-provider per query
49
+ - A3M Router: Parallel ensemble + confidence scoring (unique)
50
+
51
+ ## Growth
52
+ - 10,024 npm downloads in 14 days
53
+ - 72 versions published
54
+ - Zero marketing budget
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "adaptive-memory-multi-model-router",
3
- "version": "2.13.12",
3
+ "version": "2.13.14",
4
4
  "shortName": "A3M Router",
5
5
  "displayName": "A3M Router - Adaptive Memory Multi-Model Router",
6
- "description": "🔥 Fastest-growing npm LLM router — 0 to 10,024 downloads in 14 days. Parallel multi-LLM execution with independent benchmark validation (138ms baseline, +96ms proxy overhead), 47+ providers, 99.5% routing accuracy, 62% cost savings. Open-source AI gateway. Parallel ensemble, confidence scoring, query-type presets, persistent memory. Zero ML, 19.5KB. MIT.",
6
+ "description": "🔥 Fastest-growing npm LLM router — 0 to 10K downloads in 14 days. Parallel multi-LLM execution with independent benchmark validation (138ms baseline, +96ms proxy overhead), 47+ providers, 99.5% routing accuracy, 62% cost savings. Open-source AI gateway with ensemble voting, semantic cache, budget enforcement. 19.5 KB, zero ML.",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
9
9
  "a3m-router": "dist/cli.js",
@@ -55,540 +55,46 @@
55
55
  }
56
56
  },
57
57
  "keywords": [
58
- "01-ai",
59
- "12-signal-routing",
60
- "3-failure-trigger",
61
- "429-handling",
62
- "60-second-cooldown",
63
- "62-percent-cost-savings",
64
- "99-accuracy",
65
- "a3m",
66
- "a3m-router",
67
- "adaptive",
68
- "adaptive-router",
69
- "adaptive-routing",
70
- "affordable-ai",
71
- "agent",
72
- "agent-codegen",
73
- "agent-discoverable",
74
- "agent-framework",
75
- "agent-memory",
76
- "ai",
77
- "ai-agent",
78
- "ai-agent-tools",
79
- "ai-agents",
80
- "ai-assistant",
81
- "ai-coding",
82
- "ai-discoverability",
58
+ "llm-router",
83
59
  "ai-gateway",
84
- "ai-gateway-cn",
85
- "ai-guardrails",
86
- "ai-load-balancer",
87
- "ai-native",
88
- "ai-orchestration",
89
- "ai-proxy",
90
- "ai-router",
91
- "ai-routing",
92
- "ai-sdk",
93
- "ai21",
94
- "aleph-alpha",
95
- "alerting",
96
- "aliyun",
97
- "anthropic",
98
- "anthropic-mcp",
99
- "anthropic-proxy",
100
- "anthropic-relay",
101
- "api-aggregator",
102
- "api-budget",
103
- "api-cost",
104
- "api-cost-reduction",
105
- "api-forwarder",
106
- "api-gateway",
107
- "api-management",
108
- "api-middleware",
109
- "api-proxy",
110
- "api-relay",
111
- "auto-recovery",
112
- "autogen",
113
- "automatic-failover",
114
- "automation",
115
- "autonomous-agents",
116
- "aws",
117
- "aws-bedrock",
118
- "azure",
119
- "azure-openai",
120
- "backoff",
121
- "baichuan",
122
- "baiducloud",
123
- "batch-processing",
124
- "batching",
125
- "benchmark",
126
- "budget-alerts",
127
- "budget-cap",
128
- "budget-dashboard",
129
- "budget-friendly",
130
- "cache",
131
- "cache-hit-rate",
132
- "cache-ttl",
133
- "caching",
134
- "cerebras",
135
- "chatbot",
136
- "chatgpt",
137
- "cheaper-llm",
138
- "chinese-ai",
139
- "chinese-ai-proxy",
140
- "chinese-api",
141
- "chinese-api-retry",
142
- "chinese-chatgpt",
143
- "chinese-gateway",
144
- "chinese-llm",
145
- "chinese-llm-proxy",
146
- "chinese-model",
147
- "chinese-models",
148
- "chinese-nlp",
149
- "chinesellm",
150
- "chinesellm-routing",
151
- "circuit-breaker",
152
- "classification",
153
- "claude",
154
- "claude-code",
155
- "claude-proxy",
156
- "cli",
157
- "client",
158
- "cloud",
159
- "cloud-native",
160
- "cluster-llm",
161
- "code-generation",
162
- "cohere",
163
- "complexity-scoring",
164
- "content-filtering",
165
- "content-routing",
166
- "context-cache",
167
- "context-caching",
168
- "context-management",
169
- "contextual-router",
170
- "conversational-ai",
171
- "cooldown",
172
- "copilot",
173
- "cosine-similarity",
174
- "cost-analytics",
175
- "cost-attribution",
176
- "cost-based-routing",
177
- "cost-cap",
178
- "cost-control",
179
- "cost-effective-llm",
180
- "cost-estimation",
181
- "cost-management",
182
- "cost-optimization",
183
- "cost-prediction",
184
- "cost-reduction",
185
- "cost-saving",
186
- "cost-tracking",
187
- "crewai",
188
- "data-security",
189
- "datadog",
190
- "deadline",
191
- "deepinfra",
192
- "deepseek",
193
- "deepseek-ai",
194
- "deepseek-api",
195
- "deepseek-chat",
196
- "deepseek-coder",
197
- "deepseek-proxy",
198
- "deepseek-reasoner",
199
- "deepseek-v3",
200
- "developer-tools",
201
- "devops",
202
- "distributed-llm",
203
- "docker",
204
- "domain-detection",
205
- "domain-routing",
206
- "dx",
207
- "dynamic-routing",
208
- "edge-computing",
209
- "embed-text",
210
- "embedding",
211
- "embedding-cache",
212
- "embedding-model",
213
- "enterprise",
214
- "enterprise-ready",
215
- "episodic-memory",
216
- "expense-management",
217
- "extraction",
218
- "failover",
219
- "fallback",
220
- "fallback-chain",
221
- "fast-llm",
222
- "fault-tolerance",
223
- "fine-tuning",
224
- "fireworks",
225
- "gateway",
226
- "gateway-proxy",
227
- "gcp",
228
- "gdpr-llm",
229
- "gemini",
230
- "gemma",
231
- "geo",
232
- "glm-4",
233
- "glm-4v",
234
- "glm-api",
235
- "glms",
236
- "google",
237
- "google-calendar",
238
- "gpt",
239
- "gpt-4",
240
- "grafana",
241
- "graphql",
242
- "groq",
243
- "groq-api",
244
- "groq-llama",
245
- "groq-mixtral",
246
- "groq-proxy",
247
- "guardrails",
248
- "ha-cluster",
249
- "halo",
250
- "health-check",
251
- "health-scoring",
252
- "helicone",
253
- "high-availability",
254
- "high-throughput",
255
- "hipaa",
256
- "http-proxy",
257
- "huawei-cloud",
258
- "iclr",
259
- "inference",
260
- "inference-cost",
261
- "input-validation",
262
- "intelligent-router",
263
- "intent-detection",
264
- "intent-mapping",
265
- "intent-routing",
266
- "intercom",
267
- "jaeger",
268
- "javascript",
269
- "jitter",
270
- "json-api",
271
- "keyword-routing",
272
- "kimi",
273
- "kimi-api",
274
- "langchain",
275
- "langchain-cn",
276
- "langchain-gateway",
277
- "langfuse",
278
- "language-model",
279
- "latency-benchmark",
280
- "learning-router",
281
- "learns-from-history",
282
- "lightweight",
283
- "lingyi",
284
- "lingyi-wanwu",
285
- "llama",
286
- "llama-3",
287
- "llama-3.1",
288
- "llama-3.3",
289
- "llama-api",
290
- "llama-proxy",
291
- "llamaindex",
292
- "llamaindex-cn",
293
- "llamaindex-gateway",
294
- "llm",
295
- "llm-caching",
296
- "llm-cluster",
297
- "llm-comparison",
298
- "llm-cost",
299
- "llm-evaluation",
300
- "llm-failover",
301
60
  "llm-gateway",
302
- "llm-gateway-cn",
303
- "llm-intent",
304
- "llm-load-balancer",
305
- "llm-management",
306
- "llm-manager",
307
- "llm-memory-router",
308
- "llm-middleware",
309
- "llm-orchestration",
310
- "llm-pricing",
311
- "llm-proxy",
312
- "llm-relay",
313
- "llm-router",
314
- "llm-routing",
315
- "llm-tools",
316
- "llmlingua",
317
- "lmstudio",
318
- "load-balancer",
319
- "load-balancing",
320
- "local-llm",
321
- "local-model",
322
- "logging",
323
- "long-context-model",
324
- "low-cost-llm",
325
- "low-latency",
326
- "machine-learning",
327
- "max-retries",
328
- "mcp",
329
- "mcp-gateway",
330
- "mcts",
331
- "mcts-workflow",
332
- "memory",
333
- "memory-augmented",
334
- "memory-based",
335
- "memory-tree",
336
- "message-truncation",
337
- "metrics",
338
- "metrics-api",
339
- "metrics-collector",
340
- "metrics-endpoint",
341
- "microservices",
342
- "middleware",
343
- "minimax",
344
- "minimax-abab",
345
- "minimax-ai",
346
- "minimax-api",
347
- "minimax-chat",
348
- "minimax-turbo",
349
- "mistral",
350
- "mistral-7b",
351
- "mistral-api",
352
- "mistral-proxy",
353
- "model-comparison",
354
- "model-management",
355
- "model-picker",
356
- "model-router",
357
- "model-routing",
358
- "model-selection",
359
- "model-selector",
360
- "monitoring",
361
- "monte-carlo",
362
- "monthly-budget",
363
- "moonshot",
364
- "moonshot-ai",
365
- "moonshot-api",
366
- "moonshot-kimi",
367
- "moonshot-v1",
368
- "moonshot-v1-128k",
369
- "moonshot-v1-32k",
370
- "moonshot-v1-8k",
371
- "multi-agent",
372
- "multi-agent-debate",
373
61
  "multi-llm",
374
- "multi-llm-router",
375
- "multi-model",
376
- "multi-model-router",
377
- "multi-provider",
378
- "multi-region",
379
- "multimodal",
380
- "network-proxy",
381
- "nextjs-ai",
382
- "nlp",
383
- "no-gpu",
384
- "no-gpu-required",
385
- "node",
386
- "nodejs",
387
- "nomic-embed",
388
- "npm",
389
- "npm-package",
390
- "nvidia",
391
- "nvidia-nim",
392
- "observability",
393
- "ollama",
394
- "ollama-proxy",
395
- "on-premise",
396
- "open-source",
397
- "openai",
398
- "openai-api",
399
- "openai-compatible",
400
- "openai-endpoint",
401
- "openai-format",
402
- "openai-gateway",
62
+ "parallel-llm",
403
63
  "openai-proxy",
404
- "openai-relay",
405
- "openai-sdk",
406
- "openrouter",
407
- "openrouter-api",
408
- "opentelemetry",
409
- "orchestration",
410
- "otel",
411
- "parallel",
412
- "parallel-ai",
64
+ "llm-proxy",
65
+ "cost-optimization",
66
+ "ai-infrastructure",
67
+ "routing",
68
+ "provider-routing",
69
+ "model-routing",
70
+ "llm-routing",
413
71
  "parallel-execution",
414
- "pay-less-llm",
415
- "per-team-budget",
416
- "per-user-budget",
417
- "performance",
418
- "perplexity",
419
- "pii-detection",
420
- "pii-redaction",
421
- "pinecone",
422
- "pip",
423
- "priority-queue",
424
- "privacy-llm",
425
- "production",
426
- "production-ready",
427
- "prometheus-client",
428
- "prometheus-format",
429
- "prometheus-metrics",
430
- "prompt-cache",
431
- "prompt-engineering",
432
- "prompt-injection",
433
- "prompt-security",
434
- "provider-failover",
435
- "provider-fallback",
436
- "provider-health",
437
- "provider-registry",
438
- "provider-selection",
439
- "provider-selector",
440
- "proxy",
441
- "proxy-server",
442
- "pypi",
443
- "pypi-package",
444
- "python",
445
- "python-bindings",
446
- "qianwen",
447
- "quality-metrics",
448
- "quality-routing",
449
- "query-cache",
450
- "query-routing",
451
- "qwen",
452
- "qwen-long",
453
- "qwen-max",
454
- "qwen-plus",
455
- "qwen-turbo",
456
- "qwen2",
457
- "qwen2.5",
458
- "qwen2.5-coder",
459
- "qwen3",
460
- "rag",
461
- "rate-limiter",
462
- "rate-limiting",
463
- "real-time",
464
- "relay-server",
465
- "reliability",
466
- "request-routing",
467
- "request-timeout",
468
- "request-tracing",
469
- "research-backed",
470
- "resilience",
471
- "response-cache",
472
- "rest-api",
473
- "retry",
474
- "retry-after",
475
- "retry-logic",
476
- "retry-policy",
477
- "retry-proxy",
478
- "reverse-proxy",
479
- "route-quality",
480
- "routellm",
481
- "router",
482
- "router-proxy",
483
- "routing-accuracy",
484
- "routing-benchmark",
485
- "routing-quality",
486
- "salesforce",
487
- "sanitization",
488
- "scalability",
489
- "sdk",
490
- "security",
491
- "self-consistency",
492
- "self-healing",
493
- "self-host",
494
- "self-hosted",
72
+ "ensemble-voting",
73
+ "confidence-scoring",
495
74
  "semantic-cache",
496
- "semantic-memory",
497
- "semantic-routing",
498
- "sentiment-analysis",
499
- "sentry",
500
- "server",
501
- "serverless",
502
- "sla",
503
- "slack",
504
- "smart-failover",
505
- "smart-fallback",
506
- "smart-llm-router",
507
- "smart-router",
508
- "smart-routing",
509
- "smart-selection",
510
- "soc2",
511
- "span",
512
- "spend-tracking",
513
- "spending-limit",
514
- "starts-in-100ms",
515
- "streaming",
516
- "streaming-llm",
517
- "streamingllm",
518
- "summarization",
519
- "task-aware-router",
520
- "task-memory",
521
- "task-routing",
522
- "tencentcloud",
523
- "testing",
524
- "text-generation",
525
- "throughput-testing",
526
- "tier-routing",
527
- "timeout",
528
- "together-ai",
529
- "together-api",
530
- "token-compression",
531
- "token-counter",
532
- "token-counting",
533
- "token-optimization",
534
- "token-saving",
535
- "tongji",
536
- "tongyi",
537
- "tongyi-qianwen",
538
- "tools",
539
- "trace-id",
540
- "tracing",
541
- "traffic-routing",
542
- "transformer",
543
- "transformers",
544
- "translation",
545
- "tree-search",
75
+ "circuit-breaker",
76
+ "budget-enforcement",
77
+ "prompt-guardrails",
78
+ "llm-security",
79
+ "groq",
80
+ "anthropic",
81
+ "openai",
82
+ "deepseek",
83
+ "nvidia",
84
+ "gemini",
85
+ "mistral",
546
86
  "typescript",
547
- "ucb1",
548
- "ucb1-selection",
549
- "uct",
550
- "uptime",
551
- "vector-cache",
552
- "vector-database",
553
- "vercel",
554
- "vercel-ai",
555
- "vercel-ai-sdk",
556
- "vision-model",
557
- "volcengine",
558
- "wu-yuan",
559
- "wuyuan",
560
- "xai",
561
- "yi",
562
- "yi-34b",
563
- "yi-ai",
564
- "yi-api",
565
- "yi-large",
566
- "yi-lightning",
567
- "yi-llm",
568
- "yi-medium",
569
- "zai",
570
- "zai-glm",
571
- "zai-glm-4",
572
- "zero-ml",
573
- "zh-llm",
574
- "zhipu",
575
- "zhipu-ai",
576
- "zhipu-api",
577
- "parallel-ensemble",
578
- "open-source-llm-router",
87
+ "nodejs",
88
+ "open-source",
89
+ "llm",
90
+ "artificial-intelligence",
91
+ "machine-learning",
92
+ "api-gateway",
93
+ "devtools",
579
94
  "independent-benchmark",
580
95
  "third-party-validation",
581
- "multi-llm-execution",
582
- "confidence-scoring",
583
- "query-presets",
584
- "persistent-memory",
585
- "cost-savings",
586
- "open-source-gateway",
587
- "cross-provider",
588
- "llm-benchmark",
589
- "gateway-latency",
590
- "llm-cost-optimization",
591
- "production-llm"
96
+ "multi-provider",
97
+ "cross-provider"
592
98
  ],
593
99
  "author": "Das-rebel <subho@example.com>",
594
100
  "license": "MIT",