GPT-4o costs $0.03/run. A3M routes the same request to Groq/Mistral for $0.0001.
# Before: Expensive and slow
response = openai.ChatCompletion.create(model="gpt-4o", messages=[...])
# $0.03 per request. Every time.
# After: Same API, 99.7% cheaper
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8787/v1", api_key="not-needed")
response = client.chat.completions.create(model="auto", messages=[...])
# Routes to cheapest capable provider. $0.0001 per request.| Metric | Lifetime | Last 30 days | Last week | Run rate (months) |
|---|---|---|---|---|
| npm downloads | 49,493 | 12,710 | 2,149 | Aug: 4,392 · Sep: 11,944 · Oct: 1,301 |
| GitHub Stars | 16 | 2 | 0 | |
| Forks | 5 | 0 | 0 |
Insights • 87% of lifetime downloads in Sep 2026 (peak) • August 2026 resurgence (+3.3× month‑on‑month) • Consistent weekly flow (≈2.1k/week) despite low weekend activity • Active days: 137 (since May 15, 2026) | Average: 361/day
![]()
![]()
![]()
$ npx a3m-router serve
___ ___ ____ ____ _ _ __ ___
/ __)/ \/ ___)( __)( \/ )( )( _)
( (__( O ))__) ) _) ) ( )(/(
\___)\__/(____)(____)(_)\_)(____/
A3M Router v2.16.3
Serving at http://localhost:8787/v1
Providers: 80+ | Mode: auto | Memory: enabled
→ POST /v1/chat/completions
→ GET /v1/models
→ GET /health
npm install adaptive-memory-multi-model-router
npx a3m-router serve
# Then use it like OpenAI:from openai import OpenAI
client = OpenAI(base_url="http://localhost:8787/v1", api_key="not-needed")
# model="auto" → routes to cheapest capable provider
response = client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Write a Python fibonacci function"}]
)
print(response.choices[0].message.content)
# Output: GPT-4o quality, DeepSeek/Groq priceMost requests don't need GPT-4o. A simple question costs the same as a complex one.
| Query | GPT-4o | A3M Routes To | You Save |
|---|---|---|---|
| "What is 2+2?" | $0.03 | Groq ($0.0001) | 99.7% |
| "Explain quantum" | $0.03 | Mistral ($0.0002) | 99.3% |
| "Write a Python function" | $0.05 | DeepSeek ($0.002) | 96% |
| Complex reasoning | $0.15 | GPT-4o ($0.15) | 0% (correctly routed) |
A3M analyzes your prompt and routes to the cheapest provider that can answer it correctly.
Your Request
│
▼
┌────────────┐
│ Semantic │ ← "Is this a duplicate?" (free cache hit?)
└─────┬──────┘
▼
┌────────────┐
│ Router │ ← "Simple question or complex reasoning?"
└─────┬──────┘
▼
┌────────────┐
│ Provider │ ← Groq / Mistral / DeepSeek / GPT-4o / Claude...
└────────────┘
Two modes:
model="auto"— Heuristic router, ~0.4ms overhead, zero extra costmodel="jev-auto"— ML decision head, calibrated probabilities, ~2ms warm
npx a3m-router providers list| Tier | Examples |
|---|---|
| Free | Ollama, Llama.cpp, HuggingFace Inference |
| Budget | Groq, DeepSeek, Mistral, Cloudflare Workers AI |
| Mid | GPT-4o-mini, Claude-haiku, Gemini-flash |
| Premium | GPT-4o, Claude-sonnet, Gemini-pro |
Provider availability checked at runtime — no hardcoded uptimes.
Drop-in OpenAI replacement:
# Just change the base URL — your existing code works
client = OpenAI(base_url="http://localhost:8787/v1", api_key="not-needed")Or use the full API:
from a3m.router import A3MRouter
router = A3MRouter(
model="auto",
parallel_ensemble=3, # Call 3 providers, take the best
memory={"type": "semantic", "window": 10}, # Remember context
)
result = router.route(messages=[{"role": "user", "content": "..."}])
print(f"Provider: {result.provider}")
print(f"Cost: ${result.cost}")OpenRouter takes a cut. A3M runs on your machine.
# Docker (one command)
docker run -p 8787:8787 ghcr.io/das-rebel/a3m-router:latest
# Or Node.js / Python directly
npm install adaptive-memory-multi-model-router
python -m a3m_router.serveNo API key to share. No vendor lock-in. Your prompts stay on your infrastructure.
Works great when:
- You're building AI features and need cost control
- You want fallback providers (if Groq is down, we route elsewhere)
- You need semantic caching across conversation turns
- You want to compare provider quality on the same prompts
Not the right tool when:
- You need exactly GPT-4o for every request (then just use GPT-4o)
- Your infrastructure can't run a local service
npx a3m-router serve # Start server (port 8787)
npx a3m-router route "prompt" # Preview routing decision
npx a3m-router health # Live provider availability
npx a3m-router benchmark # Local quality benchmark
npx a3m-router providers list # Show all providersEnvironment variables:
A3M_LOG_LEVEL=debug # Debug logging
PORT=8787 # Server port
A3M_JEV_URL=... # Optional: remote Jev ML backendSee CONTRIBUTING.md for setup, project structure, and code conventions.
A3M is built on biological intelligence: evolution solved the routing problem 3 billion years ago. The immune system doesn't use the same response for every pathogen — it routes resources based on threat level.
Same idea here: simple questions get cheap answers. Complex reasoning gets premium models. The router learns from traffic and improves over time.
A3M is 100% open-source, self-hostable, and community-driven. We're not competing with OpenRouter — we're offering a different philosophy: open, decentralized, and yours.
Sep 2026 — Parallel ensemble execution for multi-model routing:
ParallelExecutor(520 lines): Concurrent dispatch, retry logic, Shapley credit assignment, semantic clusteringmcDropout.ts(157 lines): MC Dropout uncertainty estimation, stochastic forward passestypes.ts: Clean export interface definitions- Build verified (
npm run buildpasses) - Tests: 2/2 passing (
dist/ensemble/)
Key Features: Confidence-weighted voting, loyalty/handicap tracking, provenance headers (X-Ensemble-Provenance), multi-strategy (majority/weighted/shapley/semantic)