router-control-public is a small LLM routing proxy for chat workloads.
It focuses on one job: classify a request, choose a profile and model, resolve a provider, and forward the call through an OpenAI-compatible API surface.
- Local rule-based request classification
- Profile-driven model selection
- Capability-aware provider filtering
- Model pool indirection per provider
- Fallback routing with lightweight failure tracking
- OpenAI-compatible
POST /v1/chat/completions
GET /healthGET /providersGET /config/allGET /config/profilesGET /config/profiles/:namePOST /config/profilePOST /classifyPOST /v1/chat/completions
npm install
cp .env.example .env
npm run build
npm startThe server listens on ROUTER_PORT and defaults to 3000.
Set provider credentials with environment variables such as:
OPENAI_API_KEYANTHROPIC_API_KEYGOOGLE_API_KEYDEEPSEEK_API_KEYGROQ_API_KEYGITHUB_MODELS_TOKENOPENROUTER_API_KEYOLLAMA_BASE_URLOMLX_BASE_URL
You can also use OPENAI_API_KEYS or ANTHROPIC_API_KEYS as comma-separated key pools.
Routing hints can be passed with x-router-* headers:
x-router-featurex-router-agent-idx-router-session-idx-router-parent-agent-idx-router-projectx-router-model-override
Legacy x-openclaw-* aliases are still accepted for compatibility.
curl http://127.0.0.1:3000/v1/chat/completions \
-H 'content-type: application/json' \
-H 'x-router-feature: conversation' \
-d '{
"messages": [
{ "role": "user", "content": "Explain how fallback routing works." }
]
}'Routing behavior is defined in:
src/config/router-config.yamlsrc/config/profiles.yamlsrc/config/models.yamlsrc/config/model-pools.yaml
npm testArchitecture and runtime notes are in ARCHITECTURE.md and docs/architecture/router-architecture.md.