…face.co
HuggingFace deprecated https://api-inference.huggingface.co; requests to it
now return 404 (the endpoint was retired on 2025-11-01). The package still
used it as the default URL, so HuggingFace LLM and embedding calls fail by
default unless the caller overrides the URL.
Point defaultURL at the hf-inference provider on the new router
(https://router.huggingface.co/hf-inference). The client builds request URLs
as "%s/models/%s", so the base must omit a trailing /models; the resulting
URL is https://router.huggingface.co/hf-inference/models/<model>, which is
HuggingFace's documented replacement for the legacy task endpoint.
Update the TestHuggingFaceLLMStandardInference replay fixture to target the
new endpoint accordingly.
Fixes tmc#1428
Signed-off-by: bozhouDev <259759010+bozhouDev@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
PR Checklist
Description
Fixes #1428.
HuggingFace deprecated https://api-inference.huggingface.co and requests to it now return 404 (the endpoint was retired on 2025-11-01). llms/huggingface still used it as defaultURL, so HuggingFace LLM and embedding calls fail by default unless the caller overrides the URL.
This points defaultURL at the hf-inference provider on the new router.
URL construction note: the client builds request URLs as fmt.Sprintf("%s/models/%s", c.url, model) (see internal/huggingfaceclient/inference.go and embeddings.go), so the base must omit a trailing /models. Using https://router.huggingface.co/hf-inference yields:
which is HuggingFace's documented replacement for the legacy task-based endpoint. (Note: the literal https://router.huggingface.co/hf-inference/models suggested in the issue would produce a doubled path — .../hf-inference/models/models/<model> — so the base is set without the trailing /models.)
Verification
The TestHuggingFaceLLMStandardInference replay fixture is updated to target the new endpoint so the test stays consistent with the new default.
Caveat (please review): the replay fixture's recorded response is the prior 404 from the deprecated host (the test already t.Skips on 404). I don't have HuggingFace credentials to re-record a live 200 against the new endpoint, so a fresh recording with HF_TOKEN would be a welcome follow-up.