adaptive-memory-multi-model-router 2.14.13 → 2.14.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/.well-known/ai-plugin.json +4 -4
- package/LAUNCH_SNAPSHOT.md +260 -0
- package/README.md.bak +836 -0
- package/ai-plugin.json +16 -0
- package/articles/CHINESE_DIRECTORIES.md +100 -0
- package/articles/NEWSLETTER_SUBMISSIONS.md +112 -0
- package/articles/REDDIT_POST.md +67 -0
- package/assets/a3m_3blue1brown.mp4 +0 -0
- package/demo/3blue1brown_video.py +285 -0
- package/demo/3blue1brown_video_v2.py +310 -0
- package/demo/a3m_3blue1brown.mp4 +0 -0
- package/demo/product-video-v1.mp4 +0 -0
- package/dist/cli/setupWizard.d.ts.map +1 -0
- package/dist/cost/budgetEnforcer.d.ts.map +1 -0
- package/dist/observability/changeWatch.d.ts.map +1 -0
- package/dist/observability/fatigueDetector.d.ts.map +1 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/middleware.d.ts.map +1 -0
- package/dist/observability/tracer.d.ts.map +1 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/routing/crossModelValidation.d.ts.map +1 -0
- package/dist/routing/providerHealth.d.ts.map +1 -0
- package/dist/routing/providerRetry.d.ts.map +1 -0
- package/dist/tui/dashboard.d.ts.map +1 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/docs/.well-known/ai-plugin.json +16 -0
- package/docs/CITATIONS.md +74 -0
- package/docs/GEO_ROOT_CAUSE.md +136 -0
- package/docs/GEO_STATUS.md +199 -0
- package/docs/GEO_TEST_RESULTS.md +176 -0
- package/docs/LANGCHAIN_INTEGRATION.md +147 -0
- package/docs/VERCEL_AI_SDK.md +209 -0
- package/docs/ai-plugin.json +16 -0
- package/docs/compare.md +109 -0
- package/docs/index.html +51 -0
- package/docs/openapi.json +1 -1
- package/docs/well-known/ai-plugin.json +16 -0
- package/docs/wellknown/ai-plugin.json +16 -0
- package/huggingface_space/README.md +35 -0
- package/huggingface_space/app.py +126 -0
- package/huggingface_space/create_space.py +208 -0
- package/huggingface_space/requirements.txt +1 -0
- package/llms.txt +1 -1
- package/package.json +6 -2
- package/research/FINDING_005_knowledge_gap_orthogonality.md +34 -0
- package/research/PUBLISH_LOG.md +0 -3
package/ai-plugin.json
ADDED
|
@@ -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. Available as TypeScript SDK, Python SDK, CLI, and REST API.",
|
|
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
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Chinese AI Directory Submissions
|
|
2
|
+
|
|
3
|
+
## 9 Platforms to Submit To
|
|
4
|
+
|
|
5
|
+
### 1. 未来百科 (nav.6ai.cn)
|
|
6
|
+
**URL:** https://nav.6ai.cn (requires manual registration)
|
|
7
|
+
|
|
8
|
+
### 2. AI工具集 (aigc.cn)
|
|
9
|
+
**URL:** https://aigc.cn (requires manual registration)
|
|
10
|
+
|
|
11
|
+
### 3. 掘金AI (ai.juejin.cn)
|
|
12
|
+
**URL:** https://ai.juejin.cn (developer community)
|
|
13
|
+
|
|
14
|
+
### 4. 思否AI (segmentfault.com/ai)
|
|
15
|
+
**URL:** https://segmentfault.com/ai (developer Q&A)
|
|
16
|
+
|
|
17
|
+
### 5. 开源中国 (oschina.net)
|
|
18
|
+
**URL:** https://oschina.net (open-source community)
|
|
19
|
+
|
|
20
|
+
### 6. 知乎AI (zhihu.com/topic/ai)
|
|
21
|
+
**URL:** https://zhihu.com/topic/ai (Chinese Quora)
|
|
22
|
+
|
|
23
|
+
### 7. CSDN (csdn.net)
|
|
24
|
+
**URL:** https://csdn.net (developer community)
|
|
25
|
+
|
|
26
|
+
### 8. InfoQ中文 (infoq.cn)
|
|
27
|
+
**URL:** https://infoq.cn (tech media)
|
|
28
|
+
|
|
29
|
+
### 9. 机器之心 (jiqizhixin.com)
|
|
30
|
+
**URL:** https://jiqizhixin.com (AI media)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Chinese Submission Template
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
项目名称: A3M Router
|
|
38
|
+
|
|
39
|
+
英文名称: A3M Router
|
|
40
|
+
|
|
41
|
+
项目描述 (Chinese):
|
|
42
|
+
A3M Router 是一个开源的 LLM 路由代理,在 RouterArena 基准测试中排名第一(76.43分),
|
|
43
|
+
成本仅为 $0.047/1K 查询,比 GPT-5 便宜 213 倍。
|
|
44
|
+
|
|
45
|
+
核心功能:
|
|
46
|
+
- 🏆 RouterArena 排名第一
|
|
47
|
+
- 💰 $0.047/1K,比 GPT-5 便宜 213 倍
|
|
48
|
+
- ⚡ 12 个关键词信号,<1ms 路由决策
|
|
49
|
+
- 🔄 支持 47+ 提供商:OpenAI、Anthropic、Groq、Cerebras、DeepSeek、Gemini、Mistral
|
|
50
|
+
- 🧠 持久化记忆功能
|
|
51
|
+
- 📦 语义缓存(30%+ 命中率)
|
|
52
|
+
- 🔌 OpenAI 兼容 API
|
|
53
|
+
|
|
54
|
+
项目地址: https://github.com/Das-rebel/a3m-router
|
|
55
|
+
Demo: https://asciinema.org/a/RpqOZM9tFMALYWvs
|
|
56
|
+
许可证: MIT
|
|
57
|
+
编程语言: TypeScript/JavaScript, Python
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## English Template (for platforms that accept English)
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Name: A3M Router
|
|
66
|
+
|
|
67
|
+
Tagline: #1 LLM Routing Benchmark — 213× cheaper than GPT-5
|
|
68
|
+
|
|
69
|
+
Description:
|
|
70
|
+
A3M Router is an open-source LLM routing proxy that ranks #1 on RouterArena
|
|
71
|
+
(arXiv:2510.00202) with a 76.43 score at $0.047 per 1K queries — 213× cheaper
|
|
72
|
+
than GPT-5.
|
|
73
|
+
|
|
74
|
+
Key Features:
|
|
75
|
+
- #1 on RouterArena benchmark (76.43/19 routers)
|
|
76
|
+
- $0.047/1K queries — 213× cheaper than GPT-5
|
|
77
|
+
- <1ms routing decision, no GPU required
|
|
78
|
+
- 47+ providers: OpenAI, Anthropic, Groq, Cerebras, DeepSeek, Gemini, Mistral
|
|
79
|
+
- Parallel multi-LLM execution
|
|
80
|
+
- Persistent episodic memory
|
|
81
|
+
- Semantic cache (30%+ hit rate)
|
|
82
|
+
- OpenAI-compatible API
|
|
83
|
+
|
|
84
|
+
Category: AI Infrastructure / LLM Gateway / Cost Optimization
|
|
85
|
+
|
|
86
|
+
Website: https://github.com/Das-rebel/a3m-router
|
|
87
|
+
Demo: https://asciinema.org/a/RpqOZM9tFMALYWvs
|
|
88
|
+
License: MIT
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Submission Notes
|
|
94
|
+
|
|
95
|
+
1. **Register accounts** on each platform first
|
|
96
|
+
2. **Some require Chinese phone number** verification
|
|
97
|
+
3. **Priority order**: 掘金 > CSDN > OSChina (most developer traffic)
|
|
98
|
+
4. **Auto-translate** description using Google Translate if needed
|
|
99
|
+
5. **Add logo** (240x240 recommended)
|
|
100
|
+
6. **Link back** to your GitHub for SEO
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Newsletter Submissions
|
|
2
|
+
|
|
3
|
+
## 6 Target Newsletters
|
|
4
|
+
|
|
5
|
+
### 1. Import AI (jack@sequoiacap.com)
|
|
6
|
+
**Audience:** AI researchers, builders
|
|
7
|
+
**Frequency:** Weekly
|
|
8
|
+
**Submission:** Email to jack@sequoiacap.com
|
|
9
|
+
|
|
10
|
+
### 2. The Batch (Anthropic)
|
|
11
|
+
**URL:** https://www.anthropic.com/news (press@anthropic.com)
|
|
12
|
+
|
|
13
|
+
### 3. OpenAI Newsletter
|
|
14
|
+
**URL:** https://openai.com/newsletter
|
|
15
|
+
|
|
16
|
+
### 4. DeepLearning.ai Newsletter
|
|
17
|
+
**URL:** https://www.deeplearning.ai/newsletter/
|
|
18
|
+
|
|
19
|
+
### 5. Lil'Log (Lilian Weng)
|
|
20
|
+
**URL:** https://lilianweng.github.io/ (lilian@openai.com)
|
|
21
|
+
|
|
22
|
+
### 6. The Economist AI
|
|
23
|
+
**URL:** https://www.economist.com/newsletters/ai
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Email Template for Import AI
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
Subject: A3M Router — #1 LLM routing benchmark, 213× cheaper than GPT-5
|
|
31
|
+
|
|
32
|
+
Hi Jack,
|
|
33
|
+
|
|
34
|
+
I wanted to share A3M Router, an open-source project that might interest your readers.
|
|
35
|
+
|
|
36
|
+
**The Pitch:**
|
|
37
|
+
Most teams send every AI query to GPT-4o, paying $10-60 per 1K tokens. A3M Router
|
|
38
|
+
intelligently routes queries to the cheapest capable model, achieving:
|
|
39
|
+
|
|
40
|
+
- **#1 on RouterArena** (76.43 score, arXiv:2510.00202) — beating 18 other routers
|
|
41
|
+
- **$0.047/1K queries** — 213× cheaper than GPT-5
|
|
42
|
+
- **<1ms routing** — no GPU required, rule-based heuristics
|
|
43
|
+
- **47+ providers** — Groq, DeepSeek, Mistral, Claude Haiku, etc.
|
|
44
|
+
|
|
45
|
+
**How it works:**
|
|
46
|
+
A3M analyzes 12 keyword signals across 5 dimensions (domain, complexity, intent,
|
|
47
|
+
length, structure) to instantly route queries to the optimal provider.
|
|
48
|
+
|
|
49
|
+
For example:
|
|
50
|
+
- "Hi" → Groq (free tier)
|
|
51
|
+
- "Debug my Python code" → DeepSeek ($0.0003/query)
|
|
52
|
+
- "Explain quantum entanglement" → GPT-4o mini ($0.0015/query)
|
|
53
|
+
|
|
54
|
+
**Benchmark results:**
|
|
55
|
+
| Router | Score | Cost/1K |
|
|
56
|
+
|--------|-------|----------|
|
|
57
|
+
| A3M Router | 76.43 | $0.047 |
|
|
58
|
+
| Sqwish | 75.27 | $0.18 |
|
|
59
|
+
| GPT-5 | 64.32 | $10.02 |
|
|
60
|
+
|
|
61
|
+
**Demo:** https://asciinema.org/a/RpqOZM9tFMALYWvs
|
|
62
|
+
**GitHub:** https://github.com/Das-rebel/a3m-router
|
|
63
|
+
**npm:** https://www.npmjs.com/package/adaptive-memory-multi-model-router
|
|
64
|
+
|
|
65
|
+
Happy to chat more or provide a more detailed technical breakdown.
|
|
66
|
+
|
|
67
|
+
Best,
|
|
68
|
+
Subho Das
|
|
69
|
+
Das-rebel
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Generic Newsletter Pitch
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
Subject: [Tool] A3M Router — Open-source LLM routing, #1 on RouterArena
|
|
78
|
+
|
|
79
|
+
Hi,
|
|
80
|
+
|
|
81
|
+
I built A3M Router, an open-source LLM gateway that automatically routes queries
|
|
82
|
+
to the cheapest capable model.
|
|
83
|
+
|
|
84
|
+
**Quick facts:**
|
|
85
|
+
- Ranks #1 on RouterArena (76.43 score, beating GPT-5 at 64.32)
|
|
86
|
+
- Costs $0.047/1K queries (vs GPT-5's $10.02)
|
|
87
|
+
- Routes in <1ms with no ML training required
|
|
88
|
+
- Supports 47+ providers with automatic failover
|
|
89
|
+
|
|
90
|
+
**One-liner:** Think of it as "CI/CD for AI spend" — automatically route
|
|
91
|
+
every query to the right model at the right price.
|
|
92
|
+
|
|
93
|
+
**Demo:** https://asciinema.org/a/RpqOZM9tFMALYWvs
|
|
94
|
+
**GitHub:** https://github.com/Das-rebel/a3m-router
|
|
95
|
+
|
|
96
|
+
Would love to be included in your next issue if it's a good fit.
|
|
97
|
+
|
|
98
|
+
Thanks!
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Submission Checklist
|
|
104
|
+
|
|
105
|
+
- [ ] Import AI: Email jack@sequoiacap.com
|
|
106
|
+
- [ ] The Batch: Submit at anthropic.com/news
|
|
107
|
+
- [ ] OpenAI Newsletter: Subscribe + check submission page
|
|
108
|
+
- [ ] DeepLearning.ai: Submit at deeplearning.ai/newsletter
|
|
109
|
+
- [ ] Lil'Log: Email or Twitter DM @lilianweng
|
|
110
|
+
- [ ] The Economist: Submit via website form
|
|
111
|
+
|
|
112
|
+
**Tip:** Submit to Import AI first — most likely to cover indie projects.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Reddit Post - Daslearnsai
|
|
2
|
+
|
|
3
|
+
## Target Subreddits
|
|
4
|
+
- r/LocalLLaMA
|
|
5
|
+
- r/SideProject
|
|
6
|
+
- r/programming
|
|
7
|
+
- r/MachineLearning
|
|
8
|
+
|
|
9
|
+
## Post Title Options
|
|
10
|
+
1. "I built an LLM router that beats GPT-5 at 1/213th the cost — #1 on RouterArena"
|
|
11
|
+
2. "A3M Router: 76.43 score, $0.047/1K, open-source"
|
|
12
|
+
|
|
13
|
+
## Post Body
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
I built A3M Router — an open-source LLM routing proxy that ranks #1 on RouterArena (arXiv:2510.00202).
|
|
17
|
+
|
|
18
|
+
**The Numbers:**
|
|
19
|
+
- RouterArena Score: 76.43 (#1 of 19 routers)
|
|
20
|
+
- Cost: $0.047 per 1K queries
|
|
21
|
+
- vs GPT-5: 213x cheaper with better accuracy
|
|
22
|
+
- vs RouteLLM: 59% higher score at 5.7x lower cost
|
|
23
|
+
|
|
24
|
+
**How it works:**
|
|
25
|
+
Instead of sending every query to expensive models, A3M routes queries to the cheapest capable provider using 12 keyword signals.
|
|
26
|
+
|
|
27
|
+
Simple query (hi, thanks) → free tier (Groq llama)
|
|
28
|
+
Complex query (explain quantum entanglement) → premium (GPT-4o)
|
|
29
|
+
|
|
30
|
+
**Features:**
|
|
31
|
+
- Parallel multi-LLM execution (fire multiple, pick best)
|
|
32
|
+
- 47+ providers: OpenAI, Anthropic, Groq, Cerebras, DeepSeek, Gemini, Mistral...
|
|
33
|
+
- Memory across sessions
|
|
34
|
+
- Semantic cache (30%+ hit rate)
|
|
35
|
+
- Budget enforcement
|
|
36
|
+
- Circuit breaker with auto-failover
|
|
37
|
+
|
|
38
|
+
**Quick start:**
|
|
39
|
+
```bash
|
|
40
|
+
npx a3m-router serve
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then use it like OpenAI:
|
|
44
|
+
```python
|
|
45
|
+
from openai import OpenAI
|
|
46
|
+
client = OpenAI(
|
|
47
|
+
api_key="your-key",
|
|
48
|
+
base_url="http://localhost:8787/v1" # A3M proxy
|
|
49
|
+
)
|
|
50
|
+
response = client.chat.completions.create(
|
|
51
|
+
model="auto", # A3M routes automatically
|
|
52
|
+
messages=[{"role": "user", "content": "Your query"}]
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
GitHub: https://github.com/Das-rebel/a3m-router
|
|
57
|
+
npm: https://www.npmjs.com/package/adaptive-memory-multi-model-router
|
|
58
|
+
|
|
59
|
+
Demo: [asciinema.org/a/RpqOZM9tFMALYWvs]
|
|
60
|
+
|
|
61
|
+
AMA!
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Posting Strategy
|
|
65
|
+
1. Post to r/LocalLLaMA first (most receptive)
|
|
66
|
+
2. 24h later: r/SideProject, r/programming
|
|
67
|
+
3. Track engagement
|
|
Binary file
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
A3M Router — 3Blue1Brown Style Explainer Video Generator
|
|
4
|
+
|
|
5
|
+
Creates animated frames showing:
|
|
6
|
+
1. The problem: expensive AI routing
|
|
7
|
+
2. The solution: intelligent routing
|
|
8
|
+
3. How it works: 12 signals
|
|
9
|
+
4. Results: 76.43 score, 213x cheaper
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
python3 demo/3blue1brown_video.py
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import subprocess
|
|
16
|
+
import json
|
|
17
|
+
import sys
|
|
18
|
+
import math
|
|
19
|
+
import os
|
|
20
|
+
|
|
21
|
+
# Check dependencies
|
|
22
|
+
def check_deps():
|
|
23
|
+
try:
|
|
24
|
+
import matplotlib
|
|
25
|
+
import numpy
|
|
26
|
+
print("✅ matplotlib, numpy available")
|
|
27
|
+
return True
|
|
28
|
+
except ImportError as e:
|
|
29
|
+
print(f"❌ Missing: {e}")
|
|
30
|
+
print("Install: pip install matplotlib numpy pillow")
|
|
31
|
+
return False
|
|
32
|
+
|
|
33
|
+
def run_command(cmd, cwd=None):
|
|
34
|
+
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, cwd=cwd)
|
|
35
|
+
return result.returncode == 0, result.stdout, result.stderr
|
|
36
|
+
|
|
37
|
+
# Frame definitions - each scene
|
|
38
|
+
SCENES = [
|
|
39
|
+
{
|
|
40
|
+
"id": 1,
|
|
41
|
+
"title": "The AI Cost Problem",
|
|
42
|
+
"content": "Every AI query goes to GPT-4\n$10.02 per 1,000 queries",
|
|
43
|
+
"visual": "gpt4_cost_visual",
|
|
44
|
+
"duration": 3.0
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": 2,
|
|
48
|
+
"title": "The Solution",
|
|
49
|
+
"content": "Route queries intelligently\nto the cheapest capable model",
|
|
50
|
+
"visual": "routing_diagram",
|
|
51
|
+
"duration": 3.0
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": 3,
|
|
55
|
+
"title": "How A3M Routes",
|
|
56
|
+
"content": "12 signals → instant decision\n<1ms, no GPU needed",
|
|
57
|
+
"visual": "signals_animation",
|
|
58
|
+
"duration": 4.0
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": 4,
|
|
62
|
+
"title": "The Result",
|
|
63
|
+
"content": "#1 on RouterArena\n76.43 accuracy at $0.047/1K",
|
|
64
|
+
"visual": "benchmark_reveal",
|
|
65
|
+
"duration": 3.0
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": 5,
|
|
69
|
+
"title": "213x Cheaper",
|
|
70
|
+
"content": "vs GPT-5: $10.02 → $0.047\nSame quality, 1/213th the cost",
|
|
71
|
+
"visual": "cost_comparison",
|
|
72
|
+
"duration": 3.0
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
def generate_frame_matplotlib(scene_num, frame_num, total_frames, output_path):
|
|
77
|
+
"""Generate a single frame using matplotlib"""
|
|
78
|
+
import matplotlib.pyplot as plt
|
|
79
|
+
import matplotlib.patches as patches
|
|
80
|
+
import numpy as np
|
|
81
|
+
|
|
82
|
+
# 3Blue1Brown color scheme
|
|
83
|
+
bg_color = '#1a1a2e'
|
|
84
|
+
text_color = '#ffffff'
|
|
85
|
+
accent1 = '#00a8ff' # Blue
|
|
86
|
+
accent2 = '#ff6b6b' # Red
|
|
87
|
+
accent3 = '#4ecdc4' # Teal
|
|
88
|
+
accent4 = '#ffe66d' # Yellow
|
|
89
|
+
|
|
90
|
+
fig, ax = plt.subplots(figsize=(16, 9), facecolor=bg_color)
|
|
91
|
+
ax.set_facecolor(bg_color)
|
|
92
|
+
ax.set_xlim(0, 16)
|
|
93
|
+
ax.set_ylim(0, 9)
|
|
94
|
+
ax.axis('off')
|
|
95
|
+
|
|
96
|
+
if scene_num == 1:
|
|
97
|
+
# Scene 1: GPT-4 cost visualization
|
|
98
|
+
# Big "$10.02" in center
|
|
99
|
+
ax.text(8, 5.5, '$10.02', fontsize=120, color=accent2,
|
|
100
|
+
ha='center', va='center', fontweight='bold', family='monospace')
|
|
101
|
+
ax.text(8, 3.5, 'per 1,000 queries', fontsize=36, color=text_color,
|
|
102
|
+
ha='center', va='center')
|
|
103
|
+
ax.text(8, 1.5, 'GPT-4o', fontsize=28, color=accent1,
|
|
104
|
+
ha='center', va='center', style='italic')
|
|
105
|
+
|
|
106
|
+
# Animated circles representing money
|
|
107
|
+
progress = frame_num / total_frames
|
|
108
|
+
for i in range(int(progress * 20)):
|
|
109
|
+
x = 2 + (i % 5) * 3
|
|
110
|
+
y = 7.5 - (i // 5) * 0.8
|
|
111
|
+
circle = patches.Circle((x, y), 0.3, color=accent2, alpha=0.6)
|
|
112
|
+
ax.add_patch(circle)
|
|
113
|
+
|
|
114
|
+
elif scene_num == 2:
|
|
115
|
+
# Scene 2: Routing diagram
|
|
116
|
+
ax.text(8, 7.5, 'A3M Router', fontsize=48, color=accent1,
|
|
117
|
+
ha='center', va='center', fontweight='bold')
|
|
118
|
+
|
|
119
|
+
# Query box
|
|
120
|
+
rect = patches.FancyBboxPatch((1, 3.5), 3, 2, boxstyle="round,pad=0.1",
|
|
121
|
+
facecolor=accent3, edgecolor='white', linewidth=2)
|
|
122
|
+
ax.add_patch(rect)
|
|
123
|
+
ax.text(2.5, 4.5, 'Query', fontsize=24, color=bg_color,
|
|
124
|
+
ha='center', va='center', fontweight='bold')
|
|
125
|
+
|
|
126
|
+
# Arrow
|
|
127
|
+
ax.annotate('', xy=(5.5, 4.5), xytext=(4, 4.5),
|
|
128
|
+
arrowprops=dict(arrowstyle='->', color=accent1, lw=3))
|
|
129
|
+
|
|
130
|
+
# Router box
|
|
131
|
+
rect = patches.FancyBboxPatch((5.5, 3), 4, 3, boxstyle="round,pad=0.1",
|
|
132
|
+
facecolor=accent1, edgecolor='white', linewidth=3)
|
|
133
|
+
ax.add_patch(rect)
|
|
134
|
+
ax.text(7.5, 5, 'A3M', fontsize=28, color=text_color,
|
|
135
|
+
ha='center', va='center', fontweight='bold')
|
|
136
|
+
ax.text(7.5, 4, '12 signals', fontsize=18, color='white',
|
|
137
|
+
ha='center', va='center')
|
|
138
|
+
ax.text(7.5, 3.3, '<1ms routing', fontsize=14, color='white',
|
|
139
|
+
ha='center', va='center')
|
|
140
|
+
|
|
141
|
+
# Arrows to providers
|
|
142
|
+
providers = [('Groq\nFree', 12, 6.5, accent3),
|
|
143
|
+
('GPT-4o\nPremium', 12, 4.5, accent2),
|
|
144
|
+
('Gemini\nMid', 12, 2.5, accent4)]
|
|
145
|
+
|
|
146
|
+
progress = frame_num / total_frames
|
|
147
|
+
for i, (name, x, y, color) in enumerate(providers):
|
|
148
|
+
if progress > (i * 0.3):
|
|
149
|
+
ax.annotate('', xy=(x, y), xytext=(9.5, 4.5),
|
|
150
|
+
arrowprops=dict(arrowstyle='->', color=color, lw=2))
|
|
151
|
+
rect = patches.FancyBboxPatch((x-0.8, y-0.5), 1.6, 1,
|
|
152
|
+
boxstyle="round,pad=0.05",
|
|
153
|
+
facecolor=color, edgecolor='white',
|
|
154
|
+
linewidth=1, alpha=min(1, (progress - i*0.3)*3))
|
|
155
|
+
ax.add_patch(rect)
|
|
156
|
+
ax.text(x, y, name, fontsize=12, color=bg_color,
|
|
157
|
+
ha='center', va='center', fontweight='bold', alpha=min(1, (progress - i*0.3)*3))
|
|
158
|
+
|
|
159
|
+
elif scene_num == 3:
|
|
160
|
+
# Scene 3: 12 signals animation
|
|
161
|
+
ax.text(8, 8, '12 Keyword Signals', fontsize=44, color=accent1,
|
|
162
|
+
ha='center', va='center', fontweight='bold')
|
|
163
|
+
ax.text(8, 7, 'Multi-dimensional query analysis', fontsize=24, color=text_color,
|
|
164
|
+
ha='center', va='center', alpha=0.7)
|
|
165
|
+
|
|
166
|
+
# Grid of signals
|
|
167
|
+
signals = ['coding', 'math', 'creative', 'factual',
|
|
168
|
+
'simple', 'complex', 'debug', 'explain',
|
|
169
|
+
'short', 'long', 'structured', 'open']
|
|
170
|
+
|
|
171
|
+
progress = frame_num / total_frames
|
|
172
|
+
cols = 4
|
|
173
|
+
for idx, sig in enumerate(signals):
|
|
174
|
+
row = idx // cols
|
|
175
|
+
col = idx % cols
|
|
176
|
+
x = 3 + col * 2.5
|
|
177
|
+
y = 5.5 - row * 1.8
|
|
178
|
+
|
|
179
|
+
alpha = min(1, max(0, (progress - idx * 0.08) * 3))
|
|
180
|
+
if alpha > 0:
|
|
181
|
+
color = [accent1, accent3, accent4, accent2][idx % 4]
|
|
182
|
+
circle = patches.Circle((x, y), 0.5, color=color, alpha=alpha * 0.8)
|
|
183
|
+
ax.add_patch(circle)
|
|
184
|
+
ax.text(x, y, sig, fontsize=14, color=bg_color,
|
|
185
|
+
ha='center', va='center', fontweight='bold', alpha=alpha)
|
|
186
|
+
|
|
187
|
+
elif scene_num == 4:
|
|
188
|
+
# Scene 4: Benchmark reveal
|
|
189
|
+
ax.text(8, 7, 'RouterArena Benchmark', fontsize=44, color=text_color,
|
|
190
|
+
ha='center', va='center', fontweight='bold')
|
|
191
|
+
|
|
192
|
+
progress = frame_num / total_frames
|
|
193
|
+
|
|
194
|
+
# Score reveal
|
|
195
|
+
if progress > 0.3:
|
|
196
|
+
score_alpha = min(1, (progress - 0.3) * 3)
|
|
197
|
+
ax.text(8, 5, '76.43', fontsize=120, color=accent1,
|
|
198
|
+
ha='center', va='center', fontweight='bold', alpha=score_alpha,
|
|
199
|
+
family='monospace')
|
|
200
|
+
ax.text(8, 3, '#1 OF 19 ROUTERS', fontsize=28, color=accent3,
|
|
201
|
+
ha='center', va='center', alpha=score_alpha)
|
|
202
|
+
ax.text(8, 2, 'arXiv:2510.00202', fontsize=18, color=text_color,
|
|
203
|
+
ha='center', va='center', alpha=score_alpha * 0.7)
|
|
204
|
+
|
|
205
|
+
elif scene_num == 5:
|
|
206
|
+
# Scene 5: Cost comparison
|
|
207
|
+
ax.text(8, 7.5, '213x Cheaper', fontsize=56, color=accent3,
|
|
208
|
+
ha='center', va='center', fontweight='bold')
|
|
209
|
+
|
|
210
|
+
progress = frame_num / total_frames
|
|
211
|
+
|
|
212
|
+
# GPT-5 cost
|
|
213
|
+
if progress > 0.2:
|
|
214
|
+
alpha = min(1, (progress - 0.2) * 3)
|
|
215
|
+
ax.text(4, 5, '$10.02', fontsize=64, color=accent2,
|
|
216
|
+
ha='center', va='center', fontweight='bold', alpha=alpha)
|
|
217
|
+
ax.text(4, 3.5, 'GPT-5', fontsize=24, color=text_color,
|
|
218
|
+
ha='center', va='center', alpha=alpha)
|
|
219
|
+
|
|
220
|
+
# A3M cost
|
|
221
|
+
if progress > 0.5:
|
|
222
|
+
alpha = min(1, (progress - 0.5) * 3)
|
|
223
|
+
ax.text(12, 5, '$0.047', fontsize=64, color=accent3,
|
|
224
|
+
ha='center', va='center', fontweight='bold', alpha=alpha)
|
|
225
|
+
ax.text(12, 3.5, 'A3M', fontsize=24, color=text_color,
|
|
226
|
+
ha='center', va='center', alpha=alpha)
|
|
227
|
+
|
|
228
|
+
# VS text
|
|
229
|
+
if progress > 0.7:
|
|
230
|
+
alpha = min(1, (progress - 0.7) * 3)
|
|
231
|
+
ax.text(8, 5, 'vs', fontsize=36, color=text_color,
|
|
232
|
+
ha='center', va='center', alpha=alpha * 0.5)
|
|
233
|
+
ax.text(8, 2, 'Same quality, 1/213th the cost',
|
|
234
|
+
fontsize=22, color=text_color, ha='center', va='center', alpha=alpha)
|
|
235
|
+
|
|
236
|
+
plt.tight_layout()
|
|
237
|
+
plt.savefig(output_path, facecolor=bg_color, dpi=100)
|
|
238
|
+
plt.close()
|
|
239
|
+
|
|
240
|
+
def main():
|
|
241
|
+
if not check_deps():
|
|
242
|
+
sys.exit(1)
|
|
243
|
+
|
|
244
|
+
print("🎬 A3M Router — 3Blue1Brown Style Video Generator")
|
|
245
|
+
print("=" * 50)
|
|
246
|
+
|
|
247
|
+
# Create output directory
|
|
248
|
+
output_dir = '/Users/Subho/adaptive-memory-multi-model-router/demo/frames_3b1b'
|
|
249
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
250
|
+
|
|
251
|
+
total_scenes = len(SCENES)
|
|
252
|
+
frames_per_scene = 30 # 30 frames per scene = ~1s at 30fps
|
|
253
|
+
|
|
254
|
+
print(f"Generating {total_scenes} scenes, {frames_per_scene} frames each...")
|
|
255
|
+
print(f"Output: {output_dir}")
|
|
256
|
+
|
|
257
|
+
for scene in SCENES:
|
|
258
|
+
scene_id = scene['id']
|
|
259
|
+
scene_dir = os.path.join(output_dir, f'scene_{scene_id}')
|
|
260
|
+
os.makedirs(scene_dir, exist_ok=True)
|
|
261
|
+
|
|
262
|
+
print(f"\n📽️ Scene {scene_id}: {scene['title']}")
|
|
263
|
+
|
|
264
|
+
for frame_num in range(1, frames_per_scene + 1):
|
|
265
|
+
output_path = os.path.join(scene_dir, f'frame_{frame_num:04d}.png')
|
|
266
|
+
generate_frame_matplotlib(scene_id, frame_num, frames_per_scene, output_path)
|
|
267
|
+
|
|
268
|
+
if frame_num % 10 == 0:
|
|
269
|
+
print(f" Frame {frame_num}/{frames_per_scene}")
|
|
270
|
+
|
|
271
|
+
print(f"\n✅ Generated {total_scenes * frames_per_scene} frames")
|
|
272
|
+
print(f"\nNext steps:")
|
|
273
|
+
print(f"1. Install ffmpeg: brew install ffmpeg")
|
|
274
|
+
print(f"2. Run: ./demo/render_3b1b_video.sh")
|
|
275
|
+
|
|
276
|
+
# Save scene config
|
|
277
|
+
with open(os.path.join(output_dir, 'scenes.json'), 'w') as f:
|
|
278
|
+
json.dump(SCENES, f, indent=2)
|
|
279
|
+
|
|
280
|
+
print(f"\n3. Or use Python to create video:")
|
|
281
|
+
print(f" python3 -c \"from PIL import Image; import subprocess\"")
|
|
282
|
+
print(f" # Then run ffmpeg to compile")
|
|
283
|
+
|
|
284
|
+
if __name__ == '__main__':
|
|
285
|
+
main()
|