Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack 🎉 Learn more
LibreChat

共享 endpoint 设置

本页面介绍了所有 endpoint 的共享配置设置。除非另有说明,否则此处突出显示的设置适用于 "Endpoints" 字段下的所有配置。

示例配置

endpoints:
  # Individual endpoint configurations
  openAI:
    streamRate: 25
    titleModel: 'gpt-4o-mini'
    titleMethod: 'completion'
    titleTiming: 'immediate'
    titlePrompt: "Create a concise title for this conversation:\n\n{convo}"
    headers:
      X-Gateway-Metadata: '{"user_email":"{{LIBRECHAT_USER_EMAIL}}"}'
 
  azureOpenAI:
    streamRate: 35
    titleModel: 'grok-3'
    titleMethod: 'structured'
    titlePrompt: |
      Analyze this conversation and provide:
      1. A concise title in the detected language (5 words or less, no punctuation or quotation)
      2. Always provide a relevant emoji at the start of the title
 
      {convo}
    titleConvo: true
 
  anthropic:
    streamRate: 25
    titleModel: 'claude-3-5-haiku-20241022'
    titleMethod: 'completion'
    headers:
      X-Conversation-Id: '{{LIBRECHAT_BODY_CONVERSATIONID}}'
 
  bedrock:
    streamRate: 25
    titleModel: 'us.amazon.nova-lite-v1:0'
    titleEndpoint: 'anthropic'
 
  google:
    streamRate: 1
    titleModel: 'gemini-2.0-flash-lite'
    titlePromptTemplate: "Human: {input}\nAssistant: {output}"
    headers:
      X-Gateway-Metadata: '{"user_id":"{{LIBRECHAT_USER_ID}}"}'
 
  assistants:
    streamRate: 30
 
  azureAssistants:
    streamRate: 30
 
  # Global configuration using 'all' - this applies shared settings across endpoints.
  # Most defined values override endpoint defaults; headers are merged and endpoint values win on collisions.
  all:
    headers:
      X-App: 'librechat'
    titleConvo: true
    titleModel: 'gpt-4.1-nano'
    titleTiming: 'immediate'
    titlePrompt: |
      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)
      3. Always provide a relevant emoji at the start of the title
      {convo}

重要提示: 当使用 all 配置时,您定义的大多数共享属性将应用于所有 endpoint。在上面的示例中,all 配置会将 titleConvotitleModeltitlePrompt 应用于所有 endpoint,而各个 endpoint 的 streamRate 设置将被保留,因为它们未在 all 中定义。headers 会被单独合并:来自 endpoints.all.headers 的值将全局应用,且在键冲突时,endpoint 级别的 header 优先级更高。

streamRate

键:

KeyTypeDescriptionExample
streamRateNumber从 endpoint 流式传输数据的速率。用于控制流式数据的传输速度。streamRate: 25

默认值: 1

允许以尽可能快的速度流式传输数据,同时允许系统等待下一个时钟周期

titleConvo

键:

KeyTypeDescriptionExample
titleConvoBoolean为此 endpoint 启用自动对话标题生成。titleConvo: true

默认值: false

注意:

  • 启用后,将使用配置的标题设置自动生成标题。
  • 必须与 titleModel 结合使用,或者该 endpoint 必须具有可用的默认模型。

示例:

titleConvo: true

titleTiming

键:

KeyTypeDescriptionExample
titleTimingString控制何时生成对话标题。有效值为 "immediate" 或 "final"。titleTiming: "immediate"

默认值: "immediate"

可用值:

  • "immediate" - 在请求开始时立即生成标题,与模型响应并行,使用用户的第一条消息。标题通常会在一两秒内出现。
  • "final" - 将标题生成推迟到完整响应完成之后。这保留了旧有的行为。

示例:

endpoints:
  all:
    titleTiming: 'immediate'

titleModel

键:

KeyTypeDescriptionExample
titleModelString指定用于生成标题的模型。Defaults to system default for the current endpoint if omitted. May cause issues if the system default model is not available. You can also dynamically use the current conversation model by setting it to "current_model".

默认值: 当前 endpoint 的系统默认值

titleMethod

键:

KeyTypeDescriptionExample
titleMethodString控制用于生成对话标题的方法。Valid values: "completion" (default), "structured", "functions" (legacy alias for "structured")

默认值: "completion"

可用方法:

  • "completion" - 使用不带工具/函数的标准 completion API。兼容大多数 LLM。
  • "structured" - 使用结构化输出进行标题生成。需要提供商/模型支持。
  • "functions" - "structured" 的旧版别名。功能完全相同。

示例:

titleMethod: 'completion'

titlePrompt

键:

KeyTypeDescriptionExample
titlePromptString用于生成标题的自定义提示词。必须包含 {convo} 占位符。Allows full control over how titles are generated.

默认:

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}

注意:

  • 必须始终包含 {convo} 占位符
  • {convo} 占位符将被替换为格式化后的对话
  • 可以放置在提示词中的任何位置

示例:

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

titlePromptTemplate

键:

KeyTypeDescriptionExample
titlePromptTemplateString用于格式化对话内容并替换 titlePrompt 中 {convo} 的模板。Must include {input} and {output} placeholders.

默认值: "User: {input}\nAI: {output}"

注意:

  • 必须包含 {input}{output} 占位符
  • {input} 会被替换为用户的初始消息
  • {output} 会被替换为 AI 的回复
  • 格式化后的结果会替换 titlePrompt 中的 {convo}

示例:

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

titleEndpoint

键:

KeyTypeDescriptionExample
titleEndpointString指定用于生成标题的替代 endpoint。Allows using a different, potentially cheaper model/endpoint for titles.

默认: 使用当前对话的 endpoint

接受的值:

示例:

# Use Anthropic for titles even when chatting with OpenAI
endpoints:
  openAI:
    titleEndpoint: 'anthropic'
    # Will use anthropic's configuration for title generation

maxToolResultChars

键:

KeyTypeDescriptionExample
maxToolResultCharsNumber限制发送给模型的工具调用结果的最大字符数。必须为正数。maxToolResultChars: 50000

默认: 无限制

注意:

  • 有助于防止过大的工具输出消耗过多的 token
  • 应用于该 endpoint 的所有工具调用结果

示例:

endpoints:
  all:
    maxToolResultChars: 50000

headers

键:

KeyTypeDescriptionExample
headersObject/Dictionary转发至受支持的内置提供商 endpoint 的自定义请求标头。Useful for AI gateways and reverse proxies that consume metadata headers while LibreChat keeps provider-native request formatting.

支持的 endpoint: openAIanthropicgoogleall

示例:

endpoints:
  all:
    headers:
      X-App: 'librechat'
  anthropic:
    headers:
      X-Conversation-Id: '{{LIBRECHAT_BODY_CONVERSATIONID}}'

注意:

  • 值支持 ${ENV_VAR}{{LIBRECHAT_USER_*}} 以及请求体占位符,例如 {{LIBRECHAT_BODY_CONVERSATIONID}}
  • Endpoint 级别的 headers 会在键冲突时覆盖 endpoints.all.headers
  • 由提供商管理的身份验证以及必需的 beta/protocol 标头仍然具有权威性。Anthropic beta 值会进行合并,因此自定义 beta 标志不会覆盖必需的提供商标志。
  • 对于受支持的提供商模型列表请求,请求头也会被转发。
  • 在网关或反向代理后使用元数据标头,并由其进行处理。原生提供商 API 通常会忽略未知的标头。

注意:

  • 此页面上显示的所有设置都可以针对每个 endpoint 单独配置,也可以使用 all 键进行全局配置。
  • 当使用 all 配置时,它将覆盖所有独立 endpoint 中的相应设置。
  • all 键不支持 baseURL
  • 未在 all 中定义的设置将保留其各自的 endpoint 值
  • 对于 streamRate:建议取值在 25-40 之间,以获得流畅的流式传输体验
  • 当大规模向许多用户提供应用服务时,使用更高的流式传输速率是必须的。

覆盖行为示例:

endpoints:
  openAI:
    streamRate: 25 # This will be preserved
    titleModel: 'gpt-4' # This will be overridden
    titleConvo: false # This will be overridden
 
  all:
    titleConvo: true
    titleModel: 'gpt-3.5-turbo'
    # streamRate not defined here, so individual values are kept

Endpoint Settings

这篇指南怎么样?