UNPKG

lynkr

Version:

Self-hosted LLM gateway and tier-routing proxy for Claude Code, Cursor, and Codex. Routes across Ollama, AWS Bedrock, OpenRouter, Databricks, Azure OpenAI, llama.cpp, and LM Studio with prompt caching, MCP tools, and 60-80% cost savings.

22 lines (18 loc) 571 B
/** * Tenant context middleware (Phase 6.1). * * Reads LYNKR-Tenant-Id from request headers and attaches the loaded tenant * policy to res.locals.tenantPolicy for downstream handlers. */ const { getTenantId, getPolicy } = require('../../routing/tenant-policy'); function tenantMiddleware(req, res, next) { const tenantId = getTenantId(req); res.locals = res.locals || {}; if (tenantId) { const policy = getPolicy(tenantId); res.locals.tenantId = tenantId; res.locals.tenantPolicy = policy; } next(); } module.exports = { tenantMiddleware };