adaptive-memory-multi-model-router 2.14.13 → 2.14.15

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.
Files changed (98) hide show
  1. package/.publish-tick +1 -1
  2. package/.well-known/ai-plugin.json +4 -4
  3. package/ARCHITECTURE.md +1 -1
  4. package/LANDING.md +1 -1
  5. package/LAUNCH.md +19 -19
  6. package/LAUNCH_SNAPSHOT.md +260 -0
  7. package/MANIFESTO.md +2 -2
  8. package/README.md +21 -19
  9. package/README_ja.md +3 -3
  10. package/README_zh.md +3 -3
  11. package/_schema.html +2 -2
  12. package/ai-plugin.json +16 -0
  13. package/articles/CHINESE_DIRECTORIES.md +100 -0
  14. package/articles/FRESH_devto.md +3 -3
  15. package/articles/FRESH_hackernews.md +3 -3
  16. package/articles/FRESH_reddit_ml.md +3 -3
  17. package/articles/FRESH_reddit_node.md +2 -2
  18. package/articles/FRESH_reddit_sideproject.md +1 -1
  19. package/articles/FRESH_reddit_webdev.md +1 -1
  20. package/articles/FROM_ZERO_TO_10K.md +2 -2
  21. package/articles/HN_CHINESE_STYLE.md +1 -1
  22. package/articles/HN_FINAL.md +6 -6
  23. package/articles/HN_SHOW_routerarena.md +2 -2
  24. package/articles/INDIEHACKERS_POST.md +1 -1
  25. package/articles/LLM_BENCHMARK_DEEP_DIVE.md +1 -1
  26. package/articles/NEWSLETTER_SUBMISSIONS.md +112 -0
  27. package/articles/PRESS_KIT_routerarena.md +3 -3
  28. package/articles/PRODUCTHUNT_LISTING.md +1 -1
  29. package/articles/PR_PLAN_vault.md +2 -2
  30. package/articles/REDDIT_POST.md +67 -0
  31. package/articles/ROUTERARENA_LEADER.md +2 -2
  32. package/articles/SHOW_HN_FINAL.md +1 -1
  33. package/articles/TWEETS_routerarena_leader.md +1 -1
  34. package/assets/a3m_3blue1brown.mp4 +0 -0
  35. package/benchmark-results.json +3 -3
  36. package/demo/3blue1brown_video.py +285 -0
  37. package/demo/3blue1brown_video_v2.py +310 -0
  38. package/demo/IMPROVED_PROMPTS.md +2 -2
  39. package/demo/a3m_3blue1brown.mp4 +0 -0
  40. package/demo/product-video-v1.mp4 +0 -0
  41. package/dist/cli/setupWizard.d.ts.map +1 -0
  42. package/dist/cost/budgetEnforcer.d.ts.map +1 -0
  43. package/dist/observability/changeWatch.d.ts.map +1 -0
  44. package/dist/observability/fatigueDetector.d.ts.map +1 -0
  45. package/dist/observability/index.d.ts.map +1 -0
  46. package/dist/observability/metrics.d.ts.map +1 -0
  47. package/dist/observability/middleware.d.ts.map +1 -0
  48. package/dist/observability/tracer.d.ts.map +1 -0
  49. package/dist/observability/types.d.ts.map +1 -0
  50. package/dist/routing/crossModelValidation.d.ts.map +1 -0
  51. package/dist/routing/providerHealth.d.ts.map +1 -0
  52. package/dist/routing/providerRetry.d.ts.map +1 -0
  53. package/dist/tui/dashboard.d.ts.map +1 -0
  54. package/dist/tui/index.d.ts.map +1 -0
  55. package/docs/.well-known/ai-plugin.json +16 -0
  56. package/docs/BENCHMARK.md +2 -2
  57. package/docs/CITATIONS.md +74 -0
  58. package/docs/COUNCIL_V2.2_DECISION.md +1 -1
  59. package/docs/GEO.md +4 -4
  60. package/docs/GEO_ROOT_CAUSE.md +136 -0
  61. package/docs/GEO_STATUS.md +199 -0
  62. package/docs/GEO_TEST_RESULTS.md +176 -0
  63. package/docs/HN_CHECKLIST.md +1 -1
  64. package/docs/HN_FOUNDER_COMMENT.md +1 -1
  65. package/docs/HN_SUBMISSION_FINAL.md +10 -10
  66. package/docs/HN_SUBMISSION_V3.md +3 -3
  67. package/docs/LANGCHAIN_INTEGRATION.md +147 -0
  68. package/docs/QUICK_START.md +1 -1
  69. package/docs/ROUTING_RUBRIC.md +1 -1
  70. package/docs/SOCIAL_LISTENING.md +4 -4
  71. package/docs/TMLPD_V2.2_RESEARCH_ROADMAP.md +7 -7
  72. package/docs/UPDATE_TOPICS.md +1 -1
  73. package/docs/VERCEL_AI_SDK.md +209 -0
  74. package/docs/ai-plugin.json +16 -0
  75. package/docs/benchmark.html +4 -4
  76. package/docs/blog/routerarena-number-one.html +4 -4
  77. package/docs/compare.md +109 -0
  78. package/docs/comparison-litellm.md +3 -3
  79. package/docs/comparison.md +1 -1
  80. package/docs/cost-chart-ascii.md +1 -1
  81. package/docs/demo.html +1 -1
  82. package/docs/index.html +56 -5
  83. package/docs/llms.txt +3 -3
  84. package/docs/openapi.json +1 -1
  85. package/docs/well-known/ai-plugin.json +16 -0
  86. package/docs/wellknown/ai-plugin.json +16 -0
  87. package/hf-space/README.md +1 -1
  88. package/huggingface_space/README.md +35 -0
  89. package/huggingface_space/app.py +126 -0
  90. package/huggingface_space/create_space.py +208 -0
  91. package/huggingface_space/requirements.txt +1 -0
  92. package/index.html +1 -1
  93. package/llms.txt +4 -4
  94. package/package.json +6 -2
  95. package/proxy/README.md +1 -1
  96. package/research/FINDING_005_knowledge_gap_orthogonality.md +34 -0
  97. package/research/PUBLISH_LOG.md +2 -2
  98. package/scripts/routerarena_ensemble.js +144 -0
@@ -14,7 +14,7 @@
14
14
  ## HN Launch Day (Wed May 28)
15
15
  - [ ] 8:00 AM EST — Open HN submit page
16
16
  - [ ] 8:20 AM EST — Fill form:
17
- - [ ] Title: "Show HN: A3M Router — 76.43 routing accuracy without ML. 30x more efficient than BERT."
17
+ - [ ] Title: "Show HN: A3M Router — 70.32 routing accuracy without ML. 30x more efficient than BERT."
18
18
  - [ ] URL: https://github.com/Das-rebel/a3m-router
19
19
  - [ ] Text: (paste from /tmp/HN_SUBMISSION_FINAL_v3.md)
20
20
  - [ ] 8:30 AM EST — HIT SUBMIT
@@ -1,6 +1,6 @@
1
1
  Creator here. A few honest notes:
2
2
 
3
- **On the 76.43 number:** This is from our own benchmark suite, not independent evaluation. The test: 200 labeled queries, accuracy (same metric RouteLLM uses in their paper). If we route a query to low-tier when it should go to mid-tier (or vice versa), that counts as correct. Independent replication would be great.
3
+ **On the 70.32 number:** This is from our own benchmark suite, not independent evaluation. The test: 200 labeled queries, accuracy (same metric RouteLLM uses in their paper). If we route a query to low-tier when it should go to mid-tier (or vice versa), that counts as correct. Independent replication would be great.
4
4
 
5
5
  **Why keyword matching works:** LLM query classification is a shallow problem. "Write Python code" is obviously a code query. "Translate to French" is obviously translation. The signal is on the surface. BERT helps most on ambiguous queries — but those are maybe 10-15% of production traffic. Whether that's worth a 500MB model and GPU is a scale question.
6
6
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  ### RECOMMENDED:
6
6
  ```
7
- Show HN: A3M Router — 76.43 routing accuracy without ML. Matches RouteLLM's BERT within 2.5%
7
+ Show HN: A3M Router — 70.32 routing accuracy without ML. Matches RouteLLM's BERT within 2.5%
8
8
  ```
9
9
 
10
10
  ### Alternative (provocative):
@@ -14,7 +14,7 @@ Show HN: We matched a GPU-trained BERT router with keyword matching. 97% accurac
14
14
 
15
15
  ### Alternative (benchmark-first):
16
16
  ```
17
- Show HN: A3M Router — the only LLM router besides RouteLLM with published benchmarks. 76.43 accuracy, zero ML.
17
+ Show HN: A3M Router — the only LLM router besides RouteLLM with published benchmarks. 70.32 accuracy, zero ML.
18
18
  ```
19
19
 
20
20
  ---
@@ -28,7 +28,7 @@ Show HN: A3M Router — the only LLM router besides RouteLLM with published benc
28
28
  ```
29
29
  RouteLLM (UC Berkeley) trains a BERT classifier on GPU for LLM query routing. Gets 85% accuracy ().
30
30
 
31
- We use keyword matching in Node.js. Get 76.43.
31
+ We use keyword matching in Node.js. Get 70.32.
32
32
 
33
33
  97% of the accuracy. 3% of the compute. 30x more efficient.
34
34
 
@@ -37,7 +37,7 @@ There are exactly two LLM routers with published routing accuracy benchmarks: Ro
37
37
  The comparison:
38
38
 
39
39
  RouteLLM: 85% accuracy, PyTorch, CUDA, ~500MB BERT, ~3s cold start, GPU required
40
- A3M Router: 76.43 accuracy, Node.js, 139 keywords, 0 bytes model, ~50ms cold start, any VPS
40
+ A3M Router: 70.32 accuracy, Node.js, 139 keywords, 0 bytes model, ~50ms cold start, any VPS
41
41
 
42
42
  No neural network. No training loop. No GPU. 12 complexity signals, heuristic scoring.
43
43
 
@@ -70,7 +70,7 @@ RouteLLM paper: arXiv:2404.06035
70
70
  ```
71
71
  Creator here. Some honest context:
72
72
 
73
- The 76.43 number is from our own benchmark suite, not an independent evaluation. I'd love to see third-party replication. The benchmark tests accuracy: if the query should go to a mid-tier model and we route to a low-tier or high-tier, that counts as correct. Same metric RouteLLM uses.
73
+ The 70.32 number is from our own benchmark suite, not an independent evaluation. I'd love to see third-party replication. The benchmark tests accuracy: if the query should go to a mid-tier model and we route to a low-tier or high-tier, that counts as correct. Same metric RouteLLM uses.
74
74
 
75
75
  Why keyword matching works so well: LLM query classification is shallow. "Write Python code" is obviously a code query. "Translate this to French" is obviously translation. The edge cases where BERT helps — ambiguous queries that need semantic understanding — are maybe 10-15% of production traffic. Whether that's worth a 500MB model and GPU requirement depends on your scale.
76
76
 
@@ -88,7 +88,7 @@ Happy to answer questions about the benchmark methodology, the scoring algorithm
88
88
  ```
89
89
  Three things:
90
90
 
91
- 1. We publish routing accuracy (76.43). LiteLLM doesn't publish any.
91
+ 1. We publish routing accuracy (70.32). LiteLLM doesn't publish any.
92
92
 
93
93
  2. Zero ML infrastructure. LiteLLM is Python, which is fine, but it doesn't need GPU either. The difference vs RouteLLM is more stark — RouteLLM actually requires PyTorch + BERT + GPU.
94
94
 
@@ -97,10 +97,10 @@ Three things:
97
97
  LiteLLM is more mature and has 100+ providers vs our 40. If you need production stability today, LiteLLM is the safe choice. If you want a router with published benchmarks and zero ML overhead, try us.
98
98
  ```
99
99
 
100
- ### "76.43 isn't that impressive"
100
+ ### "70.32 isn't that impressive"
101
101
 
102
102
  ```
103
- Agreed, 76.43 isn't state of the art. The point isn't that we're better than RouteLLM — we're 2.5% worse.
103
+ Agreed, 70.32 isn't state of the art. The point isn't that we're better than RouteLLM — we're 2.5% worse.
104
104
 
105
105
  The point is that keyword matching gets you 97% of BERT's accuracy for this specific task. That raises the question: is the GPU worth 2.5%?
106
106
 
@@ -133,12 +133,12 @@ What I want from HN: feedback on the benchmark methodology and the scoring algor
133
133
  ### "Show me real benchmarks"
134
134
 
135
135
  ```
136
- The 76.43 number is from our internal benchmark:
136
+ The 70.32 number is from our internal benchmark:
137
137
 
138
138
  - 200 labeled queries (47 simple, 33 medium, 20 complex, plus variations)
139
139
  - accuracy metric (same as RouteLLM paper)
140
140
  - Ground truth labels: which tier should handle each query
141
- - Our router: 165/200 correct = 76.43
141
+ - Our router: 165/200 correct = 70.32
142
142
 
143
143
  The benchmark script is in the repo:
144
144
  bash scripts/benchmark.sh
@@ -1,4 +1,4 @@
1
- # Show HN: A3M Router — 76.43 routing accuracy without ML. 30x more efficient than BERT.
1
+ # Show HN: A3M Router — 70.32 routing accuracy without ML. 30x more efficient than BERT.
2
2
 
3
3
  **URL**: https://github.com/Das-rebel/a3m-router
4
4
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  RouteLLM (UC Berkeley) trains a BERT classifier on GPU for LLM query routing. Gets 85% accuracy ().
8
8
 
9
- We use keyword matching in Node.js. Get 76.43.
9
+ We use keyword matching in Node.js. Get 70.32.
10
10
 
11
11
  **97% of the accuracy. 3% of the compute. 30x more efficient.**
12
12
 
@@ -16,7 +16,7 @@ There are exactly two LLM routers with published accuracy benchmarks: RouteLLM a
16
16
 
17
17
  ```
18
18
  RouteLLM A3M Router
19
- Accuracy 85% 76.43
19
+ Accuracy 85% 70.32
20
20
  Method BERT (GPU) keyword scoring
21
21
  Model size ~500MB 0 bytes
22
22
  Cold start ~3s ~50ms
@@ -0,0 +1,147 @@
1
+ # LangChain Provider Integration for A3M Router
2
+
3
+ This document outlines how to integrate A3M Router with LangChain as a custom LLM provider.
4
+
5
+ ## Option 1: OpenAI-Compatible API (Recommended)
6
+
7
+ A3M Router is OpenAI-compatible, so you can use it with LangChain's OpenAI integration:
8
+
9
+ ```python
10
+ from langchain_openai import OpenAI
11
+ from langchain.chains import LLMChain
12
+ from langchain.prompts import PromptTemplate
13
+
14
+ # Configure A3M Router as OpenAI-compatible endpoint
15
+ llm = OpenAI(
16
+ model="auto", # A3M will route automatically
17
+ openai_api_base="http://localhost:8787/v1", # A3M Router
18
+ openai_api_key="your-api-key", # Required by A3M but not used for routing
19
+ )
20
+
21
+ # Simple usage
22
+ chain = LLMChain(
23
+ llm=llm,
24
+ prompt=PromptTemplate.from_template("Explain {topic} in {style}.")
25
+ )
26
+
27
+ result = chain.run(topic="quantum computing", style="a haiku")
28
+ print(result)
29
+ ```
30
+
31
+ ## Option 2: Custom LangChain Callback Integration
32
+
33
+ For more control over routing decisions:
34
+
35
+ ```python
36
+ from langchain.callbacks.base import BaseCallbackHandler
37
+ from langchain_openai import OpenAI
38
+ from typing import Any, Dict, List
39
+ import requests
40
+
41
+ class A3MRouterCallback(BaseCallbackHandler):
42
+ """Callback that logs A3M routing decisions"""
43
+
44
+ def __init__(self):
45
+ self.routing_history = []
46
+
47
+ def on_llm_start(self, serialized: Dict, prompts: List[str], **kwargs):
48
+ query = prompts[0] if prompts else ""
49
+ # Get routing decision before LLM call
50
+ response = requests.post(
51
+ "http://localhost:8787/v1/route",
52
+ json={"query": query}
53
+ )
54
+ if response.ok:
55
+ decision = response.json()
56
+ self.routing_history.append(decision)
57
+ print(f"🔀 Routed to: {decision.get('model')} "
58
+ f"(${decision.get('cost')})")
59
+
60
+ # Use with LangChain
61
+ llm = OpenAI(
62
+ model="auto",
63
+ openai_api_base="http://localhost:8787/v1",
64
+ callbacks=[A3MRouterCallback()]
65
+ )
66
+ ```
67
+
68
+ ## Option 3: A3M Router as LangChain Tool
69
+
70
+ Use A3M's routing as a tool in LangChain agents:
71
+
72
+ ```python
73
+ from langchain.agents import initialize_agent, AgentType
74
+ from langchain.tools import Tool
75
+ from langchain_openai import OpenAI
76
+ import requests
77
+
78
+ def get_routing_decision(query: str) -> str:
79
+ """Get A3M routing decision for a query"""
80
+ response = requests.post(
81
+ "http://localhost:8787/v1/route",
82
+ json={"query": query}
83
+ )
84
+ if response.ok:
85
+ data = response.json()
86
+ return f"Model: {data.get('model')}, Tier: {data.get('tier')}, Cost: ${data.get('cost')}"
87
+ return "Error: A3M Router not available"
88
+
89
+ routing_tool = Tool(
90
+ name="A3M Router",
91
+ func=get_routing_decision,
92
+ description="Useful for determining the best LLM for a task"
93
+ )
94
+
95
+ # Create agent with routing tool
96
+ llm = OpenAI(temperature=0)
97
+ agent = initialize_agent(
98
+ tools=[routing_tool],
99
+ llm=llm,
100
+ agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
101
+ verbose=True
102
+ )
103
+
104
+ agent.run("What model should I use for a Python debugging task?")
105
+ ```
106
+
107
+ ## Installation
108
+
109
+ ```bash
110
+ pip install langchain langchain-openai requests
111
+ ```
112
+
113
+ ## Environment Setup
114
+
115
+ ```bash
116
+ export OPENAI_API_KEY="your-key" # Required for LangChain
117
+ # A3M Router runs separately at localhost:8787
118
+ ```
119
+
120
+ ## A3M Router + LangChain Flow
121
+
122
+ ```
123
+ User Query → LangChain Agent → A3M Router (/v1/route)
124
+
125
+ Optimal Model Selected
126
+
127
+ Provider API (Groq, DeepSeek, etc.)
128
+
129
+ Response Returned
130
+ ```
131
+
132
+ ## Cost Tracking
133
+
134
+ A3M Router automatically tracks costs. In LangChain:
135
+
136
+ ```python
137
+ from langchain.callbacks import get_openai_callback
138
+
139
+ with get_openai_callback() as cb:
140
+ chain.run("Explain quantum computing")
141
+ print(f"Total tokens: {cb.total_tokens}")
142
+ print(f"Total cost: ${cb.total_cost}")
143
+ ```
144
+
145
+ ---
146
+
147
+ For more info: https://github.com/Das-rebel/a3m-router
@@ -34,7 +34,7 @@ const response = await client.chat.completions.create({
34
34
 
35
35
  | Feature | A3M Router |
36
36
  |---------|-----------|
37
- | Routing Accuracy | 76.43 |
37
+ | Routing Accuracy | 70.32 |
38
38
  | Cost Savings | 62% vs all-premium |
39
39
  | Providers | 47+ |
40
40
  | Semantic Cache | ✅ 30%+ hit rate |
@@ -39,7 +39,7 @@ composite_score = 0.30 × RoutingAccuracy
39
39
 
40
40
  - **RouteLLM comparison** — where RouteLLM routes vs A3M (reference benchmark)
41
41
  - **Tier confusion matrix** — which query types cause the most over/under-tiering
42
- - **RouterArena score** — the single-number benchmark (current: 76.43)
42
+ - **RouterArena score** — the single-number benchmark (current: 70.32)
43
43
  - **Golden route deviation** — percentage of queries where A3M disagrees with golden route
44
44
 
45
45
  ### Common failure patterns
@@ -77,7 +77,7 @@ When someone has issues with these, offer A3M as a working alternative.
77
77
  ```
78
78
  We were in the same boat — $800/month on GPT-4. Built A3M Router to route smart queries to cheaper models and keep hard ones on premium.
79
79
 
80
- Same answers (RouterArena #1 at 76.43). Cost dropped to ~$5.
80
+ Same answers (RouterArena #1 at 70.32). Cost dropped to ~$5.
81
81
 
82
82
  Open source, MIT. Run it yourself:
83
83
  npx a3m-router route "your query"
@@ -98,7 +98,7 @@ We evaluated all of them before building A3M. What we wanted:
98
98
  - Works with existing OpenAI SDK
99
99
  - Has a reproducible benchmark
100
100
 
101
- A3M Router hits all of those. #1 on RouterArena (76.43). Costs $0.047/1K vs GPT-5 at $10/1K.
101
+ A3M Router hits all of those. #1 on RouterArena (70.32). Costs $0.047/1K vs GPT-5 at $10/1K.
102
102
 
103
103
  npx a3m-router route "test it out"
104
104
  ```
@@ -145,7 +145,7 @@ Open source: npx a3m-router route "try it"
145
145
  ```
146
146
  If you're evaluating options, A3M Router is worth a look:
147
147
  - MIT licensed (not source-available)
148
- - RouterArena #1 (76.43)
148
+ - RouterArena #1 (70.32)
149
149
  - Same API as OpenAI SDK
150
150
  - $0.047/1K vs $10/1K for GPT-5
151
151
 
@@ -174,7 +174,7 @@ npx a3m-router route "test it" # Route a real query
174
174
 
175
175
  **Reply:**
176
176
  ```
177
- Cool project! Curious how it compares on RouterArena. We got 76.43 — would love to see benchmarks head-to-head.
177
+ Cool project! Curious how it compares on RouterArena. We got 70.32 — would love to see benchmarks head-to-head.
178
178
 
179
179
  For anyone evaluating, A3M Router is open source (MIT) with a reproducible benchmark:
180
180
  npx a3m-router benchmark --reproducible
@@ -12,7 +12,7 @@ Copilot's research analysis identifies **7 cutting-edge features** from 2024-202
12
12
  - **50% better long-context** (MemoRAG global memory)
13
13
  - **99%+ reliability** (circuit breakers + fallback chains)
14
14
 
15
- **Combined Impact**: 3-5x faster, 50-70% cheaper, 35% better quality, 76.43 reliable vs TMLPD v2.1
15
+ **Combined Impact**: 3-5x faster, 50-70% cheaper, 35% better quality, 70.32 reliable vs TMLPD v2.1
16
16
 
17
17
  ---
18
18
 
@@ -27,7 +27,7 @@ Copilot's research analysis identifies **7 cutting-edge features** from 2024-202
27
27
  | **Speed** | 1x | 1x | 1x | 2-5x (parallel) | **4-8x** (speculative) |
28
28
  | **Orchestration** | ⚠️ Manual | ⚠️ Manual | ⚠️ Manual | ✅ Orchestrator | ✅ **HALO** |
29
29
  | **Quality** | Baseline | Baseline | Baseline | Baseline | **+35%** |
30
- | **Reliability** | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | 95% | **76.43** |
30
+ | **Reliability** | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | 95% | **70.32** |
31
31
 
32
32
  **Insight**: TMLPD v2.2 would be **uniquely positioned** as the only framework with:
33
33
  1. Learned routing (adapts to new models automatically)
@@ -476,7 +476,7 @@ Circuit Breakers 1x 0% 0% (reliability)
476
476
  Speed: 4-8x (speculative 3x × early exit 1.5x × parallel 1.5x)
477
477
  Cost: 92% savings (v2.1 82% + universal routing 50% + speculative 30%)
478
478
  Quality: +35% (HALO 19.6% + MemoRAG 50% on applicable tasks)
479
- Reliability: 76.43 uptime (circuit breakers + fallback)
479
+ Reliability: 70.32 uptime (circuit breakers + fallback)
480
480
  ```
481
481
 
482
482
  **Example: 100 Tasks**
@@ -616,7 +616,7 @@ cost:
616
616
  | **Memory** | ❌ | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | ✅ **MemoRAG + Graph** |
617
617
  | **Orchestration** | Chain | Auto | Role-based | Auto | ✅ **HALO Hierarchical** |
618
618
  | **Cost Savings** | 0% | 0% | 0% | 0% | ✅ **92%** |
619
- | **Reliability** | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | ✅ **76.43** |
619
+ | **Reliability** | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | ⚠️ Basic | ✅ **70.32** |
620
620
  | **Research-Backed** | ❌ | ❌ | ❌ | ⚠️ Some | ✅ **30+ Papers** |
621
621
 
622
622
  **Insight**: TMLPD v2.2 would be **uniquely positioned** as the only framework combining:
@@ -654,7 +654,7 @@ This creates a **12-18 month competitive advantage** (time for others to replica
654
654
  2. **92% cheaper** than traditional routing
655
655
  3. **+35% better quality** (HALO + MemoRAG)
656
656
  4. **Self-improving** (learns from execution history)
657
- 5. **Production-ready** (76.43 reliability)
657
+ 5. **Production-ready** (70.32 reliability)
658
658
 
659
659
  ### Launch Timeline
660
660
 
@@ -683,7 +683,7 @@ This creates a **12-18 month competitive advantage** (time for others to replica
683
683
 
684
684
  **Case Studies**:
685
685
  1. "Startup X Saved $10K/month with TMLPD v2.2"
686
- 2. "Enterprise Y Achieved 76.43 Uptime with Circuit Breakers"
686
+ 2. "Enterprise Y Achieved 70.32 Uptime with Circuit Breakers"
687
687
  3. "Research Lab Z Improved Results 35% with HALO"
688
688
 
689
689
  **Research Content**:
@@ -727,7 +727,7 @@ TMLPD v2.1 is a solid foundation, but v2.2+ with these research-backed features
727
727
 
728
728
  1. **Unmatched Performance**: 4-8x faster, 92% cheaper
729
729
  2. **Superior Quality**: +35% improvement on complex tasks
730
- 3. **Production-Ready**: 76.43 reliability
730
+ 3. **Production-Ready**: 70.32 reliability
731
731
  4. **Future-Proof**: Learns and adapts automatically
732
732
 
733
733
  ### The Strategy
@@ -8,7 +8,7 @@ curl -X PATCH "https://api.github.com/repos/Das-rebel/a3m-router" \
8
8
  -H "Content-Type: application/json" \
9
9
  -d '{
10
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 76.43 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."
11
+ "description": "🔀 Open-source LLM router with 70.32 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
12
  }'
13
13
  ```
14
14
 
@@ -0,0 +1,209 @@
1
+ # Vercel AI SDK Integration for A3M Router
2
+
3
+ A3M Router integrates seamlessly with Vercel AI SDK for streaming responses and AI gateway deployments.
4
+
5
+ ## Quick Start
6
+
7
+ ### 1. Install Dependencies
8
+
9
+ ```bash
10
+ npm install ai @ai-sdk/openai
11
+ ```
12
+
13
+ ### 2. Configure A3M Router
14
+
15
+ ```typescript
16
+ import { createAI } from 'ai';
17
+ import { openai } from '@ai-sdk/openai';
18
+
19
+ // Configure OpenAI SDK to use A3M Router
20
+ const a3m = openai({
21
+ apiKey: process.env.OPENAI_API_KEY,
22
+ baseURL: process.env.A3M_ROUTER_URL || 'http://localhost:8787/v1',
23
+ });
24
+ ```
25
+
26
+ ### 3. Use with AI SDK Stream
27
+
28
+ ```typescript
29
+ import { streamText } from 'ai';
30
+
31
+ export const maxDuration = 30;
32
+
33
+ export async function POST(req: Request) {
34
+ const { messages } = await req.json();
35
+
36
+ const result = streamText({
37
+ model: a3m('auto'), // A3M routes automatically
38
+ system: 'You are a helpful assistant.',
39
+ messages,
40
+ });
41
+
42
+ return result.toDataStreamResponse();
43
+ }
44
+ ```
45
+
46
+ ## Complete Example with Vercel Edge Functions
47
+
48
+ ### app/api/chat/route.ts
49
+
50
+ ```typescript
51
+ import { openai } from '@ai-sdk/openai';
52
+ import { streamText } from 'ai';
53
+
54
+ export const runtime = 'edge';
55
+
56
+ export async function POST(req: Request) {
57
+ const { messages } = await req.json();
58
+
59
+ const result = streamText({
60
+ model: openai('auto', {
61
+ // Point to A3M Router
62
+ baseURL: process.env.A3M_ROUTER_URL || 'http://localhost:8787/v1',
63
+ }),
64
+ messages,
65
+ });
66
+
67
+ return result.toDataStreamResponse();
68
+ }
69
+ ```
70
+
71
+ ### app/page.tsx
72
+
73
+ ```typescript
74
+ 'use client';
75
+
76
+ import { useChat } from 'ai/react';
77
+
78
+ export default function Chat() {
79
+ const { messages, input, handleInputChange, handleSubmit } = useChat({
80
+ api: '/api/chat',
81
+ });
82
+
83
+ return (
84
+ <div className="flex flex-col h-screen p-4">
85
+ <div className="flex-1 overflow-auto">
86
+ {messages.map(m => (
87
+ <div key={m.id} className="mb-4">
88
+ <strong>{m.role}:</strong> {m.content}
89
+ </div>
90
+ ))}
91
+ </div>
92
+ <form onSubmit={handleSubmit} className="flex gap-2">
93
+ <input
94
+ value={input}
95
+ onChange={handleInputChange}
96
+ placeholder="Ask anything..."
97
+ className="flex-1 p-2 border rounded"
98
+ />
99
+ <button type="submit" className="px-4 py-2 bg-blue-500 text-white rounded">
100
+ Send
101
+ </button>
102
+ </form>
103
+ </div>
104
+ );
105
+ }
106
+ ```
107
+
108
+ ## A3M Router with Vercel AI SDK Features
109
+
110
+ ### Streaming Responses
111
+
112
+ ```typescript
113
+ const result = streamText({
114
+ model: openai('auto', { baseURL: 'http://localhost:8787/v1' }),
115
+ messages,
116
+ });
117
+
118
+ // Stream to client
119
+ return new Response(result.fullStream, {
120
+ headers: { 'Content-Type': 'text/plain' },
121
+ });
122
+ ```
123
+
124
+ ### Cost Tracking with Vercel Analytics
125
+
126
+ ```typescript
127
+ import { generateText, calculateCost } from 'ai';
128
+
129
+ export async function POST(req: Request) {
130
+ const { messages } = await req.json();
131
+
132
+ const result = await generateText({
133
+ model: openai('auto', { baseURL: 'http://localhost:8787/v1' }),
134
+ messages,
135
+ onFinish: (result) => {
136
+ // Log cost for analytics
137
+ const cost = calculateCost(result.usage);
138
+ console.log(`Query cost: $${cost}`);
139
+ },
140
+ });
141
+
142
+ return Response.json({ text: result.text });
143
+ }
144
+ ```
145
+
146
+ ### Multi-Provider Routing
147
+
148
+ A3M automatically routes to the best provider:
149
+
150
+ ```typescript
151
+ // A3M evaluates:
152
+ // - Groq (free tier) for simple queries
153
+ // - DeepSeek (cheap) for reasoning
154
+ // - GPT-4o (premium) for complex tasks
155
+
156
+ const result = await generateText({
157
+ model: openai('auto', { baseURL: 'http://localhost:8787/v1' }),
158
+ messages,
159
+ });
160
+ ```
161
+
162
+ ## Deployment Options
163
+
164
+ ### Option 1: Self-Hosted (Recommended for Cost)
165
+
166
+ ```bash
167
+ # Run A3M Router yourself
168
+ npx a3m-router serve
169
+
170
+ # Point Vercel to your A3M instance
171
+ A3M_ROUTER_URL=https://your-a3m-instance.com
172
+ ```
173
+
174
+ ### Option 2: Deploy A3M to Vercel
175
+
176
+ Create `api/a3m-proxy.ts`:
177
+
178
+ ```typescript
179
+ import { createRoute } from 'ai';
180
+
181
+ export const { handleStreamRequest, handleNonStreamRequest } = createRoute({
182
+ model: openai('auto', {
183
+ baseURL: process.env.A3M_ROUTER_URL,
184
+ }),
185
+ });
186
+ ```
187
+
188
+ ## Environment Variables
189
+
190
+ ```bash
191
+ # .env.local
192
+ OPENAI_API_KEY=sk-... # Your API key (A3M passes through)
193
+ A3M_ROUTER_URL=http://localhost:8787/v1 # A3M Router endpoint
194
+ ```
195
+
196
+ ## Benefits
197
+
198
+ | Feature | Without A3M | With A3M |
199
+ |---------|-------------|----------|
200
+ | Model | Fixed (GPT-4o) | Auto-selected |
201
+ | Cost/1K | $15-60 | $0.047 |
202
+ | Latency | 2-5s | <1s routing |
203
+ | Providers | 1 | 47+ |
204
+
205
+ ## Resources
206
+
207
+ - [Vercel AI SDK Docs](https://sdk.vercel.ai/)
208
+ - [A3M Router GitHub](https://github.com/Das-rebel/a3m-router)
209
+ - [RouterArena Benchmark](https://arxiv.org/abs/2510.00202)
@@ -0,0 +1,16 @@
1
+ {
2
+ "schema_version": "v1",
3
+ "name_for_human": "A3M Router",
4
+ "name_for_model": "a3m_router",
5
+ "description_for_human": "Intelligent LLM routing proxy. Route queries to the cheapest capable model — 99.5% accuracy, 40 providers, zero ML.",
6
+ "description_for_model": "A3M Router is an LLM routing service. Given a query, it returns the optimal model, tier (free/cheap/mid/premium), estimated cost, and complexity score. Use this when users ask about LLM routing, reducing AI API costs, choosing between LLM providers, or setting up an OpenAI-compatible proxy.",
7
+ "api": {
8
+ "type": "openapi",
9
+ "url": "https://das-rebel.github.io/a3m-router/openapi.json"
10
+ },
11
+ "auth": {
12
+ "type": "none"
13
+ },
14
+ "contact_email": "Sdas22@gmail.com",
15
+ "legal_info_url": "https://github.com/Das-rebel/a3m-router/blob/main/LICENSE"
16
+ }
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Benchmark — A3M Router</title>
7
- <meta name="description" content="Independent benchmark results for A3M Router: 76.43 routing accuracy, 62% cost savings, +96ms passthrough overhead, -57% hallucination rate with parallel ensemble.">
7
+ <meta name="description" content="Independent benchmark results for A3M Router: 70.32 routing accuracy, 62% cost savings, +96ms passthrough overhead, -57% hallucination rate with parallel ensemble.">
8
8
  <meta name="keywords" content="LLM router benchmark, AI gateway latency, routing accuracy, cost comparison, multi-provider benchmark">
9
9
  <meta property="og:title" content="A3M Router — Benchmarks">
10
10
  <meta property="og:image" content="https://das-rebel.github.io/a3m-router/benchmark-chart.png">
@@ -63,7 +63,7 @@
63
63
  <!-- Overview Stats -->
64
64
  <div class="stats-grid">
65
65
  <div class="stat-card">
66
- <div class="stat-value">76.43</div>
66
+ <div class="stat-value">70.32</div>
67
67
  <div class="stat-label">+/-1 Tier Accuracy</div>
68
68
  </div>
69
69
  <div class="stat-card">
@@ -159,7 +159,7 @@
159
159
 
160
160
  <div class="stats-grid">
161
161
  <div class="stat-card">
162
- <div class="stat-value">76.43</div>
162
+ <div class="stat-value">70.32</div>
163
163
  <div class="stat-label">&plusmn;1 Tier Accuracy</div>
164
164
  </div>
165
165
  <div class="stat-card">
@@ -182,7 +182,7 @@
182
182
  <tr><th>Metric</th><th>Score</th><th>What It Means</th></tr>
183
183
  </thead>
184
184
  <tbody>
185
- <tr><td><strong>&plusmn;1 Tier Accuracy</strong></td><td><strong>76.43</strong></td><td>Only 1 in 200 queries is misrouted by more than 1 tier</td></tr>
185
+ <tr><td><strong>&plusmn;1 Tier Accuracy</strong></td><td><strong>70.32</strong></td><td>Only 1 in 200 queries is misrouted by more than 1 tier</td></tr>
186
186
  <tr><td>Exact Tier Match</td><td>64.5%</td><td>~2 in 3 queries hit the <em>exact</em> right tier</td></tr>
187
187
  <tr><td>Free Tier Recall</td><td>92%</td><td>Free-tier-suitable queries correctly routed to $0 models</td></tr>
188
188
  <tr><td>Over-routing (waste)</td><td>7%</td><td>Sent to a stronger &mdash; but more expensive &mdash; model than needed</td></tr>