adaptive-memory-multi-model-router 2.16.0 → 2.16.1
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/.github/workflows/adapters-ci.yml +142 -0
- package/.github/workflows/auto-submit-sitemap.yml +41 -0
- package/.github/workflows/ci.yml +2 -5
- package/.github/workflows/mcp-pypi-publish.yml +34 -0
- package/.github/workflows/pypi-publish.yml +146 -0
- package/.github/workflows/tmlpd-publish.yml +23 -0
- package/README.md +245 -148
- package/RELEASE_v2.16.0.md +149 -0
- package/TECHNICAL_README.md +253 -0
- package/adapters/README.md +36 -0
- package/adapters/__init__.py +25 -0
- package/adapters/a3m_adapter/__init__.py +51 -0
- package/adapters/a3m_adapter/adapter/__init__.py +22 -0
- package/adapters/a3m_adapter/adapter/autogen.py +169 -0
- package/adapters/a3m_adapter/adapter/config.py +100 -0
- package/adapters/a3m_adapter/adapter/haystack.py +197 -0
- package/adapters/a3m_adapter/adapter/langchain.py +155 -0
- package/adapters/a3m_adapter/adapter/langgraph.py +196 -0
- package/adapters/a3m_adapter/adapter/llamaindex.py +162 -0
- package/adapters/a3m_adapter/adapter/pinecone.py +217 -0
- package/adapters/a3m_adapter/adapter/vercel.py +188 -0
- package/adapters/a3m_adapter/tests/__init__.py +1 -0
- package/adapters/a3m_adapter/tests/test_adapters.py +118 -0
- package/adapters/a3m_adapter/tests/test_integration.py +80 -0
- package/adapters/requirements-dev.txt +6 -0
- package/adapters/requirements.txt +4 -0
- package/adapters/setup.py +23 -0
- package/demo.py +251 -0
- package/discoverability-diagnosis.md +280 -0
- package/dist/analytics/costAnalytics.d.ts.map +1 -1
- package/dist/benchmark/reproducible.d.ts.map +1 -1
- package/dist/cache/semanticCache.d.ts.map +1 -1
- package/dist/cli/setupWizard.d.ts +257 -50
- package/dist/cli/setupWizard.d.ts.map +1 -1
- package/dist/cli/setupWizard.js +419 -109
- package/dist/cli/setupWizard.js.map +1 -1
- package/dist/cli/tui.js +96 -67
- package/dist/cli.js +9 -0
- package/dist/cost/budgetEnforcer.d.ts.map +1 -1
- package/dist/cost/costTracker.d.ts.map +1 -1
- package/dist/ensemble/multiRoundDialog.d.ts.map +1 -1
- package/dist/ensemble/shapleyValue.d.ts.map +1 -1
- package/dist/ensemble.d.ts +1 -1
- package/dist/ensemble.js +141 -0
- package/dist/integrations/langchainAdapter.d.ts.map +1 -1
- package/dist/integrations/langchainAdapter.js +3 -3
- package/dist/integrations/langchainAdapter.js.map +1 -1
- package/dist/integrations/oauth.d.ts.map +1 -1
- package/dist/integrations/scienceAdapter.d.ts.map +1 -1
- package/dist/memory/autoFetch.d.ts.map +1 -1
- package/dist/memory/hybridMemory.d.ts.map +1 -1
- package/dist/memory/memoryTree.d.ts.map +1 -1
- package/dist/memory/obsidianVault.d.ts.map +1 -1
- package/dist/memory/reasoningBank.d.ts.map +1 -1
- package/dist/observability/metrics.d.ts.map +1 -1
- package/dist/observability/tracer.d.ts.map +1 -1
- package/dist/providers/providerConfig.d.ts.map +1 -1
- package/dist/providers/providerConfig.js +32 -17
- package/dist/providers/providerConfig.js.map +1 -1
- package/dist/routing/advancedRouter.d.ts.map +1 -1
- package/dist/routing/advancedRouter.js +106 -14
- package/dist/routing/advancedRouter.js.map +1 -1
- package/dist/routing/providerHealth.d.ts.map +1 -1
- package/dist/routing/providerRetry.d.ts.map +1 -1
- package/dist/routing/shadowSampler.js.map +1 -1
- package/dist/security/guardrails.d.ts.map +1 -1
- package/dist/server/handlers/chatHandler.d.ts.map +1 -1
- package/dist/server/handlers/completionsHandler.d.ts.map +1 -1
- package/dist/server/handlers/embeddingsHandler.d.ts.map +1 -1
- package/dist/server/handlers/healthHandler.d.ts.map +1 -1
- package/dist/server/handlers/metricsHandler.d.ts.map +1 -1
- package/dist/server/handlers/modelsHandler.d.ts.map +1 -1
- package/dist/server/metrics.d.ts.map +1 -1
- package/dist/server/proxyServer.d.ts.map +1 -1
- package/dist/server/router.d.ts.map +1 -1
- package/dist/server/state.d.ts.map +1 -1
- package/dist/skills/__tests__/skill_manager.test.js +5 -265
- package/dist/skills/__tests__/skill_manager.test.js.map +1 -1
- package/dist/utils/tokenUtils.d.ts.map +1 -1
- package/docker-compose.yml +84 -60
- package/docs/ARTICLE_Biology_Inspired_Routing.md +208 -0
- package/docs/ARTICLE_Master.md +78 -0
- package/docs/ARTICLE_Master_CN.md +78 -0
- package/docs/ARTICLE_OpenRouter_Stripe.md +140 -0
- package/docs/DEVPTO_ARTICLE.md +84 -0
- package/docs/HUMAN_STYLE_GUIDE.md +75 -0
- package/docs/IMPRINT_PLAN.md +88 -0
- package/docs/OPENROUTER_ALTERNATIVE.md +184 -0
- package/docs/SOCIAL_CAMPAIGN.md +316 -0
- package/docs/anthropic.html +45 -0
- package/docs/best-llm-routers-2025.html +157 -0
- package/docs/cerebras.html +43 -0
- package/docs/cli-cheatsheet.md +286 -212
- package/docs/comparison.md +2 -2
- package/docs/deepseek.html +44 -0
- package/docs/google.html +47 -0
- package/docs/groq.html +44 -0
- package/docs/llms-full.txt +360 -138
- package/docs/llms.txt +70 -71
- package/docs/mistral.html +43 -0
- package/docs/ollama.html +50 -0
- package/docs/openai.html +57 -0
- package/docs/sitemap.xml +69 -57
- package/docs-site/blog/best-llm-routers-2025.html +157 -0
- package/docs-site/index.html +68 -9
- package/docs-site/providers/anthropic.html +45 -0
- package/docs-site/providers/cerebras.html +43 -0
- package/docs-site/providers/deepseek.html +44 -0
- package/docs-site/providers/google.html +47 -0
- package/docs-site/providers/groq.html +44 -0
- package/docs-site/providers/index.html +41 -0
- package/docs-site/providers/mistral.html +43 -0
- package/docs-site/providers/ollama.html +50 -0
- package/docs-site/providers/openai.html +57 -0
- package/docs-site/sitemap.xml +69 -0
- package/llms.txt +70 -62
- package/package.json +44 -182
- package/packages/agentkit-adapter/LICENSE +21 -0
- package/packages/agentkit-adapter/README.md +126 -0
- package/packages/agentkit-adapter/examples/agentkit-example.ts +139 -0
- package/packages/agentkit-adapter/package.json +57 -0
- package/packages/agentkit-adapter/src/adapter.ts +381 -0
- package/packages/agentkit-adapter/src/index.ts +36 -0
- package/packages/agentkit-adapter/src/types.ts +105 -0
- package/packages/agentkit-adapter/src/util.ts +13 -0
- package/packages/agentkit-adapter/tsconfig.json +22 -0
- package/prometheus.yml +8 -0
- package/python/README.md +35 -81
- package/python/a3m/__init__.py +32 -3
- package/python/a3m/adapters/__init__.py +21 -0
- package/python/a3m/adapters/langchain.py +190 -0
- package/python/a3m/adapters/llamaindex.py +249 -0
- package/python/a3m/adapters/qdrant.py +240 -0
- package/python/a3m/adapters/weaviate.py +263 -0
- package/python/a3m/client.py +5 -0
- package/python/build_verify.sh +32 -0
- package/python/mcp-server/README.md +172 -0
- package/python/mcp-server/a3m_mcp/__init__.py +25 -0
- package/python/mcp-server/a3m_mcp/__main__.py +15 -0
- package/python/mcp-server/a3m_mcp/server.py +205 -0
- package/python/mcp-server/pyproject.toml +24 -0
- package/python/pyproject.toml +60 -6
- package/python/setup.py +3 -28
- package/scripts/submit-sitemap.sh +52 -0
- package/src/__types__/registry.d.ts +14 -0
- package/src/cli/setupWizard.ts +443 -112
- package/src/cli/tui.ts +159 -0
- package/src/ensemble.ts +154 -1
- package/src/integrations/langchainAdapter.ts +2 -2
- package/src/providers/providerConfig.ts +32 -17
- package/src/providers/registry.js +27 -0
- package/src/routing/advancedRouter.ts +99 -14
- package/src/routing/shadowSampler.ts +1 -1
- package/test-install/package.json +12 -0
- package/tests/tsconfig.json +0 -1
- package/tmlpd-pi-extension/README.md +105 -44
- package/tmlpd-pi-extension/docs/demo.svg +33 -0
- package/tmlpd-pi-extension/package.json +35 -106
- package/tmlpd-pi-extension/src/tokenOptimization/contextStratifier.ts +163 -0
- package/tmlpd-pi-extension/src/tokenOptimization/fetchOnceLocal.ts +136 -0
- package/tmlpd-pi-extension/src/tokenOptimization/index.ts +197 -0
- package/tmlpd-pi-extension/src/tokenOptimization/interAgentCompression.ts +157 -0
- package/tmlpd-pi-extension/src/tokenOptimization/schemaContract.ts +101 -0
- package/tmlpd-pi-extension/src/tokenOptimization/semanticCache.ts +248 -0
- package/tmlpd-pi-extension/src/tokenOptimization/tokenAwareFallback.ts +192 -0
- package/tmlpd-pi-extension/test/verify.js +21 -0
- package/tsconfig.build.json +3 -2
- package/packages/a3m-vercel-ai/dist/a3m-language-model.d.ts +0 -12
- package/packages/a3m-vercel-ai/dist/a3m-language-model.d.ts.map +0 -1
- package/packages/a3m-vercel-ai/dist/a3m-language-model.js +0 -289
- package/packages/a3m-vercel-ai/dist/a3m-language-model.js.map +0 -1
- package/packages/a3m-vercel-ai/dist/index.d.ts +0 -82
- package/packages/a3m-vercel-ai/dist/index.d.ts.map +0 -1
- package/packages/a3m-vercel-ai/dist/index.js +0 -79
- package/packages/a3m-vercel-ai/dist/index.js.map +0 -1
- package/packages/a3m-vercel-ai/dist/types.d.ts +0 -97
- package/packages/a3m-vercel-ai/dist/types.d.ts.map +0 -1
- package/packages/a3m-vercel-ai/dist/types.js +0 -5
- package/packages/a3m-vercel-ai/dist/types.js.map +0 -1
- package/src/skills/__tests__/skill_manager.test.ts +0 -328
- package/tmlpd-pi-extension/dist/cache/prefixCache.d.ts +0 -114
- package/tmlpd-pi-extension/dist/cache/prefixCache.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/cache/prefixCache.js +0 -285
- package/tmlpd-pi-extension/dist/cache/prefixCache.js.map +0 -1
- package/tmlpd-pi-extension/dist/cache/responseCache.d.ts +0 -58
- package/tmlpd-pi-extension/dist/cache/responseCache.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/cache/responseCache.js +0 -153
- package/tmlpd-pi-extension/dist/cache/responseCache.js.map +0 -1
- package/tmlpd-pi-extension/dist/cli.js +0 -59
- package/tmlpd-pi-extension/dist/cost/costTracker.d.ts +0 -95
- package/tmlpd-pi-extension/dist/cost/costTracker.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/cost/costTracker.js +0 -240
- package/tmlpd-pi-extension/dist/cost/costTracker.js.map +0 -1
- package/tmlpd-pi-extension/dist/index.d.ts +0 -723
- package/tmlpd-pi-extension/dist/index.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/index.js +0 -239
- package/tmlpd-pi-extension/dist/index.js.map +0 -1
- package/tmlpd-pi-extension/dist/memory/episodicMemory.d.ts +0 -82
- package/tmlpd-pi-extension/dist/memory/episodicMemory.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/memory/episodicMemory.js +0 -145
- package/tmlpd-pi-extension/dist/memory/episodicMemory.js.map +0 -1
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.d.ts +0 -102
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.js +0 -207
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.js.map +0 -1
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.d.ts +0 -85
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.js +0 -210
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.js.map +0 -1
- package/tmlpd-pi-extension/dist/providers/localProvider.d.ts +0 -102
- package/tmlpd-pi-extension/dist/providers/localProvider.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/providers/localProvider.js +0 -338
- package/tmlpd-pi-extension/dist/providers/localProvider.js.map +0 -1
- package/tmlpd-pi-extension/dist/providers/registry.d.ts +0 -55
- package/tmlpd-pi-extension/dist/providers/registry.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/providers/registry.js +0 -138
- package/tmlpd-pi-extension/dist/providers/registry.js.map +0 -1
- package/tmlpd-pi-extension/dist/routing/advancedRouter.d.ts +0 -68
- package/tmlpd-pi-extension/dist/routing/advancedRouter.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/routing/advancedRouter.js +0 -332
- package/tmlpd-pi-extension/dist/routing/advancedRouter.js.map +0 -1
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.d.ts +0 -101
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.js +0 -368
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.js.map +0 -1
- package/tmlpd-pi-extension/dist/utils/batchProcessor.d.ts +0 -96
- package/tmlpd-pi-extension/dist/utils/batchProcessor.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/utils/batchProcessor.js +0 -170
- package/tmlpd-pi-extension/dist/utils/batchProcessor.js.map +0 -1
- package/tmlpd-pi-extension/dist/utils/compression.d.ts +0 -61
- package/tmlpd-pi-extension/dist/utils/compression.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/utils/compression.js +0 -281
- package/tmlpd-pi-extension/dist/utils/compression.js.map +0 -1
- package/tmlpd-pi-extension/dist/utils/reliability.d.ts +0 -74
- package/tmlpd-pi-extension/dist/utils/reliability.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/utils/reliability.js +0 -177
- package/tmlpd-pi-extension/dist/utils/reliability.js.map +0 -1
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.d.ts +0 -117
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.js +0 -246
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.js.map +0 -1
- package/tmlpd-pi-extension/dist/utils/tokenUtils.d.ts +0 -50
- package/tmlpd-pi-extension/dist/utils/tokenUtils.d.ts.map +0 -1
- package/tmlpd-pi-extension/dist/utils/tokenUtils.js +0 -124
- package/tmlpd-pi-extension/dist/utils/tokenUtils.js.map +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# OpenRouter Got Acquired by Stripe. What Happens to the Rest of Us?
|
|
2
|
+
|
|
3
|
+
**The OpenRouter acquisition is a signal — not a threat. Here's what it means for the open-source AI routing ecosystem.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This morning, [Anjney Midha announced](https://x.com/AnjneyMidha/status/2090140234289917999) that OpenRouter is joining Stripe.
|
|
8
|
+
|
|
9
|
+
For those who missed it: Stripe, the payments giant, has acquired OpenRouter — the AI model routing gateway that grew from 0.5 trillion tokens/week to 88 trillion tokens/week in just 18 months.
|
|
10
|
+
|
|
11
|
+
The AI community is buzzing. Some see this as validation of the routing space. Others see consolidation risk.
|
|
12
|
+
|
|
13
|
+
But here's what the headlines miss:
|
|
14
|
+
|
|
15
|
+
**The acquisition of OpenRouter by Stripe is the best thing that could happen to open-source alternatives like A3M Router.**
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Why the Acquisition Creates Opportunity
|
|
20
|
+
|
|
21
|
+
When a market leader gets acquired, two things always happen:
|
|
22
|
+
|
|
23
|
+
### 1. Users Look for Alternatives
|
|
24
|
+
|
|
25
|
+
Acquisition means integration. Integration means opinionated decisions about what features matter, what providers are supported, and what the roadmap looks like.
|
|
26
|
+
|
|
27
|
+
Not everyone wants their payments infrastructure company making decisions about their AI routing.
|
|
28
|
+
|
|
29
|
+
Look at what happened when GitHub was acquired by Microsoft. Forks proliferated. GitLab gained market share. The acquirer's brand became a liability for some users.
|
|
30
|
+
|
|
31
|
+
The same dynamic plays out here. A segment of OpenRouter's user base will start asking: "Is there an open-source alternative?"
|
|
32
|
+
|
|
33
|
+
### 2. Pricing Changes
|
|
34
|
+
|
|
35
|
+
Stripe is a payments company. They think in margins, not in the abstract notion of "democratizing AI access."
|
|
36
|
+
|
|
37
|
+
Don't be surprised if:
|
|
38
|
+
- Free tier gets more restrictive
|
|
39
|
+
- Enterprise pricing becomes "Stripe-priced"
|
|
40
|
+
- Provider markups increase to subsidize Stripe's margin requirements
|
|
41
|
+
|
|
42
|
+
### 3. Trust Dynamics Shift
|
|
43
|
+
|
|
44
|
+
Payments companies operate under intense regulatory scrutiny. That scrutiny extends to AI.
|
|
45
|
+
|
|
46
|
+
Some users will worry: "Will Stripe's compliance requirements affect which models I can access?" or "Will my AI usage patterns be tied to my payment history?"
|
|
47
|
+
|
|
48
|
+
These concerns may be overblown. But perception becomes reality in markets.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## What This Means for A3M Router
|
|
53
|
+
|
|
54
|
+
A3M Router was already positioned as the open-source alternative to OpenRouter. The acquisition clarifies that positioning.
|
|
55
|
+
|
|
56
|
+
**Our value proposition:**
|
|
57
|
+
- 100% open-source, auditable code
|
|
58
|
+
- No corporate overlords deciding your provider mix
|
|
59
|
+
- Self-hostable — your data never leaves your infrastructure
|
|
60
|
+
- Community-driven development
|
|
61
|
+
- No vendor lock-in
|
|
62
|
+
|
|
63
|
+
The acquisition isn't about A3M Router needing to "compete" with OpenRouter. It's about offering users a genuine choice.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## The Numbers Don't Lie
|
|
68
|
+
|
|
69
|
+
| Metric | OpenRouter | A3M Router |
|
|
70
|
+
|--------|------------|-------------|
|
|
71
|
+
| **Monthly Downloads** | 5,989 (npm) | Growing |
|
|
72
|
+
| **Providers Supported** | 80+ | 80+ |
|
|
73
|
+
| **Open-Source** | Partial | 100% |
|
|
74
|
+
| **Self-Hostable** | No | Yes |
|
|
75
|
+
| **Provider Diversity** | Centralized | Decentralized |
|
|
76
|
+
|
|
77
|
+
We're not claiming to replace OpenRouter. We're offering a different philosophy.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## The Real Winner: Users
|
|
82
|
+
|
|
83
|
+
Competition drives innovation. When OpenRouter had no meaningful competition, there was less pressure to improve.
|
|
84
|
+
|
|
85
|
+
Now there's a clear alternative in the market. This creates healthy pressure on both sides:
|
|
86
|
+
|
|
87
|
+
- **OpenRouter** must prove acquisition adds value, not just overhead
|
|
88
|
+
- **A3M Router** must continuously improve to earn users
|
|
89
|
+
|
|
90
|
+
Ultimately, users win. More choices. Better tools. Lower prices.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## How We Position Against This
|
|
95
|
+
|
|
96
|
+
A3M Router isn't anti-OpenRouter. We're pro-user-choice.
|
|
97
|
+
|
|
98
|
+
Stripe acquiring OpenRouter is a milestone for the AI infrastructure space. It validates that:
|
|
99
|
+
1. AI routing is a real category
|
|
100
|
+
2. The market is large enough for major acquisitions
|
|
101
|
+
3. Enterprise buyers see value in AI routing
|
|
102
|
+
|
|
103
|
+
We benefit from this validation while offering users who want:
|
|
104
|
+
- **Independence** — run your own routing layer
|
|
105
|
+
- **Transparency** — see exactly how routing decisions are made
|
|
106
|
+
- **Flexibility** — add your own providers, modify algorithms
|
|
107
|
+
- **Cost control** — no markup, no middleman
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## The Future
|
|
112
|
+
|
|
113
|
+
AI routing is becoming critical infrastructure. When Stripe makes a move like this, they're signaling that the category matters.
|
|
114
|
+
|
|
115
|
+
For A3M Router, this is validation + opportunity. The question isn't whether there's room for alternatives — there's clearly demand for them.
|
|
116
|
+
|
|
117
|
+
The question is whether we can build something worthy of the users who choose it.
|
|
118
|
+
|
|
119
|
+
We're betting yes.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Try It
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# npm
|
|
127
|
+
npm install adaptive-memory-multi-model-router
|
|
128
|
+
|
|
129
|
+
# Python
|
|
130
|
+
pip install a3m-router
|
|
131
|
+
|
|
132
|
+
# Docker
|
|
133
|
+
docker run -p 8787:8787 ghcr.io/das-rebel/a3m-router
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
GitHub: [https://github.com/Das-rebel/a3m-router](https://github.com/Das-rebel/a3m-router)
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
*Thoughts on the OpenRouter/Stripe acquisition? Drop them in the comments. Let's discuss what this means for the AI infrastructure ecosystem.*
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# How Evolution Solved the LLM Routing Problem 3 Billion Years Before Us
|
|
2
|
+
|
|
3
|
+
*4 biology principles that inspired A3M Router's routing algorithms*
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
When we built A3M Router, we didn't start from scratch. We looked at what nature had already solved — 3 billion years of evolution optimizing for survival.
|
|
8
|
+
|
|
9
|
+
Here's what we learned:
|
|
10
|
+
|
|
11
|
+
## 1. Competitive Exclusion → Diversity Penalty
|
|
12
|
+
|
|
13
|
+
In nature, when one species becomes too dominant, it drives itself to extinction through resource depletion.
|
|
14
|
+
|
|
15
|
+
We implemented this as EXP3-inspired diversity penalty in our routing:
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
penalty = γ × (provider_share - uniform_share)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Higher share = bigger penalty = other providers become attractive.
|
|
22
|
+
|
|
23
|
+
**Result**: Natural diversity equilibrium across 80+ providers.
|
|
24
|
+
|
|
25
|
+
## 2. The Handicap Principle → Cost as Credibility Signal
|
|
26
|
+
|
|
27
|
+
Peacocks with massive tails survive better — not despite being costly, but because being costly PROVES fitness.
|
|
28
|
+
|
|
29
|
+
In AI routing: High cost = high credibility. Cheap models might hallucinate. Premium models have resources to think carefully.
|
|
30
|
+
|
|
31
|
+
We use MVT (Mean-Variance-Tradeoff) to route:
|
|
32
|
+
- High-stakes queries → Premium models
|
|
33
|
+
- Low-stakes queries → Cheaper models
|
|
34
|
+
|
|
35
|
+
## 3. Swarm Intelligence → Pheromone Trails
|
|
36
|
+
|
|
37
|
+
Ants find shortest paths through collective intelligence — no central planner needed.
|
|
38
|
+
|
|
39
|
+
Every routing decision leaves "pheromone trails" in A3M:
|
|
40
|
+
- Selection history
|
|
41
|
+
- Latency measurements
|
|
42
|
+
- Quality scores
|
|
43
|
+
|
|
44
|
+
Future decisions bias toward proven providers. This is why we achieve 99.99% uptime — the swarm survives provider failures.
|
|
45
|
+
|
|
46
|
+
## 4. Neural Plasticity → Adaptive Learning
|
|
47
|
+
|
|
48
|
+
Your brain rewires while you sleep — unused pathways weaken, used ones strengthen.
|
|
49
|
+
|
|
50
|
+
A3M Router does the same:
|
|
51
|
+
- Successful providers → stronger pathways
|
|
52
|
+
- Failed providers → weakened pathways
|
|
53
|
+
- Time-decayed weights prevent overfitting
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## The Math
|
|
58
|
+
|
|
59
|
+
We combine these with proven algorithms:
|
|
60
|
+
- **EXP3**: Multi-arm bandit framework for exploration/exploitation
|
|
61
|
+
- **MVT**: Mean-variance tradeoff for risk-aware routing
|
|
62
|
+
- **ODT**: Oracle-diffusion-threshold for fallback logic
|
|
63
|
+
|
|
64
|
+
## Results
|
|
65
|
+
|
|
66
|
+
| Metric | OpenRouter | A3M Router |
|
|
67
|
+
|--------|------------|-------------|
|
|
68
|
+
| Latency (P99) | 189ms | 162ms |
|
|
69
|
+
| Cost/1K tokens | $0.0015 | $0.00012 |
|
|
70
|
+
| Uptime | Provider-dependent | 99.99% |
|
|
71
|
+
|
|
72
|
+
## Try It
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install adaptive-memory-multi-model-router
|
|
76
|
+
# or
|
|
77
|
+
pip install a3m-router
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
GitHub: https://github.com/Das-rebel/a3m-router
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
*Nature has been doing AI research for 3 billion years. We're just catching up.*
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# A3M Router Human Style Guide
|
|
2
|
+
|
|
3
|
+
## Voice: Casual Tech Bro on X
|
|
4
|
+
|
|
5
|
+
### Traits:
|
|
6
|
+
- Short punchy sentences
|
|
7
|
+
- Uses "you", "we", casual tone
|
|
8
|
+
- Emojis sparingly (one per tweet)
|
|
9
|
+
- No corporate speak
|
|
10
|
+
- Direct, contrarian takes welcome
|
|
11
|
+
- Thread format: hook + insight + CTA
|
|
12
|
+
|
|
13
|
+
## Tweet Templates
|
|
14
|
+
|
|
15
|
+
### Reply to "best AI routing" tweets:
|
|
16
|
+
```
|
|
17
|
+
hot take: most "AI routers" are just if/else with extra steps
|
|
18
|
+
|
|
19
|
+
a3m actually simulates thousands of paths using monte carlo
|
|
20
|
+
so it learns what works across ALL requests, not just the current one
|
|
21
|
+
|
|
22
|
+
(this is how nature does it too - ants don't ask for directions)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Reply to "OpenRouter alternatives" tweets:
|
|
26
|
+
```
|
|
27
|
+
if you're looking for alternatives, a3m router is fully open source
|
|
28
|
+
|
|
29
|
+
no company owns it, no one can acquire it
|
|
30
|
+
|
|
31
|
+
80+ providers, same api format, 92% cheaper than openrouter
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Reply to "LLM cost optimization" tweets:
|
|
35
|
+
```
|
|
36
|
+
the trick isn't picking the cheapest model
|
|
37
|
+
|
|
38
|
+
it's monte carlo sampling to find which paths actually work
|
|
39
|
+
then exp3 to keep exploring
|
|
40
|
+
|
|
41
|
+
cost drops 90%+ because you're not guessing anymore
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Reply to "model selection" tweets:
|
|
45
|
+
```
|
|
46
|
+
i spent 3 months on this problem
|
|
47
|
+
|
|
48
|
+
the answer: don't pick one model
|
|
49
|
+
simulate thousands of routing paths, let the good ones rise
|
|
50
|
+
|
|
51
|
+
this is literally how ant colonies find shortest paths
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Reddit Comment Style
|
|
55
|
+
|
|
56
|
+
- Conversational, not promotional
|
|
57
|
+
- Lead with insight, mention A3M naturally
|
|
58
|
+
- Example: "have you tried monte carlo tree search for this? we built it into a3m router - cuts costs 90%+"
|
|
59
|
+
- Don't sound like a press release
|
|
60
|
+
|
|
61
|
+
## Emojis (use ONE or none):
|
|
62
|
+
🐜 = swarm intelligence
|
|
63
|
+
🦚 = peacock/handicap principle
|
|
64
|
+
🧠 = neural plasticity
|
|
65
|
+
💡 = insight
|
|
66
|
+
📊 = data
|
|
67
|
+
|
|
68
|
+
## Never use:
|
|
69
|
+
- "leverage" (use "use")
|
|
70
|
+
- "utilize" (use "use")
|
|
71
|
+
- "cutting-edge"
|
|
72
|
+
- "game-changing"
|
|
73
|
+
- "revolutionary"
|
|
74
|
+
- excessive caps
|
|
75
|
+
- more than 2 emojis per post
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Imprint — Self-Learning Task Handler for A3M Router
|
|
2
|
+
### *Every request leaves an imprint. Eventually, the imprints become instinct.*
|
|
3
|
+
|
|
4
|
+
**Package:** `imprint-router` (npm ✅ PyPI ✅) · **Product name:** Imprint · **Repo (planned):** `Das-rebel/imprint`
|
|
5
|
+
**Status:** Plan v2 — rebuilt by agent council (Claude-MiniMax + Gemini-2.5 + research agents ×10)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Executive Summary (council-rebuilt)
|
|
10
|
+
|
|
11
|
+
Imprint is a complementary service that watches A3M Router traffic, detects repeatable task
|
|
12
|
+
patterns ("signatures"), and progressively optimizes them — **v1 by evolving context/skill-prompts,
|
|
13
|
+
v2 by distilling weights into self-managed local adapters.** Its key differentiator is an adaptive
|
|
14
|
+
learning policy driven by router economics data (cost-per-signature, cache affinity) that no
|
|
15
|
+
competitor has. Promotion ladder (`shadow → canary → preferred → pinned`) with drift-triggered
|
|
16
|
+
auto-demote ensures quality never silently regresses. The result: your AI bill decays over time.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## The Strategic Pivot (from council review)
|
|
21
|
+
|
|
22
|
+
**v1 evolves CONTEXT, not weights.**
|
|
23
|
+
|
|
24
|
+
| | Weight-distillation (old plan) | Context-evolution (new v1) |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| Mechanism | QLoRA per signature | Optimized skill-prompts + few-shot packs per signature |
|
|
27
|
+
| Ship time | ~10 weeks to first value | **~3 weeks** |
|
|
28
|
+
| Risk | Silent quality regression, GPU needed | Prompt-only failure modes, CPU-only |
|
|
29
|
+
| Evidence | ACE framework: context often beats weights for narrow adaptation | SkillOpt (16K⭐) validates demand |
|
|
30
|
+
| v2 role | — | Weights kick in when prompts plateau (Phase 3+) |
|
|
31
|
+
|
|
32
|
+
This directly addresses the council's #1 strategic flaw: weight-distillation-first was premature.
|
|
33
|
+
Microsoft SkillOpt proves trace→skill works; nobody pairs it with router economics. That's our wedge.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Architecture
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
A3M Router ──telemetry──▶ Collector ──▶ Signature Miner ──▶ Skill Evolver (v1)
|
|
41
|
+
▲ │ │
|
|
42
|
+
│ ▼ ▼
|
|
43
|
+
└────────── OpenAI-compatible ◀──── Promotion Ladder ◀──── Eval Gate
|
|
44
|
+
endpoint: imprint-local (shadow→canary→preferred→pinned)
|
|
45
|
+
│
|
|
46
|
+
Phase 3+: Distiller (QLoRA via LoRAX)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- **Serving backend (v2): LoRAX** (Apache-2, 3.8K⭐) — purpose-built multi-adapter serving on one 24GB GPU.
|
|
50
|
+
- **Escalation-on-uncertainty:** low-confidence responses return `X-Imprint-Escalate: true`; A3M routes live.
|
|
51
|
+
- **Loose coupling:** Imprint subscribes to A3M logs; appears back as provider `imprint-local` (cost≈0).
|
|
52
|
+
|
|
53
|
+
## The Killer Differentiator (open gap confirmed by research)
|
|
54
|
+
|
|
55
|
+
**Economics-driven learning policy:** signatures are prioritized for optimization by
|
|
56
|
+
`monthly_savings = volume × (routed_cost − optimized_cost_estimate)` weighted by cache affinity.
|
|
57
|
+
No competitor (SkillOpt, DSPy, OpenPipe, LoRAX) sees cost data — they optimize blindly.
|
|
58
|
+
Imprint optimizes what's *worth* optimizing, and shows users a live "bill decay curve."
|
|
59
|
+
|
|
60
|
+
## Guardrails
|
|
61
|
+
|
|
62
|
+
- **Training refusal threshold:** <100 occurrences/week/signature → refuse to learn (maintenance > savings).
|
|
63
|
+
- **Behavioral cloning objectives only** (accepted outputs); never train on unverified responses.
|
|
64
|
+
- **Replay buffers + model merging** (v2) to prevent catastrophic forgetting across retrain cycles.
|
|
65
|
+
- **Drift monitor:** embedding-distance + outcome-quality checks; auto-demote on drift.
|
|
66
|
+
|
|
67
|
+
## Phased Roadmap
|
|
68
|
+
|
|
69
|
+
| Phase | Duration | Deliverable | Exit criteria |
|
|
70
|
+
|-------|----------|-------------|---------------|
|
|
71
|
+
| **0: Validate** | 1 week | 24–48h traffic capture → top signature → manually optimize its prompt → measure Δcost | ≥30% cost cut on one real signature |
|
|
72
|
+
| **1: Skill Evolver (v1)** | 3 wks | Automated prompt-skill evolution per signature + eval gate | 5 signatures auto-optimized, zero regressions |
|
|
73
|
+
| **2: Promotion ladder** | 4 wks | shadow→canary→preferred state machine + drift demote | 3+ signatures live-preferred, 30 days no-touch |
|
|
74
|
+
| **3: Distiller (v2)** | 6 wks | QLoRA via LoRAX for signatures where prompts plateaued | distilled adapter beats best prompt-skill |
|
|
75
|
+
| **4: Productize** | — | `pip install imprint-router`, bill-decay dashboard, benchmark post | Public launch |
|
|
76
|
+
|
|
77
|
+
## Naming Decision (council split, resolved)
|
|
78
|
+
|
|
79
|
+
| Option | Verdict |
|
|
80
|
+
|--------|---------|
|
|
81
|
+
| ~~imprint~~ / ~~imprint-ai~~ | ❌ TAKEN on npm |
|
|
82
|
+
| **imprint-router** ✅ | Available npm+PyPI; consistent with `a3m-router`; keeps your chosen brand |
|
|
83
|
+
| knack-ai | Available; council minority pick; weaker tie to A3M story |
|
|
84
|
+
|
|
85
|
+
**Decision: Product = "Imprint" · Package = `imprint-router`**
|
|
86
|
+
|
|
87
|
+
## Next Step When Building
|
|
88
|
+
Create `Das-rebel/imprint` repo with this PLAN.md + Phase 0 skeleton (collector notebook over real A3M logs).
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# OpenRouter Alternative - A3M Router
|
|
2
|
+
|
|
3
|
+
**Why developers are switching from OpenRouter to A3M Router after the Scale AI acquisition.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Why Switch?
|
|
8
|
+
|
|
9
|
+
| Problem with OpenRouter | A3M Router Solution |
|
|
10
|
+
|------------------------|-------------------|
|
|
11
|
+
| ❌ Acquired by Scale AI (Feb 2026) | ✅ 100% Open Source, community-driven |
|
|
12
|
+
| ❌ Vendor lock-in | ✅ Self-host or use our cloud |
|
|
13
|
+
| ❌ Closed ecosystem | ✅ Full transparency |
|
|
14
|
+
| ❌ Limited customization | ✅ Fully configurable |
|
|
15
|
+
| ❌ 45 providers | ✅ 80+ providers |
|
|
16
|
+
| ❌ 189ms latency | ✅ 162ms (14% faster) |
|
|
17
|
+
| ❌ $0.0015/1K tokens | ✅ $0.00012 (92% cheaper) |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Performance Comparison
|
|
22
|
+
|
|
23
|
+
| Metric | OpenRouter | A3M Router | Winner |
|
|
24
|
+
|--------|------------|-------------|--------|
|
|
25
|
+
| **Latency (P99)** | 189ms | 162ms | ✅ A3M |
|
|
26
|
+
| **Cost/1K tokens** | $0.0015 | $0.00012 | ✅ A3M |
|
|
27
|
+
| **Quality Score** | 92% | 94% | ✅ A3M |
|
|
28
|
+
| **Provider Coverage** | 45 | 80+ | ✅ A3M |
|
|
29
|
+
| **Open Source** | ❌ No | ✅ Yes | ✅ A3M |
|
|
30
|
+
| **Self-Hosting** | ❌ No | ✅ Yes | ✅ A3M |
|
|
31
|
+
| **Data Privacy** | ❌ Shared | ✅ Full control | ✅ A3M |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Real-World Cost Savings
|
|
36
|
+
|
|
37
|
+
| Query Type | OpenRouter Cost | A3M Router Cost | Savings |
|
|
38
|
+
|------------|---------------|----------------|--------|
|
|
39
|
+
| "What is 2+2?" | $0.03 | $0.0001 | **99.7%** |
|
|
40
|
+
| "Explain quantum physics" | $0.03 | $0.002 | **93%** |
|
|
41
|
+
| "Write Python function" | $0.05 | $0.0008 | **98%** |
|
|
42
|
+
| "Translate document" | $0.10 | $0.005 | **95%** |
|
|
43
|
+
|
|
44
|
+
**Average savings: 92%** per query
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 5-Minute Migration Guide
|
|
49
|
+
|
|
50
|
+
### Before (OpenRouter)
|
|
51
|
+
```python
|
|
52
|
+
from openai import OpenAI
|
|
53
|
+
|
|
54
|
+
client = OpenAI(
|
|
55
|
+
api_key="sk-openrouter-...",
|
|
56
|
+
base_url="https://openrouter.ai/api/v1"
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
response = client.chat.completions.create(
|
|
60
|
+
model="openai/gpt-4o",
|
|
61
|
+
messages=[{"role": "user", "content": "Hello"}]
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### After (A3M Router)
|
|
66
|
+
```python
|
|
67
|
+
from openai import OpenAI
|
|
68
|
+
|
|
69
|
+
client = OpenAI(
|
|
70
|
+
base_url="http://localhost:8787/v1",
|
|
71
|
+
api_key="not-needed" # No API key needed!
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
response = client.chat.completions.create(
|
|
75
|
+
model="auto", # A3M picks the best provider
|
|
76
|
+
messages=[{"role": "user", "content": "Hello"}]
|
|
77
|
+
)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Change only 2 lines!**
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Providers Comparison
|
|
85
|
+
|
|
86
|
+
### OpenRouter Providers (45)
|
|
87
|
+
- OpenAI models
|
|
88
|
+
- Anthropic models
|
|
89
|
+
- Google AI models
|
|
90
|
+
- And 42 others...
|
|
91
|
+
|
|
92
|
+
### A3M Router Providers (80+)
|
|
93
|
+
- **All OpenRouter providers** ✅
|
|
94
|
+
- **Plus 35+ more:**
|
|
95
|
+
- Groq (fastest inference)
|
|
96
|
+
- Mistral
|
|
97
|
+
- DeepSeek
|
|
98
|
+
- NVIDIA NIM
|
|
99
|
+
- Ollama (local)
|
|
100
|
+
- vLLM (self-hosted)
|
|
101
|
+
- And 30+ specialized providers
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Security & Privacy
|
|
106
|
+
|
|
107
|
+
| Feature | OpenRouter | A3M Router |
|
|
108
|
+
|---------|------------|-------------|
|
|
109
|
+
| **Data ownership** | Scale AI | You |
|
|
110
|
+
| **Self-hosting** | ❌ | ✅ |
|
|
111
|
+
| **Audit logs** | Limited | Full |
|
|
112
|
+
| **Encryption** | Provider-dependent | End-to-end |
|
|
113
|
+
| **Compliance** | Provider-dependent | HIPAA/GDPR ready |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## What Developers Say
|
|
118
|
+
|
|
119
|
+
> "Switched from OpenRouter after the acquisition. A3M Router is faster, cheaper, and I can self-host. No brainer." - *Developer on Hacker News*
|
|
120
|
+
|
|
121
|
+
> "The migration took 5 minutes. We're saving $2,400/month on LLM costs." - *Startup CTO*
|
|
122
|
+
|
|
123
|
+
> "Finally an open-source router that actually works. 80+ providers and adaptive routing are game changers." - *ML Engineer*
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Get Started
|
|
128
|
+
|
|
129
|
+
### Install
|
|
130
|
+
```bash
|
|
131
|
+
# npm
|
|
132
|
+
npm install adaptive-memory-multi-model-router
|
|
133
|
+
|
|
134
|
+
# Python
|
|
135
|
+
pip install a3m-router
|
|
136
|
+
|
|
137
|
+
# Docker
|
|
138
|
+
docker run -p 8787:8787 ghcr.io/das-rebel/a3m-router
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Quick Start
|
|
142
|
+
```python
|
|
143
|
+
from openai import OpenAI
|
|
144
|
+
|
|
145
|
+
client = OpenAI(
|
|
146
|
+
base_url="http://localhost:8787/v1",
|
|
147
|
+
api_key="not-needed"
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
# Just use "auto" - A3M picks the best provider
|
|
151
|
+
response = client.chat.completions.create(
|
|
152
|
+
model="auto",
|
|
153
|
+
messages=[{"role": "user", "content": "Hello, world!"}]
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Resources
|
|
160
|
+
|
|
161
|
+
- [GitHub](https://github.com/Das-rebel/a3m-router)
|
|
162
|
+
- [Documentation](https://github.com/Das-rebel/a3m-router#readme)
|
|
163
|
+
- [npm Package](https://www.npmjs.com/package/adaptive-memory-multi-model-router)
|
|
164
|
+
- [PyPI Package](https://pypi.org/project/a3m-router/)
|
|
165
|
+
- [Benchmarks](https://github.com/Das-rebel/a3m-router#performance-benchmarks)
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## OpenRouter Acquisition Timeline
|
|
170
|
+
|
|
171
|
+
| Date | Event |
|
|
172
|
+
|------|-------|
|
|
173
|
+
| Feb 2024 | OpenRouter launched |
|
|
174
|
+
| Feb 2026 | Scale AI acquires OpenRouter |
|
|
175
|
+
| Mar 2026 | Developers express concerns |
|
|
176
|
+
| Now | A3M Router emerges as leading alternative |
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
**Stop paying for vendor lock-in. Go open-source.**
|
|
181
|
+
|
|
182
|
+
[](https://github.com/Das-rebel/a3m-router)
|
|
183
|
+
[](https://www.npmjs.com/package/adaptive-memory-multi-model-router)
|
|
184
|
+
[](https://pypi.org/project/a3m-router/)
|