Custom endpoints defined in librechat.yaml are added to the model selection even if the ENDPOINTS configuration does not include "custom" #7634
Replies: 1 comment 1 reply
-
I moved this to "Troubleshooting" because a possible solution has already been implemented. You can utilize the new Config: modelSpecs:
enforce: false
prioritize: true
addedEndpoints: ["agents"]
list:
- name: "Sonnet 3.7"
label: "Sonnet 3.7"
iconURL: "anthropic"
description: "Smart, Efficient Conversational AI"
default: false
preset:
endpoint: "OpenRouter"
model: "anthropic/claude-3.7-sonnet"
modelLabel: "Sonnet 3.7" Note, I am using OpenRouter for my model spec, and I have only allowed "Agents" to be another option. Furthermore, you could limit the providers available to agents, in case you didn't want your custom endpoint to be used with Agents (in this case, OpenRouter is not included): agents:
allowedProviders: ["openAI", "azureOpenAI", "anthropic", "google"] You could limit the model selections for your endpoints by defining them explicitly. More info: https://www.librechat.ai/docs/configuration/librechat_yaml/object_structure/agents#allowedproviders |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What happened?
Expected behavior
Per the documentation, the
ENDPOINTS
environment variable is meant to customize the available endpoints in LibreChat. Ifcustom
is not present in theENDPOINTS
environment variable, I would expect that custom endpoints should not be loaded into the model selection dropdown.Actual behavior
If any custom endpoints are defined in the
librechat.yaml
file, they are loaded into the model selection dropdown even ifcustom
is NOT present in theENDPOINTS
environment variableWhy is this a problem?
It is easy to make the argument that "if you defined the custom endpoint, obviously you must want to make it available". However, this does not account for the case of using an LLM gateway.
In my organization, we only want a few models to be available on production, and with specific settings. To achieve this, we can use the
modelSpecs
parameter in thelibrechat.yaml
file.We also use LiteLLM as a gateway. This means that we need to define a custom endpoint in the
librechat.yaml
file, so that the definitions inmodelSpecs
can access the models.We do NOT want these endpoints to show outside of how we've defined them in
modelSpecs
. We only want them to be available in the specific way that we've defined them. Our environment file hasENDPOINTS=agents
- we want to include agents in the model selection list, but we do NOT want to include the endpoint that we defined (remember, we only defined it so that we could use it withmodelSpecs
).Technical details
api / server / services / Config / getEndpointsConfig.js > getEndpointsConfig
- line 19 (at the time of writing this) loads the custom endpoints REGARDLESS of whethercustom
is included in theENDPOINTS
environment variable.Suggested fix
Only load call
loadConfigEndpoints
ifcustom
is present in theENDPOINTS
environment variable configuration.Current code:
Potential fix:
NOTE: While this does work, it results in
getEnabledEndpoints()
being called twice (it is already called once inloadDefaultEndpointsConfig
). A more elegant solution may be to updateloadDefaultEndpointsConfig
to either take in the list of enabled endpoints, or perhaps to includecustom
in its returned values ifcustom
is present in theENDPOINTS
environment variable.Version Information
The last source commit we have in our mirror-pushed repository is commit c4f1da2, related to PR #6687. However, I have verified that the
main
branch of the LibreChat repository still contains the problematic code.Steps to Reproduce
ENDPOINTS
variable with a value that does not includecustom
.librechat.yaml
file, define a custom endpoint.What browsers are you seeing the problem on?
No response
Relevant log output
Screenshots
.env file:

librechat.yaml (individual. model specs collapsed for the sake of a smaller screenshot):

UI:

Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions