🔼 feat: Vercel App Attribution for LibreChat (#9769)

This commit is contained in:
Danny Avila 2025-09-22 16:15:15 -04:00 committed by GitHub
parent 880c7b43a1
commit 91e49d82aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -41,6 +41,9 @@ export function getOpenAIConfig(
!isAnthropic &&
((baseURL && baseURL.includes(KnownEndpoints.openrouter)) ||
(endpoint != null && endpoint.toLowerCase().includes(KnownEndpoints.openrouter)));
const isVercel =
(baseURL && baseURL.includes('ai-gateway.vercel.sh')) ||
(endpoint != null && endpoint.toLowerCase().includes(KnownEndpoints.vercel));
let azure = options.azure;
let headers = options.headers;
@ -80,7 +83,7 @@ export function getOpenAIConfig(
if (baseURL) {
configOptions.baseURL = baseURL;
}
if (useOpenRouter) {
if (useOpenRouter || isVercel) {
configOptions.defaultHeaders = Object.assign(
{
'HTTP-Referer': 'https://librechat.ai',

View file

@ -889,6 +889,7 @@ export enum KnownEndpoints {
shuttleai = 'shuttleai',
'together.ai' = 'together.ai',
unify = 'unify',
vercel = 'vercel',
xai = 'xai',
}
@ -925,6 +926,7 @@ export const alternateName = {
[KnownEndpoints.ollama]: 'Ollama',
[KnownEndpoints.deepseek]: 'DeepSeek',
[KnownEndpoints.xai]: 'xAI',
[KnownEndpoints.vercel]: 'Vercel',
};
const sharedOpenAIModels = [