@@ -7,7 +7,7 @@ import type { InferenceProvider } from "../types";
77import type { InferenceTask , Options , RequestArgs } from "../types" ;
88import { isUrl } from "./isUrl" ;
99
10- const HF_HUB_INFERENCE_PROXY_TEMPLATE = `{{HF_HUB_URL}}/inference-proxy/{{PROVIDER}}` ;
10+ const HF_HUB_INFERENCE_PROXY_TEMPLATE = `{{HF_HUB_URL}}/api/ inference-proxy/{{PROVIDER}}` ;
1111
1212/**
1313 * Lazy-loaded from huggingface.co/api/tasks when needed
@@ -34,7 +34,7 @@ export async function makeRequestOptions(
3434 const { accessToken, endpointUrl, provider : maybeProvider , model : maybeModel , ...otherArgs } = args ;
3535 const provider = maybeProvider ?? "hf-inference" ;
3636
37- const { forceTask, includeCredentials, taskHint, wait_for_model, use_cache, dont_load_model, chatCompletion } =
37+ const { forceTask, includeCredentials, taskHint, wait_for_model, use_cache, dont_load_model, chatCompletion, hfHubUrl } =
3838 options ?? { } ;
3939
4040 if ( endpointUrl && provider !== "hf-inference" ) {
@@ -76,15 +76,15 @@ export async function makeRequestOptions(
7676 authMethod,
7777 chatCompletion : chatCompletion ?? false ,
7878 forceTask,
79- hfHubUrl : options ?. hfHubUrl ?? HF_HUB_URL ,
79+ hfHubUrl : hfHubUrl ?? HF_HUB_URL ,
8080 model,
8181 provider : provider ?? "hf-inference" ,
8282 taskHint,
8383 } ) ;
8484
8585 const headers : Record < string , string > = { } ;
8686 if ( accessToken ) {
87- headers [ "Authorization" ] = provider === "fal-ai" ? `Key ${ accessToken } ` : `Bearer ${ accessToken } ` ;
87+ headers [ "Authorization" ] = provider === "fal-ai" && authMethod === "provider-key" ? `Key ${ accessToken } ` : `Bearer ${ accessToken } ` ;
8888 }
8989
9090 const binary = "data" in args && ! ! args . data ;
0 commit comments