LibreChat

Custom Endpoint Object Structure

Each endpoint in the custom array should have the following structure:

Example

endpoints:
    custom:
        # Example using Mistral AI API
    - name: "Mistral"
        apiKey: "${YOUR_ENV_VAR_KEY}"
        baseURL: "https://api.mistral.ai/v1"
        models: 
        default: ["mistral-tiny", "mistral-small", "mistral-medium", "mistral-large-latest"]
        titleConvo: true
        titleModel: "mistral-tiny" 
        modelDisplayLabel: "Mistral"
        # addParams:
        #   safe_prompt: true # Mistral specific value for moderating messages
        # NOTE: For Mistral, it is necessary to drop the following parameters or you will encounter a 422 Error:
        dropParams: ["stop", "user", "frequency_penalty", "presence_penalty"]

name

Key:

KeyTypeDescriptionExample
nameStringA unique name for the endpoint.Will be used as the "title" in the Endpoints Selector

Required

Example:

name: "Mistral"

apiKey

Key:

KeyTypeDescriptionExample
apiKeyString (apiKey | "user_provided")Your API key for the service. Can reference an environment variable, or allow user to provide the value.It's highly recommended to use the env. variable reference for this field, i.e. `${YOUR_VARIABLE}`

Required

Example:

apiKey: "${MISTRAL_API_KEY}"

or

apiKey: "your_api_key"

or

apiKey: "user_provided"

baseURL

Key:

KeyTypeDescriptionExample
baseURLString (baseURL | "user_provided")Base URL for the API. Can reference an environment variable, or allow user to provide the value.It's highly recommended to use the env. variable reference for this field, i.e. `${YOUR_VARIABLE}`

Required

Example:

baseURL: "https://api.mistral.ai/v1"

or

baseURL: "${MISTRAL_BASE_URL}"

or

baseURL: "user_provided"

Notes:

  • If the baseURL you set is the full completions endpoint, you can set the directEndpoint field to true to use it directly.
    • This is necessary because the app appends "/chat/completions" or "/completion" to the baseURL by default.

iconURL

Key:

KeyTypeDescriptionExample
iconURLStringThe URL to use as the Endpoint Icon.

Default: ""

Example:

iconURL: https://github.com/danny-avila/LibreChat/raw/main/docs/assets/LibreChat.svg

Notes:

  • If you want to use existing project icons, define the endpoint name as one of the main endpoints (case-sensitive):
    • "openAI" | "azureOpenAI" | "google" | "anthropic" | "assistants" | "gptPlugins"
  • There are also "known endpoints" (case-insensitive), which have icons provided. If your endpoint name matches the following names, you should omit this field:
    • "Anyscale"
    • "APIpie"
    • "Cohere"
    • "Deepseek"
    • "Fireworks"
    • "groq"
    • "Helicone"
    • "Huggingface"
    • "Mistral"
    • "MLX"
    • "Moonshot"
    • "ollama"
    • "OpenRouter"
    • "Perplexity"
    • "Qwen"
    • "ShuttleAI"
    • "together.ai"
    • "Unify"
    • "xai"

models

Key:

KeyTypeDescriptionExample
modelsObjectConfiguration for models.

Required

Properties:

default

Key:

KeyTypeDescriptionExample
defaultArray of StringsAn array of strings indicating the default models to use.If fetching models fails, these defaults are used as a fallback.

Required

Example:

default:
  - "mistral-tiny"
  - "mistral-small"
  - "mistral-medium"

fetch

Key:

KeyTypeDescriptionExample
fetchBooleanWhen set to `true`, attempts to fetch a list of models from the API.May cause slowdowns during initial use of the app if the response is delayed. Defaults to `false`.

Default: false

Example:

fetch: true

userIdQuery

Key:

KeyTypeDescriptionExample
userIdQueryBooleanWhen set to `true`, adds the LibreChat user ID as a query parameter to the API models request.

Default: false

Example:

userIdQuery: true

titleConvo

Key:

KeyTypeDescriptionExample
titleConvoBooleanEnables title conversation when set to `true`.

Default: false

Example:

titleConvo: true

titleMethod

Key:

KeyTypeDescriptionExample
titleMethodStringControls the method used for generating conversation titles.Valid values: "completion" (default), "structured", "functions" (legacy alias for "structured")

Default: "completion"

Available Methods:

  • "completion" - Uses standard completion API without tools/functions. Compatible with most LLMs.
  • "structured" - Uses structured output for title generation. Requires provider/model support.
  • "functions" - Legacy alias for "structured". Functionally identical.

Example:

titleMethod: "completion"

titleModel

Key:

KeyTypeDescriptionExample
titleModelStringSpecifies the model to use for titles.Defaults to "gpt-3.5-turbo" if omitted. May cause issues if "gpt-3.5-turbo" is not available. You can also dynamically use the current conversation model by setting it to "current_model".

Default: "gpt-3.5-turbo"

Example:

titleModel: "mistral-tiny"
titleModel: "current_model"

titlePrompt

Key:

KeyTypeDescriptionExample
titlePromptStringCustom prompt for title generation. Must include {convo} placeholder.Allows full control over how titles are generated.

Default:

Analyze this conversation and provide:
1. The detected language of the conversation
2. A concise title in the detected language (5 words or less, no punctuation or quotation)

{convo}

Notes:

  • Must always include the {convo} placeholder
  • The {convo} placeholder will be replaced with the formatted conversation

Example:

titlePrompt: "Create a brief, descriptive title for the following conversation:\n\n{convo}\n\nTitle:"

titlePromptTemplate

Key:

KeyTypeDescriptionExample
titlePromptTemplateStringTemplate for formatting the conversation content that replaces {convo} in titlePrompt.Must include {input} and {output} placeholders.

Default: "User: {input}\nAI: {output}"

Notes:

  • Must include both {input} and {output} placeholders
  • Controls how the conversation is formatted when inserted into titlePrompt

Example:

titlePromptTemplate: "Human: {input}\n\nAssistant: {output}"

titleEndpoint

Key:

KeyTypeDescriptionExample
titleEndpointStringSpecifies an alternative endpoint to use for title generation.Allows using a different model/endpoint for titles.

Default: Uses the current custom endpoint

Accepted Values:

  • openAI
  • azureOpenAI
  • google
  • anthropic
  • bedrock
  • Another custom endpoint name

Example:

# Use a different custom endpoint for titles
endpoints:
  custom:
    - name: "my-chat-endpoint"
      apiKey: "${CHAT_API_KEY}"
      baseURL: "https://api.example.com/v1/chat"
      models:
        default: ["gpt-4"]
      titleEndpoint: "my-title-endpoint"
      
    - name: "my-title-endpoint"
      apiKey: "${TITLE_API_KEY}"
      baseURL: "https://api.example.com/v1/title"
      models:
        default: ["gpt-3.5-turbo"]

summarize

Key:

KeyTypeDescriptionExample
summarizeBooleanEnables summarization when set to `true`.This feature requires an OpenAI Functions compatible API

Default: false

Example:

summarize: false

summaryModel

Key:

KeyTypeDescriptionExample
summaryModelStringSpecifies the model to use if summarization is enabled.Defaults to "gpt-3.5-turbo" if omitted. May cause issues if "gpt-3.5-turbo" is not available.

Default: "gpt-3.5-turbo"

Example:

summaryModel: "mistral-tiny"

modelDisplayLabel

Key:

KeyTypeDescriptionExample
modelDisplayLabelStringThe label displayed in messages next to the Icon for the current AI model.The display order is: 1. Custom name set via preset (if available), 2. Label derived from the model name (if applicable), 3. This value is used if the above are not specified. Defaults to "AI".

Default: "AI"

Example:

modelDisplayLabel: "Mistral"

addParams

Key:

KeyTypeDescriptionExample
addParamsObject/DictionaryAdds additional parameters to requests.Adds/Overrides parameters. Useful for specifying API-specific options.

Example:

addParams:
  safe_prompt: true
  max_tokens: 2048

Notes:

  • The addParams field allows you to include additional parameters that are not part of the default payload(see the "Default Parameters" section). This is particularly useful for API-specific options.

dropParams

Key:

KeyTypeDescriptionExample
dropParamsArray/List of StringsRemoves default parameters from requests.Excludes specified default parameters. Useful for APIs that do not accept or recognize certain parameters.

Example:

dropParams:
  - "stop"
  - "user"
  - "frequency_penalty"
  - "presence_penalty"

Note:

  • The dropParams field allows you to remove "Default Parameters" that are sent with every request. This is helpful when working with APIs that do not accept or recognize certain parameters.

headers

Key:

KeyTypeDescriptionExample
headersObject/DictionaryAdds additional headers to requests. Supports dynamic user field substitution with `{{LIBRECHAT_USER_*}}`, request body placeholders with `{{LIBRECHAT_BODY_*}}`, and environment variables with `${ENV_VAR}`.The `headers` object specifies custom headers for requests. Useful for authentication and setting content types.

Example:

headers:
  x-api-key: "${ENVIRONMENT_VARIABLE}"
  Content-Type: "application/json"
  X-User-ID: "{{LIBRECHAT_USER_ID}}"
  X-User-Email: "{{LIBRECHAT_USER_EMAIL}}"

Note: Supports dynamic environment variable values, which use the format: "${VARIABLE_NAME}".

Available User Field Placeholders:

PlaceholderUser FieldTypeDescription
{{LIBRECHAT_USER_ID}}idStringUser's unique identifier
{{LIBRECHAT_USER_NAME}}nameStringUser's display name
{{LIBRECHAT_USER_USERNAME}}usernameStringUser's username
{{LIBRECHAT_USER_EMAIL}}emailStringUser's email address
{{LIBRECHAT_USER_PROVIDER}}providerStringAuthentication provider (e.g., "email", "google", "github")
{{LIBRECHAT_USER_ROLE}}roleStringUser's role (e.g., "user", "admin")
{{LIBRECHAT_USER_GOOGLEID}}googleIdStringGoogle account ID
{{LIBRECHAT_USER_FACEBOOKID}}facebookIdStringFacebook account ID
{{LIBRECHAT_USER_OPENIDID}}openidIdStringOpenID account ID
{{LIBRECHAT_USER_SAMLID}}samlIdStringSAML account ID
{{LIBRECHAT_USER_LDAPID}}ldapIdStringLDAP account ID
{{LIBRECHAT_USER_GITHUBID}}githubIdStringGitHub account ID
{{LIBRECHAT_USER_DISCORDID}}discordIdStringDiscord account ID
{{LIBRECHAT_USER_APPLEID}}appleIdStringApple account ID
{{LIBRECHAT_USER_EMAILVERIFIED}}emailVerifiedBoolean → StringEmail verification status ("true" or "false")
{{LIBRECHAT_USER_TWOFACTORENABLED}}twoFactorEnabledBoolean → String2FA status ("true" or "false")
{{LIBRECHAT_USER_TERMSACCEPTED}}termsAcceptedBoolean → StringTerms acceptance status ("true" or "false")

Available Request Body Placeholders:

PlaceholderBody FieldTypeDescription
{{LIBRECHAT_BODY_CONVERSATIONID}}conversationIdStringCurrent conversation identifier
{{LIBRECHAT_BODY_PARENTMESSAGEID}}parentMessageIdStringParent message identifier
{{LIBRECHAT_BODY_MESSAGEID}}messageIdStringCurrent message identifier

Example using request body placeholders:

headers:
  X-Conversation-ID: "{{LIBRECHAT_BODY_CONVERSATIONID}}"
  X-Parent-Message-ID: "{{LIBRECHAT_BODY_PARENTMESSAGEID}}"
  X-Message-ID: "{{LIBRECHAT_BODY_MESSAGEID}}"

directEndpoint

Key:

KeyTypeDescriptionExample
directEndpointBooleanWhen set to `true`, treats the configured `baseURL` as the completions endpoint to be used

Default: false

Example:

directEndpoint: true

titleMessageRole

Key:

KeyTypeDescriptionExample
titleMessageRoleStringSpecifies the role value to use in the message payload for title generation.Defaults to "system" if omitted. May cause issues if "system" is not a valid value, which is sometimes the case for single message payloads, as it is for title generation.

Default: "system"

Example:

titleMessageRole: "user"

How is this guide?