2begyb commited on
Commit
d75c09c
·
verified ·
1 Parent(s): 46960c9

Fix: Update LLM API endpoint from deprecated api-inference.huggingface.co to router.huggingface.co

Browse files
Files changed (1) hide show
  1. server/_core/llm.ts +2 -7
server/_core/llm.ts CHANGED
@@ -211,17 +211,12 @@ const normalizeToolChoice = (
211
  };
212
 
213
  const resolveApiUrl = (model: string) => {
214
- const hfToken = process.env.HF_TOKEN || process.env.HF_ACCESS_TOKEN;
215
-
216
- // If we have a token and it's a Hugging Face model, use the direct model endpoint
217
- if (hfToken && model.includes("/")) {
218
- return `https://api-inference.huggingface.co/models/${model}/v1/chat/completions`;
219
- }
220
-
221
  if (ENV.forgeApiUrl && ENV.forgeApiUrl.trim().length > 0) {
222
  return `${ENV.forgeApiUrl.replace(/\/$/, "")}/v1/chat/completions`;
223
  }
224
 
 
225
  return "https://router.huggingface.co/v1/chat/completions";
226
  };
227
 
 
211
  };
212
 
213
  const resolveApiUrl = (model: string) => {
214
+ // Prioritize BUILT_IN_FORGE_API_URL environment variable
 
 
 
 
 
 
215
  if (ENV.forgeApiUrl && ENV.forgeApiUrl.trim().length > 0) {
216
  return `${ENV.forgeApiUrl.replace(/\/$/, "")}/v1/chat/completions`;
217
  }
218
 
219
+ // Default to the new Hugging Face Router endpoint (api-inference.huggingface.co is deprecated)
220
  return "https://router.huggingface.co/v1/chat/completions";
221
  };
222