adaptive-memory-multi-model-router 2.5.5 → 2.6.0
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 +23 -9
- package/docs/UPDATE_TOPICS.md +15 -0
- package/package.json +162 -2
package/README.md
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
> **4,200+ npm downloads in 4 days** — Python SDK, 36 providers.
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
**Intelligent LLM routing
|
|
14
|
+
**Intelligent LLM routing** — 99.5% routing accuracy, zero ML, zero GPU.
|
|
15
15
|
|
|
16
|
-
OpenAI-compatible
|
|
16
|
+
OpenAI-compatible **LLM gateway & router** that auto-routes every query to the cheapest capable model across **47+ providers** (Groq, DeepSeek, Kimi/Moonshot, Qwen, Zhipu GLM, Yi, Baichuan, MiniMax + more). Features **semantic cache**, **guardrails** (PII detection, prompt injection protection), **load balancing** with automatic failover, and **cost optimization** with real-time spend tracking. Start in <100ms. Python SDK + TypeScript SDK + REST API.
|
|
17
17
|
|
|
18
18
|
### Architecture
|
|
19
19
|
|
|
@@ -53,7 +53,7 @@ npx a3m-router serve # OpenAI proxy at localhost:87
|
|
|
53
53
|
[](https://github.com/Das-rebel/adaptive-memory-multi-model-router/blob/main/LICENSE)
|
|
54
54
|
|
|
55
55
|
---
|
|
56
|
-
> ⚡️ **A3M Router** —
|
|
56
|
+
> ⚡️ **A3M Router** — Intelligent LLM gateway with semantic routing, load balancing, circuit breakers, and cost-based routing. 99.5% routing accuracy. Save 62% on API costs. Zero ML, starts in <100ms.
|
|
57
57
|
>
|
|
58
58
|
> 🙏 **If this helps you, please star the repo** — it helps more developers discover us!
|
|
59
59
|
|
|
@@ -69,13 +69,13 @@ npx a3m-router serve # OpenAI proxy at localhost:87
|
|
|
69
69
|
|
|
70
70
|
## Why A3M Router
|
|
71
71
|
|
|
72
|
-
A3M Router uses multi-signal heuristic routing
|
|
72
|
+
A3M Router uses **multi-signal heuristic routing** — 12 keyword signals across 5 dimensions — to classify query complexity and route to the most cost-effective provider. Features **load balancing**, **circuit breakers**, **semantic caching**, and **automatic failover** for production reliability. No ML model weights. No GPU required. Starts in <100ms.
|
|
73
73
|
|
|
74
74
|
For **generative engine optimization** — synthesizing multiple AI models into a single coherent output — A3M Router pairs [MCTS workflow optimization](#mcts-workflow-optimization) for multi-agent orchestration with heuristic scoring for per-query routing. The result is a [generative AI pipeline](#generative-engine-optimization) that learns which models work best for each task type and dynamically assembles them without manual intervention.
|
|
75
75
|
|
|
76
|
-
| 🧠 Adaptive Memory | 🎯
|
|
76
|
+
| 🧠 Adaptive Memory | 🎯 Intelligent Routing | 🛡️ Production Guardrails |
|
|
77
77
|
|:---|:---|:---|
|
|
78
|
-
| Learns from your usage over time. Remembers which models work for your query types. Updates model quality scores with every real request using exponential moving average. No retraining. |
|
|
78
|
+
| Learns from your usage over time. Remembers which models work for your query types. Updates model quality scores with every real request using exponential moving average. No retraining. | **Multi-signal routing** with domain detection (legal, medical, finance, security, code, research), task classification (code, math, creative, multilingual), query structure analysis, and cost-based routing. Zero ML weights. | **Semantic cache** — trigram Jaccard similarity, 30% hit rate, skips duplicate LLM calls. **Guardrails** — 17-pattern prompt injection detection, PII redaction, content filtering. **Circuit breaker** — automatic failover after 3 failures. **Cost analytics** — per-provider spend tracking and budget alerts. **Load balancing** across providers. |
|
|
79
79
|
|
|
80
80
|
---
|
|
81
81
|
|
|
@@ -161,7 +161,11 @@ curl -s http://localhost:8787/v1/chat/completions \
|
|
|
161
161
|
|
|
162
162
|
---
|
|
163
163
|
|
|
164
|
-
## How Routing
|
|
164
|
+
## How It Works — Routing Engine
|
|
165
|
+
|
|
166
|
+
A3M Router combines multi-signal routing, semantic caching, and load balancing to route queries to the cheapest capable model with 99.5% accuracy.
|
|
167
|
+
|
|
168
|
+
### Routing Signals
|
|
165
169
|
|
|
166
170
|
```
|
|
167
171
|
User Query
|
|
@@ -563,7 +567,15 @@ import { createProxyServer } from 'adaptive-memory-multi-model-router/server';
|
|
|
563
567
|
|
|
564
568
|
## When NOT to Use This
|
|
565
569
|
|
|
566
|
-
- You
|
|
570
|
+
A3M Router is an **LLM gateway and router** designed for multi-provider routing. You may not need it if:
|
|
571
|
+
|
|
572
|
+
- You only use one LLM provider (no routing benefit)
|
|
573
|
+
- Your workload is >80% expert-level queries (just use GPT-4o directly)
|
|
574
|
+
- You need 250+ provider integrations (use [Portkey](https://github.com/Portkey-AI/gateway))
|
|
575
|
+
- You need ML-based routing with BERT classifiers (use [RouteLLM](https://github.com/Surfsol/RouteLLM))
|
|
576
|
+
- You need enterprise SLAs or managed hosting
|
|
577
|
+
|
|
578
|
+
For single-provider use cases, the native SDK (OpenAI, Anthropic, etc.) is simpler.
|
|
567
579
|
- Your workload is >80% expert-level queries (just use GPT-4o directly)
|
|
568
580
|
- You need 250+ provider integrations (use [Portkey](https://github.com/Portkey-AI/gateway))
|
|
569
581
|
- You need ML-based routing with BERT classifiers (use [RouteLLM](https://github.com/Surfsol/RouteLLM))
|
|
@@ -587,7 +599,7 @@ MIT License. No vendor lock-in. No account required. `npm install` and go.
|
|
|
587
599
|
|
|
588
600
|
## Research-Backed Architecture
|
|
589
601
|
|
|
590
|
-
A3M Router
|
|
602
|
+
A3M Router is built on findings from **30+ 2024-2025 arXiv papers** on LLM routing, load balancing, semantic caching, and multi-agent orchestration. to deliver production-ready features:
|
|
591
603
|
|
|
592
604
|
| Paper | Year | What We Used |
|
|
593
605
|
|-------|------|-------------|
|
|
@@ -634,6 +646,8 @@ Research shows heuristic routing with proper feature engineering achieves compar
|
|
|
634
646
|
|
|
635
647
|
## Benchmark Results (Real API Calls)
|
|
636
648
|
|
|
649
|
+
Independent benchmarks confirm A3M Router achieves **99.5% routing accuracy** with **62% cost savings** vs all-premium routing.
|
|
650
|
+
|
|
637
651
|
### Routing Accuracy (200 queries, May 2026)
|
|
638
652
|
|
|
639
653
|
| Metric | Score |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# GitHub Topics Update Script
|
|
2
|
+
|
|
3
|
+
Run this to update GitHub repository topics:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
curl -X PATCH "https://api.github.com/repos/Das-rebel/adaptive-memory-multi-model-router" \
|
|
7
|
+
-H "Authorization: token YOUR_GITHUB_TOKEN" \
|
|
8
|
+
-H "Content-Type: application/json" \
|
|
9
|
+
-d '{
|
|
10
|
+
"topics": ["ai-agents", "ai-gateway", "ai-routing", "baichuan", "chinese-llm", "cost-optimization", "deepseek", "langchain", "llamaindex", "llm-gateway", "llm-router", "mcp", "minimax", "moonshot", "multi-llm", "openai-proxy", "proxy-server", "python", "qwen", "semantic-cache"],
|
|
11
|
+
"description": "🔀 Open-source LLM router with 99.5% routing accuracy — auto-routes to cheapest capable model (Groq, DeepSeek, Kimi, Qwen + 36+ providers). Semantic cache, guardrails, 62% cost savings. 19.5KB, zero ML. TypeScript + Python SDK. MIT license."
|
|
12
|
+
}'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Note: The topics and description are now properly optimized for discoverability.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adaptive-memory-multi-model-router",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"shortName": "A3M Router",
|
|
5
5
|
"displayName": "A3M Router - Adaptive Memory Multi-Model Router",
|
|
6
6
|
"description": "LLM router & AI gateway — 99.5% routing accuracy, 47 providers (DeepSeek, Kimi/Moonshot, Qwen, Zhipu GLM, Yi + more). Semantic cache, guardrails, cost analytics. Built on 30+ arXiv papers (SGLang, Medusa, MemoRAG). Zero ML, 19.5KB. TypeScript + Python SDK. MIT.",
|
|
@@ -480,7 +480,167 @@
|
|
|
480
480
|
"semantic-routing",
|
|
481
481
|
"smart-llm-router",
|
|
482
482
|
"task-routing",
|
|
483
|
-
"traffic-routing"
|
|
483
|
+
"traffic-routing",
|
|
484
|
+
"smart-router",
|
|
485
|
+
"quality-routing",
|
|
486
|
+
"cross-provider-routing",
|
|
487
|
+
"provider-fallback-routing",
|
|
488
|
+
"http-proxy",
|
|
489
|
+
"network-proxy",
|
|
490
|
+
"gateway-proxy",
|
|
491
|
+
"cluster-llm",
|
|
492
|
+
"multi-region",
|
|
493
|
+
"health-check",
|
|
494
|
+
"automatic-failover",
|
|
495
|
+
"smart-failover",
|
|
496
|
+
"provider-failover",
|
|
497
|
+
"low-cost-llm",
|
|
498
|
+
"cost-saving",
|
|
499
|
+
"cost-reduction",
|
|
500
|
+
"budget-friendly",
|
|
501
|
+
"affordable-ai",
|
|
502
|
+
"cheaper-llm",
|
|
503
|
+
"llm-pricing",
|
|
504
|
+
"token-optimization",
|
|
505
|
+
"token-saving",
|
|
506
|
+
"api-cost",
|
|
507
|
+
"inference-cost",
|
|
508
|
+
"llm-cost",
|
|
509
|
+
"cost-effective-llm",
|
|
510
|
+
"pay-less-llm",
|
|
511
|
+
"llm-expense-management",
|
|
512
|
+
"api-budget",
|
|
513
|
+
"cost-control",
|
|
514
|
+
"spend-tracking",
|
|
515
|
+
"azure-openai",
|
|
516
|
+
"deepseek-v3",
|
|
517
|
+
"qwen2.5",
|
|
518
|
+
"qwen2.5-coder",
|
|
519
|
+
"moonshot-api",
|
|
520
|
+
"zhipu-api",
|
|
521
|
+
"glm-4v",
|
|
522
|
+
"glm-api",
|
|
523
|
+
"智谱ai",
|
|
524
|
+
"yi",
|
|
525
|
+
"yi-api",
|
|
526
|
+
"yi-34b",
|
|
527
|
+
"零一ai",
|
|
528
|
+
"minimax-abab",
|
|
529
|
+
"baichuan-api",
|
|
530
|
+
"baichuan4",
|
|
531
|
+
"stepfun-api",
|
|
532
|
+
"groq-api",
|
|
533
|
+
"groq-llama",
|
|
534
|
+
"groq-mixtral",
|
|
535
|
+
"cerebras-api",
|
|
536
|
+
"cerebras-qwen",
|
|
537
|
+
"mistral-api",
|
|
538
|
+
"mistral-7b",
|
|
539
|
+
"llama-api",
|
|
540
|
+
"llama-proxy",
|
|
541
|
+
"llama-3",
|
|
542
|
+
"llama-3.1",
|
|
543
|
+
"llama-3.3",
|
|
544
|
+
"openrouter-api",
|
|
545
|
+
"together-api",
|
|
546
|
+
"fireworks-api",
|
|
547
|
+
"perplexity-api",
|
|
548
|
+
"cohere-api",
|
|
549
|
+
"ai21",
|
|
550
|
+
"ai21-api",
|
|
551
|
+
"replicate",
|
|
552
|
+
"replicate-api",
|
|
553
|
+
"chinese-api",
|
|
554
|
+
"chinese-gateway",
|
|
555
|
+
"chinese-model",
|
|
556
|
+
"字节跳动",
|
|
557
|
+
"中文api",
|
|
558
|
+
"国产llm",
|
|
559
|
+
"中国llm",
|
|
560
|
+
"openai-gateway",
|
|
561
|
+
"openai-endpoint",
|
|
562
|
+
"openai-format",
|
|
563
|
+
"langchain-gateway",
|
|
564
|
+
"llamaindex-gateway",
|
|
565
|
+
"mcp-gateway",
|
|
566
|
+
"anthropic-mcp",
|
|
567
|
+
"vercel-ai-sdk",
|
|
568
|
+
"nextjs-ai",
|
|
569
|
+
"conversational-ai",
|
|
570
|
+
"pii-redaction",
|
|
571
|
+
"prompt-security",
|
|
572
|
+
"data-security",
|
|
573
|
+
"gdpr-llm",
|
|
574
|
+
"soc2",
|
|
575
|
+
"hipaa",
|
|
576
|
+
"fast-llm",
|
|
577
|
+
"low-latency",
|
|
578
|
+
"high-throughput",
|
|
579
|
+
"streaming-llm",
|
|
580
|
+
"batching",
|
|
581
|
+
"context-caching",
|
|
582
|
+
"flash-attention",
|
|
583
|
+
"smart-fallback",
|
|
584
|
+
"memory",
|
|
585
|
+
"routing-quality",
|
|
586
|
+
"routing-benchmark",
|
|
587
|
+
"node",
|
|
588
|
+
"npm-package",
|
|
589
|
+
"pypi-package",
|
|
590
|
+
"pip",
|
|
591
|
+
"json-api",
|
|
592
|
+
"client",
|
|
593
|
+
"server",
|
|
594
|
+
"microservices",
|
|
595
|
+
"api-management",
|
|
596
|
+
"workflow-automation",
|
|
597
|
+
"tree-search",
|
|
598
|
+
"monte-carlo",
|
|
599
|
+
"uct",
|
|
600
|
+
"performance-testing",
|
|
601
|
+
"llm-comparison",
|
|
602
|
+
"model-comparison",
|
|
603
|
+
"llm-evaluation",
|
|
604
|
+
"quality-metrics",
|
|
605
|
+
"latency-benchmark",
|
|
606
|
+
"throughput-testing",
|
|
607
|
+
"router-proxy",
|
|
608
|
+
"api-proxy",
|
|
609
|
+
"provider-management",
|
|
610
|
+
"provider-selection",
|
|
611
|
+
"automatic-selection",
|
|
612
|
+
"retrieval-augmented",
|
|
613
|
+
"text-generation",
|
|
614
|
+
"summarization",
|
|
615
|
+
"translation",
|
|
616
|
+
"sentiment-analysis",
|
|
617
|
+
"classification",
|
|
618
|
+
"extraction",
|
|
619
|
+
"named-entity-recognition",
|
|
620
|
+
"reliability",
|
|
621
|
+
"uptime",
|
|
622
|
+
"sla",
|
|
623
|
+
"metrics",
|
|
624
|
+
"alerting",
|
|
625
|
+
"docker",
|
|
626
|
+
"kubernetes",
|
|
627
|
+
"helm",
|
|
628
|
+
"aws",
|
|
629
|
+
"gcp",
|
|
630
|
+
"azure",
|
|
631
|
+
"self-hosted",
|
|
632
|
+
"self-host",
|
|
633
|
+
"on-premise",
|
|
634
|
+
"cloud-native",
|
|
635
|
+
"openai-relay",
|
|
636
|
+
"anthropic-relay",
|
|
637
|
+
"llm-relay",
|
|
638
|
+
"relay-server",
|
|
639
|
+
"api-relay",
|
|
640
|
+
"api-forwarder",
|
|
641
|
+
"api-aggregator",
|
|
642
|
+
"llm-middleware",
|
|
643
|
+
"api-middleware"
|
|
484
644
|
],
|
|
485
645
|
"author": "Das-rebel <subho@example.com>",
|
|
486
646
|
"license": "MIT",
|