Synapse-Router Documentation

Cost-aware multi-model AI agent router, semantic cache, circuit breaker, and MCP gateway.

1. Installation & Benchmark

git clone https://github.com/codesphere-u/synapse-router.git
cd synapse-router
pip install -e ".[dev]"
synapse-router benchmark --requests 500

2. Pareto Utility & Confidence Cascade

SynapseRouter.execute_cascade() scores healthy endpoints by prior quality, normalized cost, and EMA latency. If ResponseValidator detects low confidence, invalid JSON schema, or empty tool arguments, it escalates automatically across FAST_LOCAL -> BALANCED -> FRONTIER_REASONING.

3. 64-Bit SimHash Semantic Cache

SemanticPromptCache combines weighted word unigrams, bigrams, and 4-char shingles via blake2b, matching within Hamming distance ≤ 3 while isolating entries by SHA-256 context_fingerprint.

4. Sliding-Window RateGovernor & Circuit Breaker

RateGovernor tracks rolling 60-second RPM and TPM consumption per endpoint and down-ranks saturated candidates preemptively, while EndpointHealthRegistry trips OPEN circuits on HTTP 429 spikes in <0.05 ms.

5. Nexus Aegis G2 Attestation

synapse-router export-aegis --cost 0.003 --budget 0.05 --tokens 900

6. MCP Clients & Hosted Gateway

claude mcp add --transport http synapse-router https://synapse-router.vercel.app/mcp
synapse-router rate-status --json