Lynkr
An LLM Gateway which optimises your token usage.
84% fewer tokens on JSON tool results. 53% fewer tokens on tool-heavy requests. Sub-300ms semantic cache hits. Zero code changes.
Potencialize seu agente
O comando do próprio publicador. Não é um endpoint do PlugMCP.
Host a copy with our keys and logs.
npx -y [email protected]O Claude Code não tem link de instalação para um comando local. Copie o comando abaixo e execute-o em um terminal.
claude mcp add lynkr -- npx -y lynkr@9.14.27Execute em um terminal.
{ "mcpServers": { "lynkr": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}claude_desktop_config.json
URL remota ou um comando na sua máquina? Como as duas instalações diferem
Rodar no PlugMCP
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
AbrirDo publicador
84% fewer tokens on JSON tool results. 53% fewer tokens on tool-heavy requests. Sub-300ms semantic cache hits. Zero code changes.
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.
Numbers from the bundled benchmark against LiteLLM on identical free local backends — run it yourself:
node benchmark-tier-routing.js. It doubles as a 19-scenario routing regression harness (currently 12/12 correctness checks), andMODE=routingruns a routing-only head-to-head that judges both proxies on the same acceptable-tier sets — including LiteLLM's Auto Router v2. How it works →
Agentic benchmark (Terminal-Bench core, 80 tasks, Oct 2026): Lynkr 42/80 for $1.54 vs openrouter/auto 44/80 for $4.72 on the same VM and evening — tied on accuracy within single-run noise (Lynkr's three runs: 39, 39, 42) at ~30% of the cost; vLLM Semantic Router on the same models/hosts: 25/80 (34 agent timeouts from unbounded upstream stalls and per-turn CPU classification). Full comparison, fairness notes and what it changed in Lynkr →
Third-party benchmark: on RouterArena (ICLR 2026, 8,400 queries) Lynkr's routing scores 67.65 arena / 68.41% accuracy at $0.29 per 1K queries with 92.38 robustness — above GPT-5's built-in router and NotDiamond at a fraction of their cost. Methodology & caveats →
Use Lynkr's routing with your AI coding assistant — maximize your subscription value:
npm install -g lynkr
# Claude Code Pro/Max
lynkr wrap claude
Wrapping gives you:
npm install -g lynkr
The fastest path is the interactive wizard:
lynkr init
It asks four questions — usage mode (Claude Pro/Max via wrap, or direct API keys), tier picks for SIMPLE/MEDIUM/COMPLEX/REASONING across the 14 supported providers, credentials for what you chose, and a few routing-intelligence knobs — then writes a fully-populated .env with sensible production defaults for everything else (caching, compression, policy budgets, MCP sandbox, rate limiting).
Useful flags:
lynkr init --force # overwrite an existing .env
See docs/init.md for the full wizard reference.
If you'd rather configure by hand, the manual options below still work — copy .env.example to .env and edit it directly:
Option A: Free & Local (Ollama) - Recommended for Testing
# Install Ollama first: https://ollama.com
ollama pull qwen2.5-coder:latest
Then start Lynkr:
lynkr start
Cursor IDE
http://localhost:8081/v1any-valueCodex CLI
Edit ~/.codex/config.toml:
model_provider = "lynkr"
[model_providers.lynkr]
base_url = "http://localhost:8081/v1"
wire_api = "responses"
✅ Done! Your AI tool now uses your chosen provider.
unable to determine transport target for "pino-pretty"Problem: You're running an older version (< 9.3.0).
Solution: Update to the latest version:
npm install -g lynkr@latest
If you must use an older version, set NODE_ENV=production before starting.
Missing tier configuration: TIER_SIMPLE, TIER_MEDIUM...This is just a warning - you can ignore it. Tier routing is optional.
To remove the warning, add to .env:
TIER_SIMPLE=ollama:qwen2.5-coder:latest
TIER_MEDIUM=ollama:qwen2.5-coder:latest
TIER_COMPLEX=ollama:qwen2.5-coder:latest
TIER_REASONING=ollama:qwen2.5-coder:latest
FALLBACK_PROVIDER='databricks' is enabled but missing credentialsSolution: Add to .env:
FALLBACK_ENABLED=false
connect ECONNREFUSED ::1:11434 (Ollama)Problem: Ollama is not running.
Solution:
ollama serve
Keep this terminal open, and start Lynkr in a new terminal.
Connection refused or 404 Not FoundProblem: Lynkr is not running or wrong port.
Solution: Check Lynkr is running on the correct port:
curl http://localhost:8081/
Should return: {"service":"Lynkr","version":"9.x.x","status":"running"}
AI coding tools lock you into one provider and send every token raw. Lynkr breaks both locks.
Claude Code / Cursor / Codex / Cline / Continue
↓
Lynkr
┌─────────────────────┐
│ Strip unused tools │ ← 53% fewer tokens on tool calls
│ Compress JSON blobs │ ← 84% on large tool results
│ Semantic cache │ ← <300ms hits, 0 tokens billed
│ Route by complexity │ ← cheap model for simple, cloud for hard
│ Learn from outcomes │ ← kNN + bandit + auto-calibration
└─────────────────────┘
↓
Ollama | Bedrock | Azure | Moonshot | OpenRouter | OpenAI
What you get:
4 local providers for 100% offline, free usage. 14+ cloud providers for scale.
Route different request types to different models automatically:
# .env file
MODEL_PROVIDER=ollama
FALLBACK_ENABLED=false
# Use small/fast models for simple tasks
TIER_SIMPLE=ollama:qwen2.5:3b
# Use medium models for normal coding
TIER_MEDIUM=ollama:qwen2.5:7b
# Use powerful models for complex architecture
TIER_COMPLEX=ollama:deepseek-r1:14b
TIER_REASONING=ollama:deepseek-r1:14b
# Optional: Limits (remove for unlimited) for long conversations
POLICY_MAX_STEPS=50
POLICY_MAX_TOOL_CALLS=100
Lynkr analyzes each request and routes it to the appropriate tier. Simple questions use fast models. Complex refactoring uses powerful models. The scorer combines anchor-embedding classification (WS7, payload-invariant) with the Jev routing judge (an optional typed second opinion over the four tiers, enabled by TYPESAFE_API_KEY; it replaced the earlier local qwen2.5:3b classifier, so no local Ollama is required) that catches topic-vs-difficulty confounding — list the exports from this file correctly routes to MEDIUM instead of getting boosted to REASONING by "technical vocabulary" alone.
Result: 70-90% of requests use cheaper/faster models. Only hard problems hit expensive models. 15× reduction in expensive-tier over-routing vs the anchor-only baseline on the 381-prompt eval set (0.6% vs ~15%).
Tier configuration is strictly authoritative — bandit exploration is constrained to the models you've listed in TIER_*, and multi-turn conversations score with a recency-weighted sliding window so context isn't lost on short follow-ups. Conversations get a content-fingerprint session id (clients like Claude Code send none), the decision pins for the session, and a guarded escape ladder (risk keywords, force phrases, score drift, context overflow) re-escalates the moment a task outgrows its model. Full pipeline: docs/routing-intelligence.md · intent scorer: docs/intent-window-routing.md · verify any change: docs/benchmarking.md.
Responses stream token-by-token instead of arriving all at once — including through the tier router. Two mechanisms, both on by default:
LYNKR_NATIVE_PASSTHROUGH=false.tool_use blocks. Kill switch: LYNKR_STREAM_TRANSFORM=false.The LYNKR_VISIBLE_ROUTING badge streams too (injected as the first content
block), and telemetry is recorded on stream close with real token counts.
Fallback safety: if an upstream fails before the first byte, the request
falls back to the buffered path automatically.
# Ollama thinking models (MiniMax): streaming skips the <think>-leak repair.
# If you see raw <think> text in responses, buffer that provider instead:
LYNKR_OLLAMA_BUFFER_RESPONSES=true # default true; false = stream Ollama
# Enable all optimizations
PROMPT_CACHE_ENABLED=true
SEMANTIC_CACHE_ENABLED=true
Always-on (no config): RTK tool-result compression (test/git/grep/lint/build/JSON output), MCP tool dedup (drops built-in WebSearch/WebFetch when an Exa/Tavily MCP tool is present), and request bypass (Claude CLI Warmup / title-extraction calls are answered locally, never hitting a provider).
Optional terse-output mode to cut output tokens:
CAVEMAN_ENABLED=true # off by default — nudges the model to be concise
CAVEMAN_LEVEL=lite # lite | full | ultra
Open http://localhost:8081/dashboard while Lynkr is running. No setup, reads
the local telemetry store:
JSON APIs behind it
(/dashboard/api/overview|usage|routing|logs|recommendations|analytics|sessions/:id|statusline)
if you want the raw numbers.
One line after every turn — routed tier, served model, today's spend, and
cache re-read share — with zero token cost (out-of-band, never enters model
context). Add to ~/.claude/settings.json:
"statusLine": { "type": "command", "command": "lynkr-statusline" }
◆ Opus 4.8 · MEDIUM → minimax-m3:cloud (ollama) · today $0.06 · cache 67%
Always prints exactly one line and always exits 0 — a down proxy can never
break the harness. Set LYNKR_PORT if Lynkr isn't on 8081.
Per-request cost is computed from a model-pricing registry (LiteLLM → models.dev,
cached 24h) and recorded in telemetry. Models the registry doesn't know record
cost_usd=null (logged once) rather than a fabricated price. Pin prices for
unknown models:
# Per-1M-token USD prices, JSON keyed by model name
MODEL_PRICE_OVERRIDES={"my-model":{"input":0.5,"output":1.5}}
MEMORY_ENABLED=true
MEMORY_TTL=3600000 # 1 hour
LOAD_SHEDDING_ENABLED=true
LOAD_SHEDDING_HEAP_THRESHOLD=0.85
curl -X POST http://localhost:8081/v1/admin/reload
Graphify provides AST-based code analysis for smarter routing decisions.
Installation (Rust required):
# Install Rust if not already installed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
# Build and install graphify
git clone https://github.com/safishamsi/graphify
cd graphify
cargo build --release
sudo cp target/release/graphify /usr/local/bin/
# Verify installation
graphify --version
Enable in .env:
CODE_GRAPH_ENABLED=true
CODE_GRAPH_WORKSPACE=/path/to/your/project # Optional, defaults to cwd
Features:
Note: Graphify is completely optional. If not installed, Lynkr falls back to simpler complexity analysis.
NPM (recommended)
npm install -g lynkr
One-line installer
curl -fsSL https://raw.githubusercontent.com/Fast-Editor/Lynkr/main/install.sh | bash
Homebrew (macOS / Linux)
brew tap fast-editor/lynkr
brew install lynkr
lynkr --version
Upgrade later with brew update && brew upgrade lynkr. The formula tracks the latest lynkr npm release automatically.
Docker
git clone https://github.com/Fast-Editor/Lynkr.git
cd Lynkr
docker-compose up -d
From source
git clone https://github.com/Fast-Editor/Lynkr.git
cd Lynkr
npm install
cp .env.example .env
npm start
Head-to-head against LiteLLM on the same backends (Ollama minimax-m2.5, Moonshot, Azure OpenAI), 9 scenarios across 4 feature categories. Apples-to-apples comparison is Lynkr vs LiteLLM billed tokens on the same scenario. Run with node benchmark-tier-routing.js.
Runs: token benchmarks — June 5, 2026 (Lynkr v9.3.2 · LiteLLM v1.87.1). Tier routing head-to-head — re-run July 19, 2026 (Lynkr working tree w/ Phase-6 classifier + config B · LiteLLM v1.94.0.dev1 Auto Router v2). macOS, Apple Silicon.
Lynkr binary-compresses large JSON tool results (TOON) in-process, with no added latency.
Near-identical prompts return cached responses in 171ms. Zero model tokens billed on a cache hit.
LiteLLM v1.94 shipped a native complexity router (auto_router/complexity_router) with the same four tier names Lynkr uses. Head-to-head on the same backends with identical prompts, both proxies live, both judged against the same acceptable-tier sets (11 routing scenarios, MODE=routing node benchmark-tier-routing.js, LiteLLM config in litellm-autorouter-v2.yaml):
The 7 requests LiteLLM v2 misroutes to a 7B ollama model (should be COMPLEX or REASONING):
Lynkr layers the following, in decreasing priority, to catch every miss LiteLLM leaks:
ultrathink, prove, security audit, from first principles) → deterministic top-tierAUTONOMOUS workflows) → REASONING minimumTYPESAFE_API_KEY) reconciles borderline anchor calls — no local Ollama required; the earlier qwen2.5:3b classifier is kept darkLiteLLM's router reads the raw last message with no envelope-stripping, no verify-then-escalate cascade, no risk classifier, no agentic detection — its fallbacks trigger only on HTTP errors, never on a bad answer.
Fairness notes: the 11 scenarios derive from Lynkr's own regression suite, so Lynkr has home-field advantage — the transferable finding is the direction of LiteLLM's failures (systematic under-routing to cheap on hard prompts), not the exact scores. Lynkr's top tiers used Claude Opus 4.8 / z.ai GLM-5.2; LiteLLM was given the identical tier targets.
Direct cost (raw meter):
Effective cost per correct-tier answer (July 19 head-to-head, all 11 routing scenarios):
The story isn't "Lynkr always spends less." It's Lynkr spends where it should and doesn't where it shouldn't. LiteLLM's zero-dollar cost on complex prompts is bought with wrong-tier answers to hard work — a 7B model answering "prove this rate limiter is fair under concurrent refill" is silent quality collapse, not a savings.
With tier routing + token optimization: additional 50-87% savings on cloud providers depending on workload.
Lynkr's edge: Purpose-built for AI coding tools. Compresses tokens before they reach the model — not just after. Zero-config for Claude Code, Cursor, and Codex. Installs in one command.
This project follows our Code of Conduct — it applies in all project spaces, and it tells you exactly how to report a problem.
Apache 2.0 — See LICENSE.
Built by Vishal Veera Reddy for developers who want control over their AI tools.
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
{ "mcpServers": { "lynkr": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}Visão geral
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.
Ferramentas
Ainda não há lista de ferramentas. Servidores remotos recebem uma após a primeira verificação de saúde.
Perguntas frequentes
Copie nesta página a configuração stdio para Cursor, Claude Desktop, Claude Code ou VS Code. Ela usa a instalação do publicador, não um proxy do PlugMCP.
Este registro não lista nenhuma variável de ambiente obrigatória.
Lynkr roda localmente via stdio.
Última verificação: 2026-11-15. 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.