Add a custom endpoint to LibreChat’s YAML configuration with a fixed LM Studio base URL and an exact model ID. Restart LibreChat’s backend, choose the new endpoint in a fresh chat, and check a short prompt in the browser while observing LM Studio’s request activity. This setup is for both backend processes running directly on the same Mac. The server-side destination matters because LibreChat’s backend sends the inference request.
This guide assumes you already run LibreChat from its project directory and can restart that process during a short maintenance window. It also assumes LM Studio serves a text chat model. The small exercise uses fictional parts and shelf locations. The model listing request establishes the correct address and ID before you change the browser interface’s configuration. LibreChat custom endpoints.
Identify the two local processes
Open the LM Studio Developer interface and note its running server’s loopback address and port. LibreChat has its own local browser address. The two URLs belong to different services. Visit LibreChat in the ordinary browser tab you already use. Use Terminal to contact the model server. Neither check requires entering a prompt into an existing conversation.
curl -sS --connect-timeout 2 http://127.0.0.1:1234/v1/models
This example uses port 1234. Use the live server’s port if it differs. If the listener requires a token, include its local bearer header when checking the listing. Record a chat model ID exactly as returned. The visible model name in a GUI can be shorter than the value supplied to the chat route. If the expected model is absent, revisit the running instance and its settings before adding an option in LibreChat. LM Studio models reference.
Confirm where LibreChat’s backend actually runs. Its browser page can appear on the Mac while the backend lives in a container or on another machine. A fixed loopback URL points at the Mac in the setup described here because the backend process runs directly on that host. Confirm that fact through the terminal or startup configuration currently used for your active LibreChat instance. A browser that can open a URL on the Mac does not establish the backend’s view of loopback.
Add one endpoint to the active configuration
Find the project’s active librechat.yaml. Save a backup of the existing file before making an edit. If your installation already has an endpoints section, add this new entry inside its existing custom list. Keep the other entries and the existing configuration version in place. If you need an initial YAML file, start with the template for your installed version and add the relevant section. The official configuration guide explains the search location and the custom file’s role. LibreChat custom configuration file.
Use a distinct display name for the test so you can tell it apart from any other endpoint. Supply a fixed base URL ending in /v1. The client adds the chat path itself. Set the model default to the exact LM Studio ID and keep model fetching disabled for this first pass. Disabling automatic titles makes the one conversation request easier to match in the server log. LibreChat custom endpoint fields.
endpoints:
custom:
- name: "LM Studio on this Mac"
apiKey: "${LM_STUDIO_LOCAL_KEY}"
baseURL: "http://127.0.0.1:1234/v1"
models:
default:
- "REPLACE_WITH_LOCAL_MODEL_ID"
fetch: false
titleConvo: false
The key field refers to an environment variable in LibreChat’s backend configuration. In the project’s active .env file, define LM_STUDIO_LOCAL_KEY with the local LM Studio token when authentication is enabled. When the loopback listener accepts requests without a token, use a non-secret placeholder such as loopback-placeholder for this client’s key field. This satisfies the client configuration’s requirement for a value. It does not enable authentication on the model server. Keep real tokens in the environment and out of the YAML and any shared review. LM Studio API authentication.
Keep the model value quoted when adding it to the list. A slash or colon can be part of a valid ID, and using a quoted scalar preserves the exact string. Make sure the outer endpoints key and inner custom key each occur once in the relevant mapping. YAML syntax checking can catch broken indentation. LibreChat’s configuration schema checks additional requirements when the backend reads the file.
Restart the backend and select the new endpoint
Wait until other users of your local instance have finished their current requests. Stop the running backend process using the command or service management method already used for your installation. LibreChat’s quick start lists npm run backend for a direct local process. If you use a different existing command, use it from the same project directory and environment. Keep the startup output available in the terminal when verifying the new endpoint.
Reload LibreChat’s browser page and open a fresh conversation. Choose LM Studio on this Mac from the endpoint selector and choose the model you configured. It can appear as an available option because you supplied a default model string. This is useful for a controlled first test, but a displayed choice does not confirm that the current LM Studio service accepts it.
Paste this one-turn fixture in the new chat. Use ordinary chat without document attachments, web tools, or agents. It asks the model for a specific label in a sample with two locations. The inference server can answer the whole question from this message.
Sample parts note: the small clamps are on Shelf M4. The long hinges are on Shelf Q7. Reply with only the shelf for the long hinges.
Expect Shelf Q7. Check that the browser shows the answer and that LM Studio records a corresponding inference request. Repeat with Shelf T2 replacing Shelf Q7, keeping the clamp location unchanged. A second fresh conversation should show Shelf T2. The changed result is a convenient check if you had an old conversation selected or if another model is enabled in the browser. LM Studio’s explicit Chat Completions endpoint provides a separate place to check the same textual input if the provider connection needs diagnosis. LM Studio Chat Completions.
Use each error to identify the configuration layer
If the backend fails to start, inspect its terminal output first. A YAML syntax or configuration validation error can prevent the backend from loading. Put the saved version next to the edited copy and compare where the custom list sits, including indentation. A valid YAML file can still contain an entry that does not fulfill LibreChat’s endpoint requirements.
If LibreChat opens and the endpoint is missing, verify you edited the active file and followed the new entry’s required field structure. The endpoint needs its name, base URL, key, and model list. A fresh browser session can help when you have already confirmed a backend restart. When the option is visible but the first request says a key is missing, inspect the active backend environment and the variable’s spelling. Startup availability and successful token substitution are separate observations.
If a generation fails after reaching LM Studio, compare the effective model ID and credentials with the earlier listing. If the listener shows no request, start with the backend’s network location and base address. A service refusal suggests the listener address or state. An HTTP route error from the active model server can indicate that the base URL contained too many path segments. Read the resulting request where the logs expose it before replacing a known chat model.
Preserve one useful configuration and one rollback
Keep the prior YAML copy until both synthetic replies appear through the intended listener. Record the local server port, app versions, endpoint display name, and model ID in a short handoff note. Include the way you verified the backend runs on the same Mac. Leave all actual token values out of the note. These details let you diagnose the integration after either process restarts or an application upgrade changes the startup command.
When restoring the previous setup, make the rollback in the active project directory. Restart the backend and use a fresh browser conversation to check that the earlier selector behavior returned. If both configurations are useful, keep them as distinct entries only after checking which model and local URL each uses. A specific display name and a two-message fixture make future provider switches auditable without placing real material into a test session.
Decide when a static model list is enough
The example uses one default ID so the initial result can be attributed to one model. If you intend to show a larger set, first determine whether the names should stay stable even when a short-lived model is loaded into LM Studio. A static shortlist lets an administrator review exactly which choices appear. Automatic fetching can show the currently advertised model set and can change when the inference service is unavailable or its configuration changes. LibreChat documents the default list as a fallback when fetching fails. Decide which behavior your users expect before editing the selector configuration.
For a two-model trial, give each artifact a distinct model ID and send the shelf question with each as a fresh conversation. Note which choice was active when the answer was returned. If a model ID was changed during an LM Studio update, refresh the recorded listing and the model defaults together. The endpoint’s display name can stay the same while the actual value used in requests changes. This is one reason to record the exact identifier in a change note.
If you remove a model entry, use a new conversation to check the new list. An existing conversation can still contain settings from an earlier endpoint selection. Keep the older configuration available until you know how that saved conversation behaves. A useful transition check has one old chat, one fresh chat, and the independent live model list. These three observations tell you whether the visible selector, an old conversation, or the inference service itself accounts for a remaining difference.
Compare the backend’s active environment with your working shell
When the custom endpoint appears but fails on its first turn, confirm that the backend found the same environment file you changed. A restart from a different project directory can load a different configuration, and a background service can have its own environment. The shell value visible in a new Terminal does not automatically describe the process that currently serves the browser. Check the command and working directory used for that backend and compare them with your known successful startup. Keep the value of any real token private while checking whether its variable name was recognized.
If you suspect the path is wrong, compare the three concrete endpoints involved. The browser page uses LibreChat’s own address. The configured versioned base points to LM Studio. The actual generation request is the chat route at that base. Use the models call to confirm the intermediate base and the server log to see which route the backend asked for. An accidental copy of the entire chat URL into a base field can repeat the path, even while the first independent models check remains healthy.
Once you have verified the custom entry, consider one inventory prompt through your old familiar endpoint and one through this new one, each with disposable sample facts. Observe which local requests appear. A label in the menu can be easy to confuse with a similar provider entry. Giving the local one a clear display name and recording the actual backend address make a later support report more precise.