惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
V2EX - 技术
V2EX - 技术
美团技术团队
NISL@THU
NISL@THU
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MyScale Blog
MyScale Blog
C
Cybersecurity and Infrastructure Security Agency CISA
W
WeLiveSecurity
博客园 - 聂微东
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Help Net Security
GbyAI
GbyAI
G
GRAHAM CLULEY
The Last Watchdog
The Last Watchdog
U
Unit 42
罗磊的独立博客
B
Blog RSS Feed
K
Kaspersky official blog
宝玉的分享
宝玉的分享
Blog — PlanetScale
Blog — PlanetScale
Know Your Adversary
Know Your Adversary
IT之家
IT之家
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Y
Y Combinator Blog
S
Secure Thoughts
P
Privacy & Cybersecurity Law Blog
S
Schneier on Security
Last Week in AI
Last Week in AI
Hacker News: Ask HN
Hacker News: Ask HN
L
LINUX DO - 热门话题
雷峰网
雷峰网
Martin Fowler
Martin Fowler
Recent Commits to openclaw:main
Recent Commits to openclaw:main
N
Netflix TechBlog - Medium
T
Tor Project blog
The GitHub Blog
The GitHub Blog
The Hacker News
The Hacker News
F
Fortinet All Blogs
Webroot Blog
Webroot Blog
Spread Privacy
Spread Privacy
Cloudbric
Cloudbric
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Schneier on Security
Schneier on Security
人人都是产品经理
人人都是产品经理
P
Privacy International News Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
The Exploit Database - CXSecurity.com
Microsoft Security Blog
Microsoft Security Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How to Configure LibreChat with Lynkr Using a Custom OpenAI-Compatible Endpoint
Lynkr · 2026-06-16 · via DEV Community

How to Configure LibreChat with Lynkr Using a Custom OpenAI-Compatible Endpoint

If you already run LibreChat, the fastest way to clean up your model infrastructure is to stop wiring providers directly into the app and put a gateway underneath it.

LibreChat already supports custom OpenAI-compatible endpoints. That means you can point LibreChat at Lynkr, keep one stable endpoint in the app, and let Lynkr handle routing, caching, and provider switching behind the scenes.

This is the practical follow-up to my previous piece on the architecture case. Here I’ll show the minimal working setup.

I built Lynkr, so founder disclosure applies. I’m keeping this grounded to what LibreChat and Lynkr already support today.


What you need

Before starting, you need:

  • a running LibreChat instance
  • Node.js 20+ for Lynkr
  • at least one backend provider configured in Lynkr
  • one LibreChat endpoint that points to Lynkr instead of directly to a provider

Repo references:

Two details matter here:

  1. LibreChat explicitly supports custom OpenAI-compatible APIs
  2. Lynkr exposes an OpenAI-compatible /v1 endpoint

That’s the seam we’re using.


The target architecture

The setup we want looks like this:

Browser
  ↓
LibreChat
  ↓
Lynkr (OpenAI-compatible endpoint)
  ↓
OpenAI / Bedrock / OpenRouter / Ollama / Anthropic-compatible backends / others

In other words:

  • LibreChat owns the chat UI, agents, MCP, files, and workflows
  • Lynkr owns routing, caching, and model-side control

Step 1: Install and start Lynkr

Install Lynkr globally:

npm install -g lynkr

Now create a minimal .env for Lynkr.

Example A: local testing with Ollama

MODEL_PROVIDER=ollama
OLLAMA_ENDPOINT=http://localhost:11434
OLLAMA_MODEL=qwen2.5-coder:latest
FALLBACK_ENABLED=false
PORT=8081
PROMPT_CACHE_ENABLED=true
SEMANTIC_CACHE_ENABLED=true

Then start Lynkr:

lynkr start

Example B: cloud setup with OpenRouter

MODEL_PROVIDER=openrouter
OPENROUTER_API_KEY=your_openrouter_key
FALLBACK_ENABLED=false
PORT=8081
PROMPT_CACHE_ENABLED=true
SEMANTIC_CACHE_ENABLED=true

Then start it:

lynkr start

Optional direct smoke test against Lynkr

Before touching LibreChat, you can test Lynkr directly with a simple OpenAI-compatible request:

curl http://localhost:8081/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer dummy-key" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'

If that succeeds, the gateway path is working before LibreChat is added on top.

Quick health check

Once Lynkr is running, verify the endpoint responds:

curl http://localhost:8081/

You should get a JSON response showing the service is running.

At this point, Lynkr should expose an OpenAI-compatible base URL at:

http://localhost:8081/v1

That is the URL LibreChat should talk to.


Step 2: Decide how LibreChat should see Lynkr

LibreChat supports custom endpoints and also lets users provide a custom baseURL for supported endpoint flows.

For this setup, the important part is simple:

  • LibreChat should send requests to Lynkr’s /v1 base URL
  • LibreChat should use a model name that Lynkr will accept and route
  • LibreChat should not need to know which upstream provider you finally use behind Lynkr

So the mental model is:

LibreChat config → one base URL → Lynkr
Lynkr config → actual providers, routing, fallback, cache

That separation is the whole point.


Step 3: Add Lynkr as the LibreChat custom endpoint

The exact UI path can differ depending on how you run LibreChat and how you expose custom endpoints, but the working shape is the same.

In LibreChat, configure a custom OpenAI-compatible endpoint with:

  • Base URL: http://localhost:8081/v1
  • API key: any value Lynkr accepts for your setup, or the key your deployment expects
  • Model: a model string that Lynkr can map or forward

Minimal example values

Endpoint Type: Custom OpenAI-compatible endpoint
Base URL: http://localhost:8081/v1
API Key: dummy-key
Model: gpt-4o-mini

If your LibreChat instance and Lynkr instance run on different hosts, replace localhost with the actual reachable host:

http://lynkr.internal:8081/v1

or

https://lynkr.yourdomain.com/v1

If you are running LibreChat in Docker and Lynkr on the host machine, you may need to use a host-reachable name rather than localhost, for example:

http://host.docker.internal:8081/v1

That’s one of the most common gotchas.


Step 4: Pick a model name strategy

This part trips people up more than it should.

LibreChat wants a model name. Lynkr also needs to know what to do with that model name.

There are two clean ways to handle this.

Option 1: pass through a real model name

Use a model name that corresponds to the backend you want Lynkr to use.

Example:

gpt-4o-mini

or

claude-3-5-sonnet

This is the simplest starting point if Lynkr is forwarding traffic in a straightforward way.

Option 2: use stable logical model names in LibreChat

A better long-term pattern is to let LibreChat use a stable name like:

chat-fast

or

chat-quality

Then map those choices in the gateway layer.

That way:

  • LibreChat users keep the same model choices
  • Lynkr can change the real backend later
  • you can move from OpenRouter to Bedrock or from cloud to local without rewriting the app-side model menu

Even if you do not formalize that on day one, this is the direction I’d recommend.


Step 5: Run a smoke test from LibreChat

Once the endpoint is configured, test a simple chat request first.

Use something cheap and easy to inspect, like:

Write a Python function that reverses a string.

If that works, test a second request that makes backend behavior easier to reason about, like:

Summarize the difference between Redis and PostgreSQL in 5 bullets.

What you’re looking for:

  • LibreChat sends successfully to Lynkr
  • Lynkr forwards successfully to the configured provider
  • the response comes back normally in LibreChat

If this works, the base integration is done.


Step 6: Add one routing policy behind Lynkr

This is where the setup becomes more useful than direct provider wiring.

A good first pattern is:

  • route lightweight general chat to a cheaper model
  • route harder reasoning or code-heavy work to a stronger model

Conceptually, the setup looks like this:

LibreChat user chooses: chat-fast
  → Lynkr routes to cheaper tier

LibreChat user chooses: chat-quality
  → Lynkr routes to stronger tier

Even without exposing every provider in LibreChat, you still get flexibility behind the gateway.

That’s cleaner than giving end users six raw vendor choices and expecting them to know when each one is appropriate.


Step 7: Add fallback once the happy path works

Do not start with fallback complexity on the first try. Get one provider working first.

After that, the next useful improvement is fallback.

Example pattern:

  • primary backend: OpenRouter
  • fallback backend: Bedrock

or

  • primary backend: local Ollama model
  • fallback backend: stronger cloud model

This gives you a much better operational story than “LibreChat is hardwired to one provider and breaks when that provider has a bad day.”

That’s one of the clearest reasons to keep failover logic below the app layer.


A concrete request flow example

Here’s what this looks like in practice.

Without Lynkr

LibreChat → OpenAI directly

If you want to change providers, add fallback, or introduce routing, those concerns start leaking into the app layer.

With Lynkr

LibreChat → Lynkr → OpenRouter
                    ↘ Bedrock fallback

LibreChat stays pointed at one endpoint.

That means:

  • less config churn in the app
  • easier backend changes
  • cleaner rollout of new models
  • a better place to add caching and routing

Common gotchas

Here are the ones most likely to waste your time.

1. Wrong base URL

If you point LibreChat at:

http://localhost:8081

instead of:

http://localhost:8081/v1

you may hit endpoint mismatches depending on how the OpenAI-compatible client path is built.

Use the /v1 base URL.

2. Docker networking confusion

If LibreChat runs in Docker, localhost usually means the container itself, not your host machine.

Use a network-reachable host such as:

http://host.docker.internal:8081/v1

or a proper internal hostname.

3. Model name mismatch

If LibreChat sends a model string Lynkr does not recognize or route correctly, requests will fail even though the endpoint is reachable.

When debugging, simplify:

  • pick one known model string
  • use one provider
  • get one request working
  • only then layer routing or aliases on top

4. Starting with too much complexity

Don’t try to validate all of these at once:

  • custom endpoint
  • multiple providers
  • fallback
  • caching
  • routing
  • agents
  • MCP tools

Get the base chat completion path working first.

Then expand.

5. Treating LibreChat like the provider control plane

LibreChat is excellent at the user/product layer.

But if you keep using the app layer to own provider switching, cost control, and failover, you lose the main architectural benefit of using a gateway underneath it.

Keep the responsibilities split.


Why this setup is worth it

Even the minimal version gives you a better foundation than direct provider wiring.

You get:

  • one stable endpoint in LibreChat
  • provider portability behind the scenes
  • a better place for routing
  • a better place for fallback
  • a better place for caching
  • a cleaner path from simple chat UI to broader agent infrastructure

And as your setup grows, that separation only gets more valuable.


Minimal checklist

If you just want the shortest possible version, this is it:

  1. Install Lynkr
  2. Start Lynkr on port 8081
  3. Verify http://localhost:8081/v1 is reachable
  4. In LibreChat, add a custom OpenAI-compatible endpoint
  5. Set the base URL to http://localhost:8081/v1
  6. Use a model string Lynkr can route
  7. Run one smoke-test prompt
  8. Only after that, add routing and fallback

Final take

LibreChat already gives you the hard part: a good open-source surface for chat, agents, MCP, and self-hosting.

Lynkr gives you the missing infrastructure layer under it.

That combination is stronger than pushing all model concerns into the app itself.

If you’re building a self-hosted AI stack that needs to survive provider churn, model changes, and growing workflow complexity, this is the shape I’d use.

If this article was useful, star the repos and let me know if you want the next one to go deeper on:

  • LibreChat + Lynkr with Docker Compose
  • model aliases and routing strategy
  • using LibreChat agents on top of a Lynkr-backed stack