Port: 5497 Status: Active License: Proprietary — source-available. A written license from NirLab Inc is required before production/commercial use. Contact: legal@nirlab.com · https://nirlab.com/aros/enterprise
shre-router is the intelligent prompt routing engine for the Shre platform. It analyzes incoming prompts across 5 signal dimensions and routes them through a 10-gate decision engine to select the optimal model for each request.
- Modality — Text, image, audio, video, or multimodal input
- Task Type — Classification, generation, code, tool use, reasoning, chat
- Complexity — Token depth, chain-of-thought requirements, domain expertise needed
- Latency — Real-time (<500ms), interactive (<5s), batch (unbounded)
- Budget — Cost ceiling per request, local-preferred, cloud-allowed
| Model | ID | Provider | Status |
|---|---|---|---|
| Qwen 3 8B | ollama/qwen3:8b | Ollama (local) | Connected |
| LLaMA 3.2 3B | ollama/llama3.2:3b | Ollama (local) | Connected |
| Claude Haiku 4.5 | anthropic/claude-haiku-4-5-20251001 | Anthropic | Connected |
| Claude Sonnet 4.6 | anthropic/claude-sonnet-4-6 | Anthropic | Connected |
| Claude Opus 4.6 | anthropic/claude-opus-4-6 | Anthropic | Connected |
| GPT-5.2 | openai/gpt-5.2 | OpenAI | Not Connected |
| Gemini 1.5 Pro | google/gemini-1.5-pro | Not Connected | |
| G5 Ensemble | ensemble/G5 | Ensemble | Connected |
┌─────────────────┐
│ Incoming Prompt │
└────────┬────────┘
│
┌────────▼────────┐
│ Analyze Signals │
│ (5 dimensions) │
└────────┬────────┘
│
┌──────────────▼──────────────┐
│ G1: Multimodal? │──yes──→ google/gemini-1.5-pro
└──────────────┬──────────────┘
│ no
┌──────────────▼──────────────┐
│ G2: Realtime + high conf? │──yes──→ ollama/llama3.2:3b
└──────────────┬──────────────┘
│ no
┌──────────────▼──────────────┐
│ G3: Simple classification? │──yes──→ ollama/qwen3:8b
└──────────────┬──────────────┘
│ no
┌──────────────▼──────────────┐
│ G4: Code generation? │──yes──→ openai/gpt-5.2
└──────────────┬──────────────┘
│ no
┌──────────────▼──────────────┐
│ G5: Tool use / function? │──yes──→ openai/gpt-5.2
└──────────────┬──────────────┘
│ no
┌──────────────▼──────────────┐
│ G6: Deep reasoning needed? │──yes──→ anthropic/claude-opus-4-6
└──────────────┬──────────────┘
│ no
┌──────────────▼──────────────┐
│ G7: Multi-expert consensus? │──yes──→ ensemble/G5
└──────────────┬──────────────┘
│ no
┌──────────────▼──────────────┐
│ G8: Budget = local only? │──yes──→ ollama/qwen3:8b
└──────────────┬──────────────┘
│ no
┌──────────────▼──────────────┐
│ G9: Quick chat / low stakes?│──yes──→ anthropic/claude-haiku-4-5-20251001
└──────────────┬──────────────┘
│ no
┌──────────────▼──────────────┐
│ G10: DEFAULT │──────→ anthropic/claude-sonnet-4-6
└─────────────────────────────┘
Heads-up: the production Docker build copies two sibling NirLab packages —
shre-sdkandshre-model-config— which are not part of this public repo. The source here is complete enough to read, evaluate, and integrate against the API, but a from-scratch build requires those packages. Contact licensing for the full build context.
Requirements: Node.js 22+, an Ollama instance for local models, and provider API keys (Anthropic / OpenAI / Google) for cloud routes.
# Install
npm install
# Develop (hot reload on port 5497)
npm run dev
# Production build + run
npm run build
npm start # serves on PORT (default 5497)Configuration is via environment variables (provider keys, PORT, Ollama host).
Verify with curl localhost:5497/health.
| Method | Path | Description |
|---|---|---|
| GET | /health |
Health check — returns service status and model connectivity |
| GET | /v1/models |
List all configured models and their connection status |
| POST | /v1/route |
Route a single prompt — returns selected model + reasoning |
| POST | /v1/route/batch |
Route multiple prompts in one request |
| GET | /v1/stats |
Routing statistics — gate hit counts, latency, model usage |
Proprietary — All Rights Reserved. © 2026 NirLab Inc. Published source-available for evaluation and integration reference. See LICENSE. A separate written license is required before production or commercial use: legal@nirlab.com.
Service: shre-router | Port: 5497 | Part of the Shre AI platform