Self-host Lynkr
v9.6.0LLM gateway that compresses and tier-routes coding traffic
$ docker run -d --name lynkr -p 8081:8081 -e MODEL_PROVIDER=databricks lynkr:latest- Stars
- 639
- RAM
- 8GB+ RAM for 7-8B models, 16GB+ RAM for 14B models (local model hosting)
- Ports
- 8081 (HTTP proxy/gateway and built-in dashboard (configurable via PORT)), 8787 (optional Headroom context-compression sidecar container)
- Requires
- Node.js
What is Lynkr?
Lynkr is a Node.js gateway that fronts AI coding assistants — Claude Code, Cursor, the Codex CLI, Cline and Continue.dev — and answers both the Anthropic-style and the OpenAI-compatible endpoint formats, so clients need no code changes. On the way to the model it binary-compresses large JSON tool results (87.6% fewer tokens on a 60-item grep array in its own benchmark), drops tool schemas a request will not use, and answers near-duplicate prompts from a semantic cache in roughly 171ms with nothing billed. Each request can be scored for difficulty and sent to one of four tiers configured as provider:model pairs, keeping easy turns on a free local Ollama model while hard ones escalate to cloud capacity; sessions stay pinned to one model until a guard forces a re-route. A dashboard served under /dashboard reports spend, counterfactual savings, tier mix, routing accuracy, logs and provider health, alongside Prometheus metrics, health endpoints and a no-restart admin reload. Installation is a global npm package (also a Homebrew tap, a curl installer, Docker Compose or a source build), configuration is an interactive lynkr init wizard or a .env file, and the gateway listens on port 8081 with local SQLite files for its data. It is Apache 2.0 licensed, free, and the project itself notes that several provider entries are documented but not yet probed against live keys.
Should you self-host Lynkr?
Lynkr scores 48/100 on selfhost.directory (how scoring works) and ranks #59 of 125 in AI. It has 639 GitHub stars.
There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.
Setup is easy: most people get it running in one sitting. It is Apache-2.0-licensed and written mostly in JavaScript.
Its closest alternative on selfhost.directory is OmniRoute (88/100, 82 107 stars). It scores higher overall, so compare the two before you pick. See Lynkr vs OmniRoute side by side.
Features
- Built-in Dashboard
- Complexity tier routingAll four TIER_* variables must be set for tier routing to activate.
- Cost tracking with model pricing
- Health check endpoints
- Interactive setup wizard
- Load shedding and fallback
- Long-term MemoryDisabled by default; enabled with MEMORY_ENABLED=true.
- MCP Support
- Prometheus Metrics
- Semantic Caching
- SSE streaming
- Sticky Sessions
- Token compression of tool results
- Tool schema pruning
- Wrap mode for AI coding tools
Lynkr README
How to install Lynkr
Install Lynkr with Docker
MODEL_PROVIDER, PORT, LOG_LEVELdocker build -t lynkr:latest .
docker run -d \
--name lynkr \
-p 8081:8081 \
-e MODEL_PROVIDER=databricks \
lynkr:latest
Standalone container; credentials passed as environment variables and ./data mounted for persistence.
Install Lynkr with Docker Compose
MODEL_PROVIDER, PORT, TIER_*, OLLAMA_ENDPOINT, HEADROOM_ENABLEDgit clone https://github.com/Fast-Editor/Lynkr.git
cd Lynkr
cp .env.example .env
docker-compose up -d
The compose file builds the local image lynkr:9.7.2 and offers optional Ollama, SearXNG and Headroom sidecar services.
Install Lynkr with Linux
curl -fsSL https://raw.githubusercontent.com/Fast-Editor/Lynkr/main/install.sh | bash
Clones Lynkr to ~/.lynkr, installs dependencies, creates a default .env and sets up the lynkr command.
Install Lynkr with NPM
MODEL_PROVIDER, PORT, TIER_SIMPLE, TIER_MEDIUM, TIER_COMPLEX, TIER_REASONINGnpm install -g lynkr
lynkr start
Interactive configuration afterwards with `lynkr init`, or copy .env.example to .env.
Install Lynkr with Homebrew
brew tap fast-editor/lynkr
brew install lynkr
lynkr --version
macOS / Linux; the formula tracks the latest lynkr npm release.
Install Lynkr with Build from Source
git clone https://github.com/Fast-Editor/Lynkr.git
cd Lynkr
npm install
cp .env.example .env
npm start
How to configure Lynkr
AGENTS_ENABLED=trueDESCRIPTION: Inject agent-delegation instructions into the system prompt when the client declares a Task tool (tools always execute on the client). Values: true | falseDESCRIPTION: Inject agent-delegation instructions into the system prompt when the client declares a Task tool (tools always execute on the client). Values: true | false
ANTHROPIC_API_KEYAnthropic (direct + OAuth subscription mode) OAuth mode: when using `lynkr wrap claude`, the OAuth token from `claude login` is forwarded automatically — no API key needed. DESCRIPTION: Anthropic API key. Only needed when NOT using OAuth subscription.Anthropic (direct + OAuth subscription mode) OAuth mode: when using `lynkr wrap claude`, the OAuth token from `claude login` is forwarded automatically — no API key needed. DESCRIPTION: Anthropic API key. Only needed when NOT using OAuth subscription.
ATLASCLOUD_API_KEYAtlas Cloud (OpenAI-compatible) DESCRIPTION: Atlas Cloud API key from https://www.atlascloud.ai/console/api-keys.Atlas Cloud (OpenAI-compatible) DESCRIPTION: Atlas Cloud API key from https://www.atlascloud.ai/console/api-keys.
ATLASCLOUD_ENDPOINT=https://api.atlascloud.ai/v1/chat/completionsDESCRIPTION: Atlas Cloud Chat Completions endpoint.DESCRIPTION: Atlas Cloud Chat Completions endpoint.
ATLASCLOUD_MODEL=qwen/qwen3.8-maxDESCRIPTION: Default Atlas Cloud text model.DESCRIPTION: Default Atlas Cloud text model.
AWS_BEDROCK_API_KEYAWS Bedrock (uses Bedrock API Key, NOT IAM) DESCRIPTION: Bedrock bearer API key (starts with ABSK, generated in AWS console).AWS Bedrock (uses Bedrock API Key, NOT IAM) DESCRIPTION: Bedrock bearer API key (starts with ABSK, generated in AWS console).
AWS_BEDROCK_MODEL_ID=us.anthropic.claude-3-5-sonnet-20241022-v2:0DESCRIPTION: Default Bedrock model id (often a US inference profile).DESCRIPTION: Default Bedrock model id (often a US inference profile).
AWS_BEDROCK_REGION=us-east-1DESCRIPTION: AWS region.DESCRIPTION: AWS region.
AWS_REGIONDESCRIPTION: Fallback region if AWS_BEDROCK_REGION is unset.DESCRIPTION: Fallback region if AWS_BEDROCK_REGION is unset.
AZURE_ANTHROPIC_API_KEYDESCRIPTION: API key for Azure Anthropic. Not needed if OAuth token is being forwarded.DESCRIPTION: API key for Azure Anthropic. Not needed if OAuth token is being forwarded.
AZURE_ANTHROPIC_ENDPOINT=https://api.anthropic.com/v1/messagesAzure Anthropic (Anthropic-format endpoint, OAuth-friendly) DESCRIPTION: Endpoint URL for Azure-hosted Anthropic (also used as OAuth passthrough target).Azure Anthropic (Anthropic-format endpoint, OAuth-friendly) DESCRIPTION: Endpoint URL for Azure-hosted Anthropic (also used as OAuth passthrough target).
AZURE_ANTHROPIC_VERSION=2023-06-01DESCRIPTION: Anthropic API version header.DESCRIPTION: Anthropic API version header.
AZURE_OPENAI_API_KEYDESCRIPTION: Azure OpenAI API key.DESCRIPTION: Azure OpenAI API key.
AZURE_OPENAI_API_VERSION=2024-08-01-previewDESCRIPTION: API version to use.DESCRIPTION: API version to use.
AZURE_OPENAI_DEPLOYMENT=gpt-4oDESCRIPTION: Deployment name (e.g. gpt-4o, gpt-5.2-chat).DESCRIPTION: Deployment name (e.g. gpt-4o, gpt-5.2-chat).
AZURE_OPENAI_ENDPOINTAzure OpenAI DESCRIPTION: Azure OpenAI endpoint URL (standard or AI Foundry format).Azure OpenAI DESCRIPTION: Azure OpenAI endpoint URL (standard or AI Foundry format).
BAIDU_API_KEYBaidu Qianfan (ERNIE) DESCRIPTION: Baidu Qianfan API key (format: bce-v3/ALTAK-...).Baidu Qianfan (ERNIE) DESCRIPTION: Baidu Qianfan API key (format: bce-v3/ALTAK-...).
BAIDU_ENDPOINT=https://qianfan.baidubce.com/v2/chat/completionsDESCRIPTION: Qianfan v2 OpenAI-compatible chat completions endpoint.DESCRIPTION: Qianfan v2 OpenAI-compatible chat completions endpoint.
BAIDU_MODEL=glm-5.2DESCRIPTION: Default Baidu ERNIE model.DESCRIPTION: Default Baidu ERNIE model.
CAVEMAN_ENABLEDDESCRIPTION: Caveman terse-output injection (cuts output tokens at the cost of style). Values: true | falseDESCRIPTION: Caveman terse-output injection (cuts output tokens at the cost of style). Values: true | false
CAVEMAN_LEVEL=liteDESCRIPTION: Aggressiveness of the brevity instruction. Values: lite | full | ultraDESCRIPTION: Aggressiveness of the brevity instruction. Values: lite | full | ultra
CLUSTER_ENABLED=falseDESCRIPTION: Run the proxy in multi-worker cluster mode. Values: true | falseDESCRIPTION: Run the proxy in multi-worker cluster mode. Values: true | false
CLUSTER_WORKERS=autoDESCRIPTION: Worker count. Values: auto | <integer>DESCRIPTION: Worker count. Values: auto | <integer>
CODE_GRAPH_COMMAND=graphifyDESCRIPTION: External indexer binary the code-graph feature shells out to.DESCRIPTION: External indexer binary the code-graph feature shells out to.
CODE_GRAPH_ENABLED=falseDESCRIPTION: Master switch for the code-graph indexer. Values: true | falseDESCRIPTION: Master switch for the code-graph indexer. Values: true | false
CODE_GRAPH_TIMEOUT=10000DESCRIPTION: Per-call timeout (ms).DESCRIPTION: Per-call timeout (ms).
CODE_GRAPH_WORKSPACEDESCRIPTION: Workspace path the indexer operates on (defaults to cwd).DESCRIPTION: Workspace path the indexer operates on (defaults to cwd).
CODEX_BINARY_PATHDESCRIPTION: Path to the `codex` binary; auto-detected if unset.DESCRIPTION: Path to the `codex` binary; auto-detected if unset.
CODEX_ENABLEDCodex (uses your ChatGPT subscription via local codex CLI) DESCRIPTION: Enable the Codex local provider (requires `codex` CLI installed). Values: true | falseCodex (uses your ChatGPT subscription via local codex CLI) DESCRIPTION: Enable the Codex local provider (requires `codex` CLI installed). Values: true | false
CODEX_MODELDESCRIPTION: Codex model id.DESCRIPTION: Codex model id.
CODEX_TIMEOUTDESCRIPTION: Per-request timeout in ms.DESCRIPTION: Per-request timeout in ms.
CURSOR_AUTO_APPROVEDESCRIPTION: Auto-approve ALL cursor-agent permission requests, shell execution included (passes --force). The sandbox cwd is not a security boundary while this is on. Set false to approve MCPs only and reject edit/execute/delete requests. Values: true | falseDESCRIPTION: Auto-approve ALL cursor-agent permission requests, shell execution included (passes --force). The sandbox cwd is not a security boundary while this is on. Set false to approve MCPs only and reject edit/execute/delete requests. Values: true | false
CURSOR_BINARY_PATHDESCRIPTION: Path to the `cursor-agent` binary; auto-detected if unset.DESCRIPTION: Path to the `cursor-agent` binary; auto-detected if unset.
CURSOR_ENABLEDCursor (uses your Cursor Pro subscription via local cursor-agent CLI) DESCRIPTION: Enable the Cursor local provider (requires `cursor-agent` CLI installed + `agent login`). Values: true | falseCursor (uses your Cursor Pro subscription via local cursor-agent CLI) DESCRIPTION: Enable the Cursor local provider (requires `cursor-agent` CLI installed + `agent login`). Values: true | false
CURSOR_MODELDESCRIPTION: Cursor model id (run `cursor-agent models` to list).DESCRIPTION: Cursor model id (run `cursor-agent models` to list).
CURSOR_TIMEOUTDESCRIPTION: Per-request timeout in ms.DESCRIPTION: Per-request timeout in ms.
DATABRICKS_API_BASEDatabricks DESCRIPTION: Databricks workspace base URL.Databricks DESCRIPTION: Databricks workspace base URL.
DATABRICKS_API_KEYDESCRIPTION: Databricks personal access token.DESCRIPTION: Databricks personal access token.
DATABRICKS_ENDPOINT_PATHDESCRIPTION: Path to the serving endpoint to invoke.DESCRIPTION: Path to the serving endpoint to invoke.
DEBUG_SQLDESCRIPTION: Pretty-print SQL statements to stdout (very verbose). Values: 1 | unsetDESCRIPTION: Pretty-print SQL statements to stdout (very verbose). Values: 1 | unset
EDENAI_API_KEYEden AI (600+ models via single API, OpenAI-compatible, EU/GDPR) DESCRIPTION: Eden AI API key.Eden AI (600+ models via single API, OpenAI-compatible, EU/GDPR) DESCRIPTION: Eden AI API key.
EDENAI_EMBEDDINGS_MODEL=openai/text-embedding-ada-002DESCRIPTION: Embedding model used through Eden AI.DESCRIPTION: Embedding model used through Eden AI.
EDENAI_ENDPOINT=https://api.edenai.run/v3/chat/completionsDESCRIPTION: Eden AI chat completions endpoint (OpenAI-compatible v3).DESCRIPTION: Eden AI chat completions endpoint (OpenAI-compatible v3).
EDENAI_MODEL=openai/gpt-4o-miniDESCRIPTION: Default Eden AI model (provider/model naming).DESCRIPTION: Default Eden AI model (provider/model naming).
EMBEDDINGS_PROVIDEREmbeddings provider override DESCRIPTION: Force a specific embeddings provider (otherwise inferred from MODEL_PROVIDER). One of: ollama, llamacpp, openrouter, openaiEmbeddings provider override DESCRIPTION: Force a specific embeddings provider (otherwise inferred from MODEL_PROVIDER). One of: ollama, llamacpp, openrouter, openai
FALLBACK_ENABLED=falseDESCRIPTION: Auto-fallback when the tier provider fails. Auto-true under tier routing. Values: true | falseDESCRIPTION: Auto-fallback when the tier provider fails. Auto-true under tier routing. Values: true | false
FALLBACK_PROVIDER=databricksDESCRIPTION: Fallback provider when tier provider fails (cannot be local). One of: databricks, azure-anthropic, azure-openai, openrouter, edenai, openai, atlas, bedrockDESCRIPTION: Fallback provider when tier provider fails (cannot be local). One of: databricks, azure-anthropic, azure-openai, openrouter, edenai, openai, atlas, bedrock
FILES_MAX_COUNT=1000DESCRIPTION: Max stored files (LRU cap).DESCRIPTION: Max stored files (LRU cap).
FILES_MAX_SIZE_MB=100DESCRIPTION: Max per-file size in MB.DESCRIPTION: Max per-file size in MB.
FILES_STORAGE_PATH=./data/filesDESCRIPTION: Storage path for the Files tool.DESCRIPTION: Storage path for the Files tool.
FIREWORKS_API_KEYFireworks AI (serverless open models) DESCRIPTION: Fireworks API key (format: fw-...). Get one at fireworks.ai.Fireworks AI (serverless open models) DESCRIPTION: Fireworks API key (format: fw-...). Get one at fireworks.ai.
FIREWORKS_ENDPOINT=https://api.fireworks.ai/inference/v1/chat/completionsDESCRIPTION: Fireworks OpenAI-compatible chat completions endpoint.DESCRIPTION: Fireworks OpenAI-compatible chat completions endpoint.
FIREWORKS_MODEL=accounts/fireworks/models/kimi-k2-instruct-0905DESCRIPTION: Default Fireworks model (long-form serverless id). Dated suffixes rotate — check https://app.fireworks.ai/models for current ids.DESCRIPTION: Default Fireworks model (long-form serverless id). Dated suffixes rotate — check https://app.fireworks.ai/models for current ids.
FIREWORKS_REASONING_EFFORTFireworks / OpenAI-compatible: reasoning effort and schema forwardingFireworks / OpenAI-compatible: reasoning effort and schema forwarding
FIREWORKS_REASONING_EFFORT_MAPFMT_GUARD_ENABLEDDisable the markdown format guard (contradicts clients that demand raw JSON).Disable the markdown format guard (contradicts clients that demand raw JSON).
FORCE_TIER_PATTERNSRouting hygiene for agent harnesses / structured-output clients Disable keyword-driven force escalation (shouldForceCloud/shouldForceReasoning).Routing hygiene for agent harnesses / structured-output clients Disable keyword-driven force escalation (shouldForceCloud/shouldForceReasoning).
GCF_ENABLED=falseDESCRIPTION: Enable GCF (Graph Compact Format) encoding for large structured payloads. Drop-in alternative to TOON; takes precedence over TOON when enabled. Opt-in. Values: true | falseDESCRIPTION: Enable GCF (Graph Compact Format) encoding for large structured payloads. Drop-in alternative to TOON; takes precedence over TOON when enabled. Opt-in. Values: true | false
GCF_FAIL_OPEN=trueDESCRIPTION: Continue without GCF on encoder failure instead of erroring. Values: true | falseDESCRIPTION: Continue without GCF on encoder failure instead of erroring. Values: true | false
GCF_LOG_STATS=trueDESCRIPTION: Log per-request GCF savings stats. Values: true | falseDESCRIPTION: Log per-request GCF savings stats. Values: true | false
GCF_MIN_BYTES=4096DESCRIPTION: Minimum byte size before GCF encoding kicks in.DESCRIPTION: Minimum byte size before GCF encoding kicks in.
GCF_VERIFY=trueDESCRIPTION: Round-trip verify each encoding and keep the original JSON on any mismatch (makes the compression provably lossless per payload; adds one decode per converted blob). Values: true | falseDESCRIPTION: Round-trip verify each encoding and keep the original JSON on any mismatch (makes the compression provably lossless per payload; adds one decode per converted blob). Values: true | false
GOOGLE_API_KEYDESCRIPTION: Fallback Google API key if VERTEX_API_KEY is unset.DESCRIPTION: Fallback Google API key if VERTEX_API_KEY is unset.
HEADROOM_CACHE_ALIGNER=trueDESCRIPTION: Cache-aligner transform (align cache breakpoints). Values: true | falseDESCRIPTION: Cache-aligner transform (align cache breakpoints). Values: true | false
HEADROOM_CCR=trueDESCRIPTION: CCR (Compress-Cache-Retrieve) mode. Values: true | falseDESCRIPTION: CCR (Compress-Cache-Retrieve) mode. Values: true | false
HEADROOM_CCR_TTL=300DESCRIPTION: TTL for CCR cached chunks (seconds).DESCRIPTION: TTL for CCR cached chunks (seconds).
HEADROOM_DOCKER_AUTO_BUILD=trueDESCRIPTION: Auto-build the image if not found locally. Values: true | falseDESCRIPTION: Auto-build the image if not found locally. Values: true | false
HEADROOM_DOCKER_BUILD_CONTEXT=./headroom-sidecarDESCRIPTION: Build context path when auto-building the sidecar image.DESCRIPTION: Build context path when auto-building the sidecar image.
HEADROOM_DOCKER_CONTAINER_NAME=lynkr-headroomDESCRIPTION: Sidecar container name.DESCRIPTION: Sidecar container name.
HEADROOM_DOCKER_CPU_LIMIT=1.0DESCRIPTION: Sidecar CPU limit.DESCRIPTION: Sidecar CPU limit.
HEADROOM_DOCKER_ENABLED=trueDESCRIPTION: Auto-manage a Docker container for the sidecar. Values: true | falseDESCRIPTION: Auto-manage a Docker container for the sidecar. Values: true | false
HEADROOM_DOCKER_IMAGE=lynkr/headroom-sidecar:latestDESCRIPTION: Sidecar image name.DESCRIPTION: Sidecar image name.
HEADROOM_DOCKER_MEMORY_LIMIT=512mDESCRIPTION: Sidecar memory limit.DESCRIPTION: Sidecar memory limit.
HEADROOM_DOCKER_NETWORKDESCRIPTION: Optional Docker network the sidecar joins.DESCRIPTION: Optional Docker network the sidecar joins.
HEADROOM_DOCKER_PORT=8787DESCRIPTION: Host port the sidecar publishes on.DESCRIPTION: Host port the sidecar publishes on.
HEADROOM_DOCKER_RESTART_POLICY=unless-stoppedDESCRIPTION: Docker restart policy for the sidecar.DESCRIPTION: Docker restart policy for the sidecar.
HEADROOM_ENABLED=trueDESCRIPTION: Master switch for Headroom sidecar context compression. Values: true | falseDESCRIPTION: Master switch for Headroom sidecar context compression. Values: true | false
HEADROOM_ENDPOINT=http://localhost:8787DESCRIPTION: Headroom sidecar endpoint.DESCRIPTION: Headroom sidecar endpoint.
HEADROOM_KEEP_TURNS=10DESCRIPTION: How many recent turns the rolling window keeps verbatim.DESCRIPTION: How many recent turns the rolling window keeps verbatim.
HEADROOM_LLMLINGUA=falseDESCRIPTION: LLMLingua ML compression (requires GPU). Values: true | falseDESCRIPTION: LLMLingua ML compression (requires GPU). Values: true | false
HEADROOM_LLMLINGUA_DEVICE=autoDESCRIPTION: Device for LLMLingua model. Values: auto | cpu | cuda | mpsDESCRIPTION: Device for LLMLingua model. Values: auto | cpu | cuda | mps
HEADROOM_LOG_LEVEL=infoDESCRIPTION: Sidecar log level. Values: debug | info | warning | errorDESCRIPTION: Sidecar log level. Values: debug | info | warning | error
HEADROOM_MIN_TOKENSDESCRIPTION: Skip compression below this estimated token count.DESCRIPTION: Skip compression below this estimated token count.
HEADROOM_MODE=optimizeDESCRIPTION: Operating mode. Values: audit (observe only) | optimize (apply)DESCRIPTION: Operating mode. Values: audit (observe only) | optimize (apply)
HEADROOM_PROVIDER=anthropicDESCRIPTION: Provider hint that selects which cache markers to emit. Values: anthropic | openai | googleDESCRIPTION: Provider hint that selects which cache markers to emit. Values: anthropic | openai | google
HEADROOM_ROLLING_WINDOW=trueDESCRIPTION: Rolling-window transform (keep newest N turns intact). Values: true | falseDESCRIPTION: Rolling-window transform (keep newest N turns intact). Values: true | false
HEADROOM_SMART_CRUSHER=trueDESCRIPTION: Smart-crusher transform (compress large text blocks). Values: true | falseDESCRIPTION: Smart-crusher transform (compress large text blocks). Values: true | false
HEADROOM_SMART_CRUSHER_MAX_ITEMS=15DESCRIPTION: Max items the smart-crusher processes per request.DESCRIPTION: Max items the smart-crusher processes per request.
HEADROOM_SMART_CRUSHER_MIN_TOKENSDESCRIPTION: Min token count before smart-crusher engages.DESCRIPTION: Min token count before smart-crusher engages.
HEADROOM_TIMEOUT_MS=5000DESCRIPTION: Sidecar request timeout in ms.DESCRIPTION: Sidecar request timeout in ms.
HEADROOM_TOOL_CRUSHER=trueDESCRIPTION: Tool-crusher transform (compress large tool results). Values: true | falseDESCRIPTION: Tool-crusher transform (compress large tool results). Values: true | false
HISTORY_COMPRESSION_ENABLED=trueDESCRIPTION: Summarize older history turns instead of dropping them. Values: true | falseDESCRIPTION: Summarize older history turns instead of dropping them. Values: true | false
HISTORY_KEEP_RECENT_TURNS=10DESCRIPTION: How many recent turns to keep verbatim.DESCRIPTION: How many recent turns to keep verbatim.
HISTORY_SUMMARIZE_OLDER=trueDESCRIPTION: Summarize history older than the recent window. Values: true | falseDESCRIPTION: Summarize history older than the recent window. Values: true | false
HOT_RELOAD_DEBOUNCE_MS=1000DESCRIPTION: Debounce window for the reload watcher (ms).DESCRIPTION: Debounce window for the reload watcher (ms).
HOT_RELOAD_ENABLEDDESCRIPTION: Hot-reload config when .env changes. Values: true | falseDESCRIPTION: Hot-reload config when .env changes. Values: true | false
INJECT_TOOLS_LLAMACPP=trueDESCRIPTION: Inject native tool definitions into llama.cpp requests. Values: true | false (default true)DESCRIPTION: Inject native tool definitions into llama.cpp requests. Values: true | false (default true)
INJECT_TOOLS_OLLAMA=trueDESCRIPTION: Inject native tool definitions into Ollama requests (for models without tool-calling). Values: true | false (default true)DESCRIPTION: Inject native tool definitions into Ollama requests (for models without tool-calling). Values: true | false (default true)
LARGE_PAYLOAD_OPTIMIZATION=trueDESCRIPTION: Large-payload optimization (chunked encoding, streaming). Values: true | falseDESCRIPTION: Large-payload optimization (chunked encoding, streaming). Values: true | false
LARGE_PAYLOAD_THRESHOLD=1048576DESCRIPTION: Bytes that count as a "large" payload.DESCRIPTION: Bytes that count as a "large" payload.
LLAMACPP_API_KEYDESCRIPTION: Optional bearer token if your llama.cpp server requires auth.DESCRIPTION: Optional bearer token if your llama.cpp server requires auth.
LLAMACPP_EMBEDDINGS_ENDPOINT=http://localhost:8080/embeddingsDESCRIPTION: Embeddings endpoint (defaults to ENDPOINT + /embeddings).DESCRIPTION: Embeddings endpoint (defaults to ENDPOINT + /embeddings).
LLAMACPP_ENDPOINT=http://localhost:8080llama.cpp (local GGUF server) DESCRIPTION: llama.cpp server base URL.llama.cpp (local GGUF server) DESCRIPTION: llama.cpp server base URL.
LLAMACPP_MODEL=defaultDESCRIPTION: llama.cpp model name to request.DESCRIPTION: llama.cpp model name to request.
LLAMACPP_TIMEOUT_MS=120000DESCRIPTION: Per-request timeout in ms.DESCRIPTION: Per-request timeout in ms.
LLM_AUDIT_ANNOTATIONS=trueDESCRIPTION: Include audit annotations on each entry. Values: true | falseDESCRIPTION: Include audit annotations on each entry. Values: true | false
LLM_AUDIT_DEDUP_CACHE_SIZE=100DESCRIPTION: LRU cache size for the dedup dictionary.DESCRIPTION: LRU cache size for the dedup dictionary.
LLM_AUDIT_DEDUP_DICT_PATHDESCRIPTION: Path to the dedup dictionary file.DESCRIPTION: Path to the dedup dictionary file.
LLM_AUDIT_DEDUP_ENABLED=trueDESCRIPTION: Deduplicate repeated audit payloads via dictionary compression. Values: true | falseDESCRIPTION: Deduplicate repeated audit payloads via dictionary compression. Values: true | false
LLM_AUDIT_DEDUP_MIN_SIZE=500DESCRIPTION: Smallest payload size (bytes) eligible for dedup.DESCRIPTION: Smallest payload size (bytes) eligible for dedup.
LLM_AUDIT_DEDUP_SANITIZE=trueDESCRIPTION: Sanitize secrets out of dedup-eligible payloads. Values: true | falseDESCRIPTION: Sanitize secrets out of dedup-eligible payloads. Values: true | false
LLM_AUDIT_DEDUP_SESSION_CACHE=trueDESCRIPTION: Cache dedup state per session. Values: true | falseDESCRIPTION: Cache dedup state per session. Values: true | false
LLM_AUDIT_ENABLED=falseDESCRIPTION: Master switch for the LLM audit log. Values: true | falseDESCRIPTION: Master switch for the LLM audit log. Values: true | false
LLM_AUDIT_LOG_FILEDESCRIPTION: Audit log file path.DESCRIPTION: Audit log file path.
LLM_AUDIT_MAX_CONTENT_LENGTH=5000DESCRIPTION: Legacy fallback for max content length.DESCRIPTION: Legacy fallback for max content length.
LLM_AUDIT_MAX_FILES=30DESCRIPTION: Rotated audit file count.DESCRIPTION: Rotated audit file count.
LLM_AUDIT_MAX_RESPONSE_LENGTH=3000DESCRIPTION: Max response chars retained per audit entry.DESCRIPTION: Max response chars retained per audit entry.
LLM_AUDIT_MAX_SIZE=100MDESCRIPTION: Per-file rotation size.DESCRIPTION: Per-file rotation size.
LLM_AUDIT_MAX_SYSTEM_LENGTH=2000DESCRIPTION: Max system-prompt chars retained per audit entry.DESCRIPTION: Max system-prompt chars retained per audit entry.
LLM_AUDIT_MAX_USER_LENGTH=3000DESCRIPTION: Max user-message chars retained per audit entry.DESCRIPTION: Max user-message chars retained per audit entry.
LMSTUDIO_API_KEYDESCRIPTION: Optional bearer token.DESCRIPTION: Optional bearer token.
LMSTUDIO_ENDPOINT=http://localhost:1234LM Studio DESCRIPTION: LM Studio OpenAI-compatible endpoint.LM Studio DESCRIPTION: LM Studio OpenAI-compatible endpoint.
LMSTUDIO_MODEL=defaultDESCRIPTION: LM Studio model id to request.DESCRIPTION: LM Studio model id to request.
LMSTUDIO_TIMEOUT_MS=120000DESCRIPTION: Per-request timeout in ms.DESCRIPTION: Per-request timeout in ms.
LOAD_SHEDDING_ACTIVE_REQUESTS_THRESHOLD=1000DESCRIPTION: In-flight request count above which load shedding triggers.DESCRIPTION: In-flight request count above which load shedding triggers.
LOAD_SHEDDING_HEAP_THRESHOLD=0.95DESCRIPTION: Heap-utilization fraction above which load shedding triggers.DESCRIPTION: Heap-utilization fraction above which load shedding triggers.
LOAD_SHEDDING_MEMORY_THRESHOLD=0.85DESCRIPTION: RSS-memory fraction above which load shedding triggers.DESCRIPTION: RSS-memory fraction above which load shedding triggers.
LOG_FILE_ENABLEDDESCRIPTION: Persistent file logging via pino-roll. Values: true | falseDESCRIPTION: Persistent file logging via pino-roll. Values: true | false
LOG_FILE_FREQUENCYDESCRIPTION: Roll frequency. Values: daily | hourly | <bytes>DESCRIPTION: Roll frequency. Values: daily | hourly | <bytes>
LOG_FILE_LEVELDESCRIPTION: Log file verbosity.DESCRIPTION: Log file verbosity.
LOG_FILE_MAX_FILESDESCRIPTION: Max rotated files to retain.DESCRIPTION: Max rotated files to retain.
LOG_FILE_PATHDESCRIPTION: Log file path.DESCRIPTION: Log file path.
LOG_LEVEL=infoDESCRIPTION: Pino log level. Values: trace | debug | info | warn | error | fatal | silentDESCRIPTION: Pino log level. Values: trace | debug | info | warn | error | fatal | silent
LYNKR_BUDGET_ENFORCER=trueDESCRIPTION: Master switch for the budget enforcer middleware. Values: true | false (set "false" to disable)DESCRIPTION: Master switch for the budget enforcer middleware. Values: true | false (set "false" to disable)
LYNKR_CACHE_BYPASS_STRUCTUREDStructured-output requests bypass the response cache (default true).Structured-output requests bypass the response cache (default true).
LYNKR_CASCADE_ENABLED=falseDESCRIPTION: Enable cascading retry/escalation between tiers. Values: true | falseDESCRIPTION: Enable cascading retry/escalation between tiers. Values: true | false
LYNKR_CASCADE_VERIFYDESCRIPTION: WS6 cascade verification (EXPERIMENTAL). After a cheap-tier (SIMPLE/MEDIUM) response, run structural checks (language drift, degeneration, truncation, malformed tool calls, empty/echo) plus a coarse content score. A failing answer is DISCARDED and the request escalates up the tier ladder — a routing mistake costs seconds, not a garbage answer. Failed attempts feed the learning loop asDESCRIPTION: WS6 cascade verification (EXPERIMENTAL). After a cheap-tier (SIMPLE/MEDIUM) response, run structural checks (language drift, degeneration, truncation, malformed tool calls, empty/echo) plus a coarse content score. A failing answer is DISCARDED and the request escalates up the tier ladder — a routing mistake costs seconds, not a garbage answer. Failed attempts feed the learning loop as
LYNKR_COST_OPTIMIZE=trueDESCRIPTION: Cost-optimized routing (downgrade tier when safe). Values: true | falseDESCRIPTION: Cost-optimized routing (downgrade tier when safe). Values: true | false
LYNKR_DECISION_HEADERSEmit X-Lynkr-Decision / X-Lynkr-Decision-Tier / X-Lynkr-Signals response headers.Emit X-Lynkr-Decision / X-Lynkr-Decision-Tier / X-Lynkr-Signals response headers.
LYNKR_EMBEDDINGS_MAX_CHARSMax characters sent to the embedding model (default 5000; nomic-embed-text has a 2048-token context).Max characters sent to the embedding model (default 5000; nomic-embed-text has a 2048-token context).
LYNKR_FORWARD_RESPONSE_FORMATForward the client's output_format / response_format upstream (default true).Forward the client's output_format / response_format upstream (default true).
LYNKR_INTENT_DECAY=0.7DESCRIPTION: Per-turn exponential decay applied during window scoring. weighted_score = raw_score * decay^age, where age=0 is the latest user message. Higher (~0.9) = old turns linger longer; lower (~0.5) = old turns forgotten faster. 0.7 means a complex turn from 4 messages back contributes ~24% of its raw score to the max comparison. Values: float in (0, 1] (default 0.7).DESCRIPTION: Per-turn exponential decay applied during window scoring. weighted_score = raw_score * decay^age, where age=0 is the latest user message. Higher (~0.9) = old turns linger longer; lower (~0.5) = old turns forgotten faster. 0.7 means a complex turn from 4 messages back contributes ~24% of its raw score to the max comparison. Values: float in (0, 1] (default 0.7).
LYNKR_INTENT_WINDOW_N=5DESCRIPTION: For OAuth/subscription requests, score the last N user messages instead of just the latest one. Catches "this conversation HAD a complex turn earlier" (e.g. an "audit credentials" ask 4 turns back) without inflating short follow-ups ("yes", "continue"). Combined with LYNKR_INTENT_DECAY as exponential recency weighting; the message with the highest decayed score wins. Values: positiveDESCRIPTION: For OAuth/subscription requests, score the last N user messages instead of just the latest one. Catches "this conversation HAD a complex turn earlier" (e.g. an "audit credentials" ask 4 turns back) without inflating short follow-ups ("yes", "continue"). Combined with LYNKR_INTENT_DECAY as exponential recency weighting; the message with the highest decayed score wins. Values: positive
LYNKR_KNN_CONFIDENCE_HIGH=0.7DESCRIPTION: HIGH-confidence threshold above which a kNN suggestion overrides the tier-config model directly. Values in (0, 1].DESCRIPTION: HIGH-confidence threshold above which a kNN suggestion overrides the tier-config model directly. Values in (0, 1].
LYNKR_KNN_CONFIDENCE_LOW=0.4DESCRIPTION: LOW-confidence threshold. Between LOW and HIGH the suggestion is treated as "ambiguous" and — subject to the WS2 leash (only escalate when telemetry.underProvisionedPct ≥ 2%) — may bump the tier one level for safety.DESCRIPTION: LOW-confidence threshold. Between LOW and HIGH the suggestion is treated as "ambiguous" and — subject to the WS2 leash (only escalate when telemetry.underProvisionedPct ≥ 2%) — may bump the tier one level for safety.
LYNKR_KNN_ENABLEDSkip the kNN router and its embedding call entirely.Skip the kNN router and its embedding call entirely.
LYNKR_KNN_MIN_INDEX_SIZE=100---- Learning loop (WS5) ------------------------------------------- DESCRIPTION: Minimum kNN index size before the router will use its advice. Below this size the router returns null (heuristic wins). Post-WS5 the confidence returned by query() is also damped by min(1, size/1000) so a small index advises weakly rather than not at all. Default 100 (WS5 lowered from the pre-WS5 default of 1000).---- Learning loop (WS5) ------------------------------------------- DESCRIPTION: Minimum kNN index size before the router will use its advice. Below this size the router returns null (heuristic wins). Post-WS5 the confidence returned by query() is also damped by min(1, size/1000) so a small index advises weakly rather than not at all. Default 100 (WS5 lowered from the pre-WS5 default of 1000).
LYNKR_MAX_SESSION_TURNS=200DESCRIPTION: Hard cap on total turns per session. Unset = no cap. Recommended for agentic harnesses: 200DESCRIPTION: Hard cap on total turns per session. Unset = no cap. Recommended for agentic harnesses: 200
LYNKR_MAX_TOOL_TURNS=50DESCRIPTION: Hard cap on consecutive tool-loop turns without new user text. Unset = no cap. Recommended for agentic harnesses: 50DESCRIPTION: Hard cap on consecutive tool-loop turns without new user text. Unset = no cap. Recommended for agentic harnesses: 50
LYNKR_NATIVE_PASSTHROUGH=trueDESCRIPTION: Kill switch for native-format streaming passthrough (Anthropic client + Anthropic upstream pipes SSE bytes straight through, skipping the buffered orchestrator). Values: true | false (default true)DESCRIPTION: Kill switch for native-format streaming passthrough (Anthropic client + Anthropic upstream pipes SSE bytes straight through, skipping the buffered orchestrator). Values: true | false (default true)
LYNKR_OAUTH_PASSTHROUGHDESCRIPTION: Forward incoming OAuth Bearer tokens straight to the upstream Anthropic endpoint. Set automatically by `lynkr wrap claude`. Values: true | falseDESCRIPTION: Forward incoming OAuth Bearer tokens straight to the upstream Anthropic endpoint. Set automatically by `lynkr wrap claude`. Values: true | false
LYNKR_OAUTH_PASSTHROUGH_URLDESCRIPTION: Upstream URL used for OAuth passthrough (defaults to AZURE_ANTHROPIC_ENDPOINT).DESCRIPTION: Upstream URL used for OAuth passthrough (defaults to AZURE_ANTHROPIC_ENDPOINT).
LYNKR_OLLAMA_BUFFER_RESPONSES=trueDESCRIPTION: Buffer Ollama responses instead of streaming. Buffering repairs leaked <think> tags from thinking models (MiniMax) but delivers all at once. Values: true | false (default true — set false to stream)DESCRIPTION: Buffer Ollama responses instead of streaming. Buffering repairs leaked <think> tags from thinking models (MiniMax) but delivers all at once. Values: true | false (default true — set false to stream)
LYNKR_PIN_DRIFT_MARGIN=5DESCRIPTION: WS1.5 upward-drift margin. A pinned session re-decides when the latest user message's heuristic score exceeds the pinned tier's calibrated ceiling + this margin. Smaller = pins escape sooner (more re-routes, better tier fidelity); larger = stickier pins (fewer cold cache reads, risk of under-tiering). Live guidance: with tool-baseline subtraction active, trivial turns score 5-15 and mDESCRIPTION: WS1.5 upward-drift margin. A pinned session re-decides when the latest user message's heuristic score exceeds the pinned tier's calibrated ceiling + this margin. Smaller = pins escape sooner (more re-routes, better tier fidelity); larger = stickier pins (fewer cold cache reads, risk of under-tiering). Live guidance: with tool-baseline subtraction active, trivial turns score 5-15 and m
LYNKR_PREFLIGHT_ENABLED=falseDESCRIPTION: Run client-supplied preflight commands (cwd = workspace) and short-circuit if they all pass. Values: true | falseDESCRIPTION: Run client-supplied preflight commands (cwd = workspace) and short-circuit if they all pass. Values: true | false
LYNKR_PREFLIGHT_TIMEOUT_MS=120000DESCRIPTION: Per-command timeout for preflight checks, in ms.DESCRIPTION: Per-command timeout for preflight checks, in ms.
LYNKR_REGRET_ESTIMATOR=falseDESCRIPTION: Enable the regret-estimator post-hoc routing critic. Values: true | falseDESCRIPTION: Enable the regret-estimator post-hoc routing critic. Values: true | false
LYNKR_ROUTING_CONFIGDeclarative routing (signals → decisions) — config/routing.json Path to the routing config (default: config/routing.json; see config/routing.example.json). The default file has a single `legacy` decision, so routing is unchanged until you add decisions.Declarative routing (signals → decisions) — config/routing.json Path to the routing config (default: config/routing.json; see config/routing.example.json). The default file has a single `legacy` decision, so routing is unchanged until you add decisions.
LYNKR_SHADOW_POLICYDESCRIPTION: Shadow-mode policy name (records what an alt policy would do without applying it).DESCRIPTION: Shadow-mode policy name (records what an alt policy would do without applying it).
LYNKR_STICKY_SESSIONS=true---- Sticky sessions (WS1) ----------------------------------------- DESCRIPTION: Cache-aware sticky session pinning. Once a session is routed, subsequent turns reuse the pinned provider/model instead of re-deciding — avoids a cold-cache re-read (~10× that turn's input cost) on every provider switch. Re-decides on compaction, guard escalation (risk/context/vision), or economic downgrade below the---- Sticky sessions (WS1) ----------------------------------------- DESCRIPTION: Cache-aware sticky session pinning. Once a session is routed, subsequent turns reuse the pinned provider/model instead of re-deciding — avoids a cold-cache re-read (~10× that turn's input cost) on every provider switch. Re-decides on compaction, guard escalation (risk/context/vision), or economic downgrade below the
LYNKR_STICKY_TTL_MS=21600000DESCRIPTION: TTL for a session pin (ms). Older pins are evicted by the 5-minute cleanup tick in src/sessions/cleanup.js. Default: 6 hours (21_600_000 ms).DESCRIPTION: TTL for a session pin (ms). Older pins are evicted by the 5-minute cleanup tick in src/sessions/cleanup.js. Default: 6 hours (21_600_000 ms).
LYNKR_STREAM_IDLE_TIMEOUT_MS=60000DESCRIPTION: Abort a passthrough stream when the upstream goes silent this long.DESCRIPTION: Abort a passthrough stream when the upstream goes silent this long.
LYNKR_STREAM_TRANSFORM=trueDESCRIPTION: Kill switch for cross-format streaming (OpenAI upstream SSE reshaped into Anthropic events in flight instead of buffering). Values: true | false (default true)DESCRIPTION: Kill switch for cross-format streaming (OpenAI upstream SSE reshaped into Anthropic events in flight instead of buffering). Values: true | false (default true)
LYNKR_STREAM_TRANSFORM_PROVIDERSDESCRIPTION: Providers eligible for the cross-format stream transform. Values: comma-separated (default openai,atlas,azure-openai,openrouter,databricks,lmstudio,llamacpp,moonshot)DESCRIPTION: Providers eligible for the cross-format stream transform. Values: comma-separated (default openai,atlas,azure-openai,openrouter,databricks,lmstudio,llamacpp,moonshot)
LYNKR_SWITCH_MAX_PROMPT_TOKENSDESCRIPTION: Prompt-token cap under which an economic downgrade may override the pin. Above this the cold-cache re-read dominates the per-token savings, so the pin wins even if the fresh routing decision picks a cheaper model. Default 20 000.DESCRIPTION: Prompt-token cap under which an economic downgrade may override the pin. Above this the cold-cache re-read dominates the per-token savings, so the pin wins even if the fresh routing decision picks a cheaper model. Default 20 000.
LYNKR_VISIBLE_ROUTING=falseDESCRIPTION: Include `lynkr_interaction` block in every successful response showing where it routed. Values: true | falseDESCRIPTION: Include `lynkr_interaction` block in every successful response showing where it routed. Values: true | false
LYNKR_WRAP_SHOW_STATS=trueDESCRIPTION: Show stats summary on exit when running `lynkr wrap claude`. Values: true | falseDESCRIPTION: Show stats summary on exit when running `lynkr wrap claude`. Values: true | false
MARKDOWN_RENDER_ANSI=falseDESCRIPTION: Render markdown to ANSI for CLIs without a markdown renderer. Leave false for Claude Code (it renders markdown itself). Values: true | falseDESCRIPTION: Render markdown to ANSI for CLIs without a markdown renderer. Leave false for Claude Code (it renders markdown itself). Values: true | false
MCP_MANIFEST_DIRS=~/.claude/mcpDESCRIPTION: Comma-separated directories scanned for MCP manifests.DESCRIPTION: Comma-separated directories scanned for MCP manifests.
MCP_SANDBOX_ADD_CAPABILITIESDESCRIPTION: Linux capabilities to add back.DESCRIPTION: Linux capabilities to add back.
MCP_SANDBOX_ALLOW_NETWORKING=falseDESCRIPTION: Allow network access from inside the sandbox. Values: true | falseDESCRIPTION: Allow network access from inside the sandbox. Values: true | false
MCP_SANDBOX_CONTAINER_WORKSPACE=/workspaceDESCRIPTION: Workspace mount point inside the container.DESCRIPTION: Workspace mount point inside the container.
MCP_SANDBOX_CPU_LIMIT=1.0DESCRIPTION: Container CPU limit (cores).DESCRIPTION: Container CPU limit (cores).
MCP_SANDBOX_DROP_CAPABILITIES=ALLDESCRIPTION: Linux capabilities to drop (comma-separated, or "ALL").DESCRIPTION: Linux capabilities to drop (comma-separated, or "ALL").
MCP_SANDBOX_ENABLED=trueDESCRIPTION: Master switch for the MCP sandbox. Values: true | falseDESCRIPTION: Master switch for the MCP sandbox. Values: true | false
MCP_SANDBOX_ENTRYPOINTDESCRIPTION: Override container entrypoint.DESCRIPTION: Override container entrypoint.
MCP_SANDBOX_EXTRA_MOUNTSDESCRIPTION: Extra bind mounts (HOST:CONTAINER[:ro], comma-separated).DESCRIPTION: Extra bind mounts (HOST:CONTAINER[:ro], comma-separated).
MCP_SANDBOX_IMAGEDESCRIPTION: Container image used when sandboxing MCP servers.DESCRIPTION: Container image used when sandboxing MCP servers.
MCP_SANDBOX_MEMORY_LIMIT=512mDESCRIPTION: Container memory limit.DESCRIPTION: Container memory limit.
MCP_SANDBOX_MOUNT_WORKSPACE=trueDESCRIPTION: Mount the host workspace into the container. Values: true | falseDESCRIPTION: Mount the host workspace into the container. Values: true | false
MCP_SANDBOX_NETWORK_MODE=noneDESCRIPTION: Docker network mode. Values: none | bridge | host | <custom>DESCRIPTION: Docker network mode. Values: none | bridge | host | <custom>
MCP_SANDBOX_NO_NEW_PRIVILEGES=trueDESCRIPTION: Set --security-opt no-new-privileges. Values: true | falseDESCRIPTION: Set --security-opt no-new-privileges. Values: true | false
MCP_SANDBOX_PASSTHROUGH_ENV=PATH,LANG,LC_ALL,TERM,HOMEDESCRIPTION: Comma-separated env vars to forward into the sandbox.DESCRIPTION: Comma-separated env vars to forward into the sandbox.
MCP_SANDBOX_PERMISSION_ALLOWDESCRIPTION: Comma-separated tool names always allowed.DESCRIPTION: Comma-separated tool names always allowed.
MCP_SANDBOX_PERMISSION_DENYDESCRIPTION: Comma-separated tool names always denied.DESCRIPTION: Comma-separated tool names always denied.
MCP_SANDBOX_PERMISSION_MODE=autoDESCRIPTION: How tool permissions are decided. Values: auto | allowlist | denylist | promptDESCRIPTION: How tool permissions are decided. Values: auto | allowlist | denylist | prompt
MCP_SANDBOX_PIDS_LIMIT=100DESCRIPTION: Max PIDs inside the container.DESCRIPTION: Max PIDs inside the container.
MCP_SANDBOX_READ_ONLY_ROOT=falseDESCRIPTION: Mount the container root filesystem read-only. Values: true | falseDESCRIPTION: Mount the container root filesystem read-only. Values: true | false
MCP_SANDBOX_REUSE_SESSION=trueDESCRIPTION: Reuse the same sandbox container across calls within a session. Values: true | falseDESCRIPTION: Reuse the same sandbox container across calls within a session. Values: true | false
MCP_SANDBOX_RUNTIME=dockerDESCRIPTION: Sandbox runtime. Values: docker | podmanDESCRIPTION: Sandbox runtime. Values: docker | podman
MCP_SANDBOX_TIMEOUT_MS=20000DESCRIPTION: Timeout for a single MCP tool call (ms).DESCRIPTION: Timeout for a single MCP tool call (ms).
MCP_SANDBOX_USERDESCRIPTION: Run as this user inside the container.DESCRIPTION: Run as this user inside the container.
MCP_SERVER_MANIFESTDESCRIPTION: Single MCP servers.json manifest path.DESCRIPTION: Single MCP servers.json manifest path.
MEMORY_DECAY_ENABLED=trueDESCRIPTION: Apply time-based decay to memory scores. Values: true | falseDESCRIPTION: Apply time-based decay to memory scores. Values: true | false
MEMORY_DECAY_HALF_LIFE=30DESCRIPTION: Half-life for memory decay (days).DESCRIPTION: Half-life for memory decay (days).
MEMORY_DEDUP_ENABLED=trueDESCRIPTION: Dedupe memories before injection. Values: true | falseDESCRIPTION: Dedupe memories before injection. Values: true | false
MEMORY_DEDUP_LOOKBACK=5DESCRIPTION: Turns of history to scan for dedup.DESCRIPTION: Turns of history to scan for dedup.
MEMORY_ENABLED=trueDESCRIPTION: Master switch for the long-term Titans-inspired memory system. Values: true | falseDESCRIPTION: Master switch for the long-term Titans-inspired memory system. Values: true | false
MEMORY_EXTRACTION_ENABLED=trueDESCRIPTION: Auto-extract memories from turns. Values: true | falseDESCRIPTION: Auto-extract memories from turns. Values: true | false
MEMORY_FORMAT=compactDESCRIPTION: Memory rendering format. Values: compact | verbose | jsonDESCRIPTION: Memory rendering format. Values: compact | verbose | json
MEMORY_INCLUDE_GLOBAL=trueDESCRIPTION: Include cross-session global memories. Values: true | falseDESCRIPTION: Include cross-session global memories. Values: true | false
MEMORY_INJECTION_FORMAT=systemDESCRIPTION: How retrieved memories are injected. Values: system | user | assistantDESCRIPTION: How retrieved memories are injected. Values: system | user | assistant
MEMORY_MAX_AGE_DAYS=90DESCRIPTION: Hard cap on memory age (days).DESCRIPTION: Hard cap on memory age (days).
MEMORY_MAX_COUNT=10000DESCRIPTION: Hard cap on total memory count.DESCRIPTION: Hard cap on total memory count.
MEMORY_RETRIEVAL_LIMIT=5DESCRIPTION: Max memories retrieved per request.DESCRIPTION: Max memories retrieved per request.
MEMORY_SURPRISE_THRESHOLD=0.3DESCRIPTION: Surprise threshold above which a turn is written to memory.DESCRIPTION: Surprise threshold above which a turn is written to memory.
MODEL_DEFAULTDESCRIPTION: Default fallback model name when no tier/provider model is known.DESCRIPTION: Default fallback model name when no tier/provider model is known.
MODEL_PRICE_OVERRIDESDESCRIPTION: JSON of per-model price overrides for the cost registry. Format: {"model-name":{"input":0.5,"output":1.5}}DESCRIPTION: JSON of per-model price overrides for the cost registry. Format: {"model-name":{"input":0.5,"output":1.5}}
MODEL_PROVIDER=ollamaDESCRIPTION: [DEPRECATED legacy knob] primary provider for credential validation. Auto-detected when TIER_* is set. Same allowed values as FALLBACK_PROVIDER plus ollama/llamacpp/lmstudio/vertex/zai/moonshot.DESCRIPTION: [DEPRECATED legacy knob] primary provider for credential validation. Auto-detected when TIER_* is set. Same allowed values as FALLBACK_PROVIDER plus ollama/llamacpp/lmstudio/vertex/zai/moonshot.
MOONSHOT_API_KEYMoonshot AI (Kimi) DESCRIPTION: Moonshot API key.Moonshot AI (Kimi) DESCRIPTION: Moonshot API key.
MOONSHOT_ENDPOINT=https://api.moonshot.ai/v1/chat/completionsDESCRIPTION: Moonshot chat completions endpoint.DESCRIPTION: Moonshot chat completions endpoint.
MOONSHOT_MODEL=kimi-k2-thinkingDESCRIPTION: Default Moonshot model.DESCRIPTION: Default Moonshot model.
NODE_ENV=productionDESCRIPTION: Node runtime mode. "development" enables pino-pretty (requires install). Values: development | production | testDESCRIPTION: Node runtime mode. "development" enables pino-pretty (requires install). Values: development | production | test
OLLAMA_EMBEDDINGS_ENDPOINT=http://localhost:11434/api/embeddingsDESCRIPTION: Embeddings endpoint URL.DESCRIPTION: Embeddings endpoint URL.
OLLAMA_EMBEDDINGS_MODEL=nomic-embed-textDESCRIPTION: Embedding model (for semantic cache and Cursor @Codebase).DESCRIPTION: Embedding model (for semantic cache and Cursor @Codebase).
OLLAMA_ENDPOINT=http://localhost:11434DESCRIPTION: Ollama server endpoint.DESCRIPTION: Ollama server endpoint.
OLLAMA_KEEP_ALIVEDESCRIPTION: Ollama `keep_alive` parameter (e.g. "5m", "30m", "-1" for forever).DESCRIPTION: Ollama `keep_alive` parameter (e.g. "5m", "30m", "-1" for forever).
OLLAMA_MAX_TOOLS_FOR_ROUTING=3DESCRIPTION: Cap on how many tools are injected when routing through Ollama.DESCRIPTION: Cap on how many tools are injected when routing through Ollama.
OLLAMA_MODEL=qwen2.5-coder:latestOllama (local models) DESCRIPTION: Default Ollama model id.Ollama (local models) DESCRIPTION: Default Ollama model id.
OLLAMA_TIMEOUT_MS=120000DESCRIPTION: Per-request timeout in milliseconds.DESCRIPTION: Per-request timeout in milliseconds.
OPENAI_API_KEYOpenAI (direct) DESCRIPTION: OpenAI API key.OpenAI (direct) DESCRIPTION: OpenAI API key.
OPENAI_ENDPOINT=https://api.openai.com/v1/chat/completionsDESCRIPTION: Chat completions endpoint (can point at any OpenAI-compatible host).DESCRIPTION: Chat completions endpoint (can point at any OpenAI-compatible host).
OPENAI_MODEL=gpt-4oDESCRIPTION: Default OpenAI model.DESCRIPTION: Default OpenAI model.
OPENAI_ORGANIZATIONDESCRIPTION: Optional OpenAI org id.DESCRIPTION: Optional OpenAI org id.
OPENAI_REASONING_EFFORTFIREWORKS_THINKING_MODELS=glm-5p3|glm-5\.3|deepseek-v4p1-flash # regex: never send thinking:disabled FIREWORKS_RESPONSE_FORMAT_SCHEMA=false # Fireworks rejects json_schema with $ref; json_object by defaultFIREWORKS_THINKING_MODELS=glm-5p3|glm-5\.3|deepseek-v4p1-flash # regex: never send thinking:disabled FIREWORKS_RESPONSE_FORMAT_SCHEMA=false # Fireworks rejects json_schema with $ref; json_object by default
OPENAI_RESPONSE_FORMAT_SCHEMAOPENCLAW_MODEDESCRIPTION: OpenClaw mode — rewrites response `model` field with actual provider/model used. Values: true | falseDESCRIPTION: OpenClaw mode — rewrites response `model` field with actual provider/model used. Values: true | false
OPENROUTER_ALLOW_FALLBACKSOPENROUTER_API_KEYOpenRouter (100+ models via single API) DESCRIPTION: OpenRouter API key.OpenRouter (100+ models via single API) DESCRIPTION: OpenRouter API key.
OPENROUTER_EMBEDDINGS_MODEL=openai/text-embedding-ada-002DESCRIPTION: Embedding model used through OpenRouter.DESCRIPTION: Embedding model used through OpenRouter.
OPENROUTER_ENDPOINT=https://openrouter.ai/api/v1/chat/completionsDESCRIPTION: OpenRouter chat completions endpoint.DESCRIPTION: OpenRouter chat completions endpoint.
OPENROUTER_MAX_TOKENS_MAPPer-model output cap (bounds runaway reasoning on cheap models).Per-model output cap (bounds runaway reasoning on cheap models).
OPENROUTER_MAX_TOOLS_FOR_ROUTING=15DESCRIPTION: Cap on tool count sent during routing.DESCRIPTION: Cap on tool count sent during routing.
OPENROUTER_MODEL=openai/gpt-4o-miniDESCRIPTION: Default OpenRouter model.DESCRIPTION: Default OpenRouter model.
OPENROUTER_PROVIDER_ORDEROpenRouter: provider pin, reasoning, schema, timeouts, failover Pin provider(s) globally, or per model (';' between models, ',' between providers).OpenRouter: provider pin, reasoning, schema, timeouts, failover Pin provider(s) globally, or per model (';' between models, ',' between providers).
OPENROUTER_PROVIDER_ORDER_MAPOPENROUTER_REASONING_EFFORTReasoning effort (global default, or per model).Reasoning effort (global default, or per model).
OPENROUTER_REASONING_EFFORT_MAPOPENROUTER_RESPONSE_FORMAT_SCHEMAOPENROUTER_SCHEMA_PROVIDERSHosts that honour strict json_schema; others receive json_object.Hosts that honour strict json_schema; others receive json_object.
OPENROUTER_TIMEOUT_MSUpstream timeout (ms), global and per model; on timeout/5xx/404 Lynkr fails over to the next pinned provider, then lets tier-fallback climb.Upstream timeout (ms), global and per model; on timeout/5xx/404 Lynkr fails over to the next pinned provider, then lets tier-fallback climb.
OPENROUTER_TIMEOUT_MS_MAPORCA_API_BASE_URLDESCRIPTION: Explicit API origin override (api.orcarouter.ai default).DESCRIPTION: Explicit API origin override (api.orcarouter.ai default).
ORCA_AUTH_BASE_URLDESCRIPTION: Explicit auth origin override (www.orcarouter.ai default).DESCRIPTION: Explicit auth origin override (www.orcarouter.ai default).
ORCA_BASE_URLDESCRIPTION: Shared self-hosted base URL — falls back for BOTH auth and API when the explicit overrides below are unset.DESCRIPTION: Shared self-hosted base URL — falls back for BOTH auth and API when the explicit overrides below are unset.
ORCAROUTER_API_KEYOrcaRouter (OpenAI-compatible gateway — adaptive routing, failover, zero-markup inference, agent-tool governance) DESCRIPTION: OrcaRouter API key (sk-orca-...). You can also run `lynkr connect orcarouter` for an OAuth 2.0 + PKCE one-click login that issues a key belonging to your own account (no client secret, no redirect pre-registration). Auth requests go to www.orcarouter.ai; inference and modeOrcaRouter (OpenAI-compatible gateway — adaptive routing, failover, zero-markup inference, agent-tool governance) DESCRIPTION: OrcaRouter API key (sk-orca-...). You can also run `lynkr connect orcarouter` for an OAuth 2.0 + PKCE one-click login that issues a key belonging to your own account (no client secret, no redirect pre-registration). Auth requests go to www.orcarouter.ai; inference and mode
ORCAROUTER_ENDPOINT=https://api.orcarouter.ai/v1/chat/completionsDESCRIPTION: Chat completions endpoint. Defaults to the API origin + /v1.DESCRIPTION: Chat completions endpoint. Defaults to the API origin + /v1.
ORCAROUTER_MODEL=orcarouter/autoDESCRIPTION: Default OrcaRouter model (see the live catalog at https://api.orcarouter.ai/v1/models for your workspace's real list).DESCRIPTION: Default OrcaRouter model (see the live catalog at https://api.orcarouter.ai/v1/models for your workspace's real list).
OVERSIZED_ERROR_LOG_DIR=./logs/oversized-errorsDESCRIPTION: Where oversized-error dumps go.DESCRIPTION: Where oversized-error dumps go.
OVERSIZED_ERROR_LOGGING_ENABLED=trueDESCRIPTION: Persist oversized-payload errors to disk. Values: true | falseDESCRIPTION: Persist oversized-payload errors to disk. Values: true | false
OVERSIZED_ERROR_MAX_FILES=100DESCRIPTION: Max retained oversized-error dump files.DESCRIPTION: Max retained oversized-error dump files.
OVERSIZED_ERROR_THRESHOLD=200DESCRIPTION: Bytes above which a payload is considered "oversized".DESCRIPTION: Bytes above which a payload is considered "oversized".
PERF_TIMERDESCRIPTION: Print per-stage timing breakdowns to stdout. Values: true | falseDESCRIPTION: Print per-stage timing breakdowns to stdout. Values: true | false
POLICY_DISALLOWED_TOOLSDESCRIPTION: Comma-separated tool names that are never allowed.DESCRIPTION: Comma-separated tool names that are never allowed.
POLICY_FILE_ALLOWED_PATHSDESCRIPTION: Comma-separated paths that file tools may touch (allowlist).DESCRIPTION: Comma-separated paths that file tools may touch (allowlist).
POLICY_FILE_BLOCKED_PATHS=/.env,.env,/etc/passwd,/etc/shadowDESCRIPTION: Comma-separated paths that file tools may NOT touch.DESCRIPTION: Comma-separated paths that file tools may NOT touch.
POLICY_GIT_ALLOW_COMMIT=trueDESCRIPTION: Allow `git commit`. Values: true | falseDESCRIPTION: Allow `git commit`. Values: true | false
POLICY_GIT_ALLOW_PULL=trueDESCRIPTION: Allow `git pull`. Values: true | falseDESCRIPTION: Allow `git pull`. Values: true | false
POLICY_GIT_ALLOW_PUSH=falseDESCRIPTION: Allow `git push`. Values: true | falseDESCRIPTION: Allow `git push`. Values: true | false
POLICY_GIT_AUTOSTASHDESCRIPTION: Auto-stash uncommitted changes before risky git operations. Values: true | falseDESCRIPTION: Auto-stash uncommitted changes before risky git operations. Values: true | false
POLICY_GIT_COMMIT_REGEXDESCRIPTION: Regex that commit messages must match.DESCRIPTION: Regex that commit messages must match.
POLICY_GIT_REQUIRE_TESTS=falseDESCRIPTION: Refuse commits unless POLICY_GIT_TEST_COMMAND passes. Values: true | falseDESCRIPTION: Refuse commits unless POLICY_GIT_TEST_COMMAND passes. Values: true | false
POLICY_GIT_TEST_COMMANDDESCRIPTION: Test command run before allowing a commit (when REQUIRE_TESTS=true).DESCRIPTION: Test command run before allowing a commit (when REQUIRE_TESTS=true).
POLICY_MAX_STEPS=20DESCRIPTION: Hard cap on routing/tool-call steps per request.DESCRIPTION: Hard cap on routing/tool-call steps per request.
POLICY_MAX_TOOL_CALLS=12DESCRIPTION: Hard cap on tool calls per request.DESCRIPTION: Hard cap on tool calls per request.
POLICY_SAFE_COMMANDS_CONFIGDESCRIPTION: JSON config for the safe-commands allowlist.DESCRIPTION: JSON config for the safe-commands allowlist.
POLICY_SAFE_COMMANDS_ENABLED=trueDESCRIPTION: Apply the safe-commands allowlist to bash tool calls. Values: true | falseDESCRIPTION: Apply the safe-commands allowlist to bash tool calls. Values: true | false
POLICY_TOOL_LOOP_THRESHOLD=10DESCRIPTION: Force-terminate after this many same-tool calls in a row (loop guard).DESCRIPTION: Force-terminate after this many same-tool calls in a row (loop guard).
PORT=8080DESCRIPTION: HTTP port the proxy listens on.DESCRIPTION: HTTP port the proxy listens on.
PREFER_OLLAMADESCRIPTION: [DEPRECATED] legacy preference for Ollama. Use TIER_SIMPLE=ollama:<model> instead. Values: true | falseDESCRIPTION: [DEPRECATED] legacy preference for Ollama. Use TIER_SIMPLE=ollama:<model> instead. Values: true | false
PROMPT_CACHE_ENABLED=trueDESCRIPTION: Master switch for the in-memory prompt cache. Values: true | falseDESCRIPTION: Master switch for the in-memory prompt cache. Values: true | false
PROMPT_CACHE_MAX_ENTRIES=1000DESCRIPTION: Max number of prompts to cache.DESCRIPTION: Max number of prompts to cache.
PROMPT_CACHE_TTL_MS=300000DESCRIPTION: Cache entry TTL (ms).DESCRIPTION: Cache entry TTL (ms).
RATE_LIMIT_ENABLED=trueDESCRIPTION: Master switch for the per-session rate limiter. Values: true | falseDESCRIPTION: Master switch for the per-session rate limiter. Values: true | false
RATE_LIMIT_KEY_BYDESCRIPTION: How requests are bucketed. Values: session | ip | bothDESCRIPTION: How requests are bucketed. Values: session | ip | both
RATE_LIMIT_MAX=100DESCRIPTION: Max requests per window.DESCRIPTION: Max requests per window.
RATE_LIMIT_WINDOW_MS=60000DESCRIPTION: Sliding window length (ms).DESCRIPTION: Sliding window length (ms).
REQUEST_JSON_LIMIT=1gbDESCRIPTION: Max JSON request body size (express bodyParser units, e.g. "1gb").DESCRIPTION: Max JSON request body size (express bodyParser units, e.g. "1gb").
RISK_TIER_ESCALATIONDisable security-keyword risk escalation (tasks ABOUT security are not risky).Disable security-keyword risk escalation (tasks ABOUT security are not risky).
SECURITY_AUDIT_LOG_DIR=./logsDESCRIPTION: Directory for the security audit log.DESCRIPTION: Directory for the security audit log.
SECURITY_AUDIT_LOG_ENABLED=trueDESCRIPTION: Persist security events to disk. Values: true | falseDESCRIPTION: Persist security events to disk. Values: true | false
SECURITY_BLOCK_ON_DETECTION=trueDESCRIPTION: Block requests when the filter triggers (vs. just log). Values: true | falseDESCRIPTION: Block requests when the filter triggers (vs. just log). Values: true | false
SECURITY_CONTENT_FILTER_ENABLED=trueDESCRIPTION: Master switch for the security content filter. Values: true | falseDESCRIPTION: Master switch for the security content filter. Values: true | false
SECURITY_PER_ENDPOINT_LIMIT=1000DESCRIPTION: Per-endpoint request cap per minute.DESCRIPTION: Per-endpoint request cap per minute.
SECURITY_PER_IP_LIMIT=100DESCRIPTION: Per-IP request cap per minute.DESCRIPTION: Per-IP request cap per minute.
SECURITY_RATE_LIMIT_ENABLED=trueDESCRIPTION: Master switch for the security rate limiter. Values: true | falseDESCRIPTION: Master switch for the security rate limiter. Values: true | false
SEMANTIC_CACHE_ENABLED=trueDESCRIPTION: Master switch for semantic (embedding-based) response cache. Values: true | falseDESCRIPTION: Master switch for semantic (embedding-based) response cache. Values: true | false
SEMANTIC_CACHE_MAX_ENTRIES=50DESCRIPTION: Max number of cached entries.DESCRIPTION: Max number of cached entries.
SEMANTIC_CACHE_THRESHOLD=0.95DESCRIPTION: Cosine-similarity threshold for a cache hit.DESCRIPTION: Cosine-similarity threshold for a cache hit.
SEMANTIC_CACHE_TTL_MS=300000DESCRIPTION: Cache entry TTL (ms).DESCRIPTION: Cache entry TTL (ms).
SESSION_DB_PATH=./data/sessions.dbDESCRIPTION: SQLite path for session storage.DESCRIPTION: SQLite path for session storage.
SMART_TOOL_SELECTION_MODE=heuristicDESCRIPTION: Smart tool selection strategy (also feeds the routing complexity analyzer). Values: heuristic | aggressive | conservative | disabledDESCRIPTION: Smart tool selection strategy (also feeds the routing complexity analyzer). Values: heuristic | aggressive | conservative | disabled
SMART_TOOL_SELECTION_TOKEN_BUDGETDESCRIPTION: Token budget the smart-selector tries to stay under.DESCRIPTION: Token budget the smart-selector tries to stay under.
SUGGESTION_MODE_MODEL=defaultDESCRIPTION: Suggestion-mode model override. Values: default (same as MODEL_PROVIDER) | none | <model-name>DESCRIPTION: Suggestion-mode model override. Values: default (same as MODEL_PROVIDER) | none | <model-name>
SYSTEM_PROMPT_MODE=dynamicDESCRIPTION: System prompt rendering strategy. Values: dynamic | static | minimalDESCRIPTION: System prompt rendering strategy. Values: dynamic | static | minimal
TENCENTDB_MEMORY_CORE_PORTDESCRIPTION: Host port overrides (defaults shown).DESCRIPTION: Host port overrides (defaults shown).
TENCENTDB_MEMORY_DOCKER_ENABLEDDESCRIPTION: Let Lynkr manage the containers. Set false if you run the stack yourself via the project's deploy scripts. Values: true | falseDESCRIPTION: Let Lynkr manage the containers. Set false if you run the stack yourself via the project's deploy scripts. Values: true | false
TENCENTDB_MEMORY_ENABLED=trueDESCRIPTION: TencentDB-Agent-Memory sidecar (team memory hub: L0-L3 chat memory, Skills, Wiki, CodeGraph). When enabled, `lynkr start` launches the memory-core + memory-hub containers from Docker Hub (agentmemory/*) — same pattern as the Headroom sidecar. Panel UI: http://localhost:8125 Requires Docker (skips gracefully if unavailable). Containers persist across Lynkr restarts (remove with: dockerDESCRIPTION: TencentDB-Agent-Memory sidecar (team memory hub: L0-L3 chat memory, Skills, Wiki, CodeGraph). When enabled, `lynkr start` launches the memory-core + memory-hub containers from Docker Hub (agentmemory/*) — same pattern as the Headroom sidecar. Panel UI: http://localhost:8125 Requires Docker (skips gracefully if unavailable). Containers persist across Lynkr restarts (remove with: docker
TENCENTDB_MEMORY_KNOWLEDGE_PORTTENCENTDB_MEMORY_LLM_API_KEYTENCENTDB_MEMORY_LLM_BASE_URLDESCRIPTION: LLM endpoint the memory services use for extraction and wiki ingest. Defaults to Lynkr's own OpenAI-compatible endpoint (tier routing picks the model), so no extra API key is needed. Override to point at a provider directly.DESCRIPTION: LLM endpoint the memory services use for extraction and wiki ingest. Defaults to Lynkr's own OpenAI-compatible endpoint (tier routing picks the model), so no extra API key is needed. Override to point at a provider directly.
TENCENTDB_MEMORY_LLM_MODELTENCENTDB_MEMORY_PANEL_PORTTENCENTDB_MEMORY_PROMPT_MODEDESCRIPTION: Memory extraction style. `code` extracts changes/issues/tool usage (coding agents); `chat` extracts general conversational facts. Values: code | chatDESCRIPTION: Memory extraction style. `code` extracts changes/issues/tool usage (coding agents); `chat` extracts general conversational facts. Values: code | chat
TIER_COMPLEXDESCRIPTION: Provider:model for complex tasks (multi-file changes, design)DESCRIPTION: Provider:model for complex tasks (multi-file changes, design)
TIER_MEDIUM=ollama:qwen2.5-coder:latestDESCRIPTION: Provider:model for moderate tasks (code edits, small refactors)DESCRIPTION: Provider:model for moderate tasks (code edits, small refactors)
TIER_REASONING=moonshot:kimi-k2-thinkingDESCRIPTION: Provider:model for hard reasoning (algorithms, debugging)DESCRIPTION: Provider:model for hard reasoning (algorithms, debugging)
TIER_SIMPLE=ollama:qwen2.5-coder:latestDESCRIPTION: Provider:model for trivial single-shot tasks (greetings, formatting)DESCRIPTION: Provider:model for trivial single-shot tasks (greetings, formatting)
TINYFISH_API_KEYDESCRIPTION: TinyFish.ai API key (enables the WebAgent browser-automation tool).DESCRIPTION: TinyFish.ai API key (enables the WebAgent browser-automation tool).
TINYFISH_BROWSER_PROFILE=liteDESCRIPTION: Browser profile preset. Values: lite | standard | stealthDESCRIPTION: Browser profile preset. Values: lite | standard | stealth
TINYFISH_ENDPOINT=https://agent.tinyfish.ai/v1/automation/run-sseDESCRIPTION: TinyFish automation endpoint.DESCRIPTION: TinyFish automation endpoint.
TINYFISH_PROXY_COUNTRY=USDESCRIPTION: Proxy egress country (ISO 3166 alpha-2).DESCRIPTION: Proxy egress country (ISO 3166 alpha-2).
TINYFISH_PROXY_ENABLED=falseDESCRIPTION: Route the browser through a residential proxy. Values: true | falseDESCRIPTION: Route the browser through a residential proxy. Values: true | false
TINYFISH_TIMEOUT_MS=120000DESCRIPTION: Per-run timeout (ms).DESCRIPTION: Per-run timeout (ms).
TOKEN_BUDGET_ENFORCEMENTDESCRIPTION: Apply adaptive compression when a request exceeds the budget (instead of only warning). Requests are compressed to fit, not refused. Values: true | falseDESCRIPTION: Apply adaptive compression when a request exceeds the budget (instead of only warning). Requests are compressed to fit, not refused. Values: true | false
TOKEN_BUDGET_MAXDESCRIPTION: OPT-IN global request-size ceiling (tokens). LEAVE UNSET for the default behavior: the budget is derived automatically from the SERVED model's real context window (registry window × 0.85, pin-aware behind virtual model names) — a 128k model gets a 108k budget, a 1M model gets an 850k budget. Set this ONLY as a deliberate cost/latency ceiling: input tokens are re-billed every turn, soDESCRIPTION: OPT-IN global request-size ceiling (tokens). LEAVE UNSET for the default behavior: the budget is derived automatically from the SERVED model's real context window (registry window × 0.85, pin-aware behind virtual model names) — a 128k model gets a 108k budget, a 1M model gets an 850k budget. Set this ONLY as a deliberate cost/latency ceiling: input tokens are re-billed every turn, so
TOKEN_BUDGET_WARNINGDESCRIPTION: Token budget that triggers a "you're approaching the limit" warning.DESCRIPTION: Token budget that triggers a "you're approaching the limit" warning.
TOKEN_TRACKING_ENABLEDDESCRIPTION: Track input/output tokens per request. Values: true | falseDESCRIPTION: Track input/output tokens per request. Values: true | false
TOOL_DESCRIPTIONS=minimalDESCRIPTION: How verbose tool descriptions are. Values: minimal | normal | verboseDESCRIPTION: How verbose tool descriptions are. Values: minimal | normal | verbose
TOON_ENABLEDDESCRIPTION: Enable TOON (token-optimized object notation) encoding for large structured payloads. Values: true | falseDESCRIPTION: Enable TOON (token-optimized object notation) encoding for large structured payloads. Values: true | false
TOON_FAIL_OPEN=trueDESCRIPTION: Continue without TOON on encoder failure instead of erroring. Values: true | falseDESCRIPTION: Continue without TOON on encoder failure instead of erroring. Values: true | false
TOON_LOG_STATS=trueDESCRIPTION: Log per-request TOON savings stats. Values: true | falseDESCRIPTION: Log per-request TOON savings stats. Values: true | false
TOON_MIN_BYTES=4096DESCRIPTION: Minimum byte size before TOON encoding kicks in.DESCRIPTION: Minimum byte size before TOON encoding kicks in.
TYPESAFE_API_KEYDESCRIPTION: TypeSafe API key for the Jev routing judge (second opinion on intent difficulty + risk corroboration). Optional — anchor scoring carries routing alone when unset (fail-soft null, no new env vars otherwise).DESCRIPTION: TypeSafe API key for the Jev routing judge (second opinion on intent difficulty + risk corroboration). Optional — anchor scoring carries routing alone when unset (fail-soft null, no new env vars otherwise).
VERTEX_API_KEYGoogle Vertex AI / Gemini DESCRIPTION: Vertex/Gemini API key (preferred name).Google Vertex AI / Gemini DESCRIPTION: Vertex/Gemini API key (preferred name).
VERTEX_MODEL=gemini-2.0-flashDESCRIPTION: Default Gemini model.DESCRIPTION: Default Gemini model.
WEB_FETCH_BODY_PREVIEW_MAX=10000DESCRIPTION: Max bytes of page body shown in WebFetch results.DESCRIPTION: Max bytes of page body shown in WebFetch results.
WEB_SEARCH_ALLOW_ALL=trueDESCRIPTION: Allow searching any host (overrides the allowlist). Values: true | falseDESCRIPTION: Allow searching any host (overrides the allowlist). Values: true | false
WEB_SEARCH_ALLOWED_HOSTSDESCRIPTION: Comma-separated allowlist of search hosts.DESCRIPTION: Comma-separated allowlist of search hosts.
WEB_SEARCH_API_KEYDESCRIPTION: Bearer token for the search endpoint.DESCRIPTION: Bearer token for the search endpoint.
WEB_SEARCH_ENDPOINT=http://localhost:8888/searchDESCRIPTION: Endpoint for the WebSearch tool (often a local SearXNG instance).DESCRIPTION: Endpoint for the WebSearch tool (often a local SearXNG instance).
WEB_SEARCH_MAX_RETRIES=2DESCRIPTION: Max retry attempts on failure.DESCRIPTION: Max retry attempts on failure.
WEB_SEARCH_RETRY_ENABLED=trueDESCRIPTION: Retry failed searches. Values: true | falseDESCRIPTION: Retry failed searches. Values: true | false
WEB_SEARCH_TIMEOUT_MS=10000DESCRIPTION: Per-search timeout (ms).DESCRIPTION: Per-search timeout (ms).
WORKER_OFFLOAD_THRESHOLD_BYTES=10000DESCRIPTION: Payload size (bytes) above which work is offloaded to the pool.DESCRIPTION: Payload size (bytes) above which work is offloaded to the pool.
WORKER_POOL_ENABLED=trueDESCRIPTION: Master switch for the worker thread pool (heavy parsing, embeddings). Values: true | falseDESCRIPTION: Master switch for the worker thread pool (heavy parsing, embeddings). Values: true | false
WORKER_POOL_SIZE=0DESCRIPTION: Worker pool size. 0 = auto (CPU cores - 1).DESCRIPTION: Worker pool size. 0 = auto (CPU cores - 1).
WORKER_TASK_TIMEOUT_MS=5000DESCRIPTION: Per-task timeout (ms).DESCRIPTION: Per-task timeout (ms).
WORKSPACE_ROOT=/path/to/your/workspaceDESCRIPTION: Absolute path to the workspace Lynkr operates on.DESCRIPTION: Absolute path to the workspace Lynkr operates on.
WORKSPACE_TEST_ARGSDESCRIPTION: Extra args appended to the test command.DESCRIPTION: Extra args appended to the test command.
WORKSPACE_TEST_COMMANDDESCRIPTION: Test command the workspace runner invokes.DESCRIPTION: Test command the workspace runner invokes.
WORKSPACE_TEST_COVERAGE_FILES=coverage/coverage-summary.jsonDESCRIPTION: Coverage report paths the runner picks up.DESCRIPTION: Coverage report paths the runner picks up.
WORKSPACE_TEST_PROFILESDESCRIPTION: JSON array of named test profiles.DESCRIPTION: JSON array of named test profiles.
WORKSPACE_TEST_SANDBOX=autoDESCRIPTION: How tests are sandboxed. Values: auto | docker | noneDESCRIPTION: How tests are sandboxed. Values: auto | docker | none
WORKSPACE_TEST_TIMEOUT_MS=600000DESCRIPTION: Test timeout (ms).DESCRIPTION: Test timeout (ms).
ZAI_API_KEYZ.AI (Zhipu AI) DESCRIPTION: Z.AI API key.Z.AI (Zhipu AI) DESCRIPTION: Z.AI API key.
ZAI_ENDPOINT=https://api.z.ai/api/anthropic/v1/messagesDESCRIPTION: Z.AI Anthropic-compatible messages endpoint.DESCRIPTION: Z.AI Anthropic-compatible messages endpoint.
ZAI_MAX_CONCURRENT=2DESCRIPTION: Max concurrent in-flight Z.AI requests.DESCRIPTION: Max concurrent in-flight Z.AI requests.
ZAI_MODEL=GLM-4.7DESCRIPTION: Default Z.AI model.DESCRIPTION: Default Z.AI model.
FAQ
Can I run Lynkr completely offline?
Yes — use local providers such as Ollama or llama.cpp for chat and embeddings, which keeps all data on your machine.
What metrics does Lynkr collect?
Request rate, latency percentiles, error and token/cost metrics plus memory, CPU, connection and circuit-breaker state, exposed in Prometheus format at /metrics.
How do I deploy with Docker?
Clone the repo, copy .env.example to .env with your credentials and run docker-compose up -d, or build and run the lynkr image standalone.
Where do tools execute?
Always on the client machine; Lynkr only forwards tool_use blocks and returns results with the next request.
Does Lynkr support MCP (Model Context Protocol)?
Yes: it discovers manifests in ~/.claude/mcp, speaks JSON-RPC 2.0 to MCP servers, registers their tools dynamically and can sandbox them in Docker.
What is token optimization and how does it save costs?
Five phases — prompt caching, memory deduplication, tool-response truncation, dynamic system prompts and conversation compression — cut provider costs by a claimed 60-80%.
What is FALLBACK_PROVIDER?
A cloud provider Lynkr transparently retries against when the tier-selected provider fails; it cannot be a local provider and defaults to databricks.
What happens if I only set some TIER_* vars?
All four tier variables must be set; otherwise tier routing is disabled entirely and MODEL_PROVIDER handles every request.
How do I install Lynkr?
Globally via npm (`npm install -g lynkr` then `lynkr start`), through the Homebrew tap, or by cloning the repo and running npm start.
What's the difference between Lynkr and native Claude Code?
Native Claude Code only reaches Anthropic's cloud at full price, while Lynkr adds 12+ providers, local models, token optimization and cost tracking.
How much does Lynkr cost?
Nothing — it is free and open source under Apache 2.0; you only pay your chosen model provider.
Does Lynkr work with Cursor IDE?
Yes, through its OpenAI-compatible endpoint: set Cursor's base URL to http://localhost:8081/v1 and any non-empty API key.
What is Lynkr?
A self-hosted proxy server that lets Claude Code CLI and Cursor IDE talk to many LLM providers instead of being locked to Anthropic's API.
More in API Gateway
ManifestSelf-hosted, open-source LLM gateway: one OpenAI-compatible endpoint routes agents to 300+ models with provider fallbacks, cost tracking and full request logs.
mcp-context-forgeAn AI Gateway, registry, and proxy that sits in front of any MCP, A2A, or REST/gRPC APIs, exposing a unified endpoint with centralized discovery, guardrails and management. Optimizes Agent & Tool calling, and supports plugins.
mcp-gatewaySelf-hosted MCP gateway converting REST APIs into secured MCP endpoints with multi-tenant isolation, API key/OAuth auth, tool policies, and audit logging.
MCPJungleSelf-hosted, open-source MCP gateway: register stdio and HTTP MCP servers once, serve them via one /mcp endpoint with tool groups and access control.
McpManagerSelf-hosted open-source MCP proxy aggregating multiple upstream servers into a single endpoint for AI tools like Claude Code and Cursor.
mcpoA self-hosted, open-source proxy that turns any MCP server into an OpenAPI-compatible HTTP endpoint, with API-key access, generated docs and OAuth 2.1.
metamcpSelf-hosted, open-source MCP gateway that groups MCP servers into namespaces and exposes them as SSE, Streamable HTTP or OpenAPI endpoints with API keys and OIDC.
mistral.rsmistral.rs is a self-hosted, open-source LLM inference engine in Rust serving OpenAI-compatible and Anthropic-compatible APIs with built-in web UI.
nexusSelf-hosted AI router unifying MCP servers and LLM providers (OpenAI, Anthropic, Google, Bedrock) with OAuth2, rate limiting, and OpenTelemetry.
nexus-gatewaySelf-hosted open-source AI gateway intercepting LLM traffic at SDK, network, and OS layers with compliance, routing across 20+ providers, caching, quotas, and audit.
NGINXNGINX is a self-hosted, open-source web server that also functions as a reverse proxy, load balancer, content cache, and mail proxy.
OctopusSelf-hosted, open-source LLM API aggregation gateway for individuals: unified channels, protocol conversion, failover, price sync and cost analytics in one binary.
0 comments