Skip to content

.Net: fix(huggingface): move off retired api-inference.huggingface.co to router.huggingface.co - #14667

Open
Agustin Torres (torrresagus) wants to merge 2 commits into
microsoft:mainfrom
tiltmeter-dev:fix/huggingface-router
Open

Agustin Torres (torrresagus) wants to merge 2 commits into
microsoft:mainfrom
tiltmeter-dev:fix/huggingface-router

Conversation

@torrresagus

Copy link
Copy Markdown

What changed in the API

Notice huggingface-serverless-inference-api-retired about huggingface.co's API describes this change, published 2025-07-01. It is not signed by huggingface.co: it was read from a file the person running Tiltmeter trusts.

The notice's summary:

The serverless Inference API at api-inference.huggingface.co is gone: its domain no longer resolves
(checked October 27, 2026), so requests fail before they reach Hugging Face. Its successor, HF
Inference, answers at router.huggingface.co/hf-inference with the same requests and responses per
task, and the OpenAI-compatible chat API moved to router.huggingface.co/v1. Sources:
huggingface.co/docs/inference-providers and the huggingface_hub client.

POST https://api-inference.huggingface.co/models/{model}

Severity Change Path Before After
breaking endpoint_removed $ — (gone), moved to POST https://router.huggingface.co/hf-inference/models/{model}

POST https://api-inference.huggingface.co/pipeline/feature-extraction/{model}

Severity Change Path Before After
breaking endpoint_removed $ — (gone), moved to POST https://router.huggingface.co/hf-inference/models/{model}/pipeline/feature-extraction

POST https://api-inference.huggingface.co/models/{model}/v1/chat/completions

Severity Change Path Before After
breaking endpoint_removed $ — (gone), moved to POST https://router.huggingface.co/v1/chat/completions

POST https://api-inference.huggingface.co/v1/chat/completions

Severity Change Path Before After
breaking endpoint_removed $ — (gone), moved to POST https://router.huggingface.co/v1/chat/completions

The notice's notes:

POST /models/{model}: Same request body and response for the model's task. HF Inference needs a
token (Bearer hf_...) with the Inference Providers permission, and since July 2025 it serves mostly
CPU models such as embeddings and classifiers; large chat models are served through
router.huggingface.co/v1/chat/completions.
POST /pipeline/feature-extraction/{model}: The task now comes after the model. Same body (inputs)
and the same array of embeddings back. HF Inference needs a token (Bearer hf_...) with the Inference
Providers permission, and since July 2025 it serves mostly CPU models such as embeddings and
classifiers; large chat models are served through router.huggingface.co/v1/chat/completions.
POST /models/{model}/v1/chat/completions: Send the model id in the body's model field instead of the
path; the router picks a provider that serves it. An OpenAI client's base URL changes from
https://api-inference.huggingface.co/v1 to https://router.huggingface.co/v1.
POST /v1/chat/completions: Same OpenAI-compatible body and response. An OpenAI client's base URL
becomes https://router.huggingface.co/v1.

What this pull request changes

I moved the .NET HuggingFace connector off the retired api-inference.huggingface.co host. Text generation, image-to-text and embeddings now default to router.huggingface.co/hf-inference, and embeddings use the new path order: models/{model}/pipeline/feature-extraction. Chat completion now defaults to router.huggingface.co/v1/chat/completions, with the model id still sent in the request body. I updated the unit tests, the TelemetryWithAppInsights and F# samples, and the integration testsettings.json to match. Nothing was built or run.

  • dotnet/samples/Demos/FSharpScripts/huggingFaceChatCompletion.fsx
  • dotnet/samples/Demos/TelemetryWithAppInsights/Program.cs
  • dotnet/src/Connectors/Connectors.HuggingFace.UnitTests/Services/HuggingFaceChatCompletionTests.cs
  • dotnet/src/Connectors/Connectors.HuggingFace.UnitTests/Services/HuggingFaceEmbeddingGenerationTests.cs
  • dotnet/src/Connectors/Connectors.HuggingFace.UnitTests/Services/HuggingFaceEmbeddingGeneratorTests.cs
  • dotnet/src/Connectors/Connectors.HuggingFace.UnitTests/Services/HuggingFaceImageToTextTests.cs
  • dotnet/src/Connectors/Connectors.HuggingFace.UnitTests/Services/HuggingFaceTextGenerationTests.cs
  • dotnet/src/Connectors/Connectors.HuggingFace/Core/HuggingFaceClient.cs
  • dotnet/src/Connectors/Connectors.HuggingFace/Core/HuggingFaceMessageApiClient.cs
  • dotnet/src/IntegrationTests/testsettings.json

Left for a human

  • The embeddings URL now always puts the task after the model (models/{model}/pipeline/feature-extraction), including when the caller passes their own endpoint. Callers who point the embedding service at a server that still uses the old path order would need to adjust.
  • HF Inference now needs an hf_ token with the Inference Providers permission, and since July 2025 it serves mostly CPU models. Text-generation models such as the integration test's microsoft/phi-2 may no longer be served there. That can't be fixed with code edits.
  • The F# script still pins the Microsoft.SemanticKernel.Connectors.HuggingFace 1.12.0-preview NuGet package. Its chat endpoint now points at router.huggingface.co, but the package version was not raised because no release with this fix exists yet.

This pull request was generated automatically by Tiltmeter from the unsigned notice huggingface-serverless-inference-api-retired about huggingface.co's API. An AI agent (Claude Code with claude-opus-5-5) wrote these edits; review them like any other change.

… to router.huggingface.co

I moved the .NET HuggingFace connector off the retired api-inference.huggingface.co host. Text generation, image-to-text and embeddings now default to router.huggingface.co/hf-inference, and embeddings use the new path order: models/{model}/pipeline/feature-extraction. Chat completion now defaults to router.huggingface.co/v1/chat/completions, with the model id still sent in the request body. I updated the unit tests, the TelemetryWithAppInsights and F# samples, and the integration testsettings.json to match. Nothing was built or run.

Notice huggingface-serverless-inference-api-retired about huggingface.co's API describes the change. It was read from a file and is not signed by the provider.
@torrresagus
Agustin Torres (torrresagus) requested a review from a team as a code owner October 27, 2026 05:28
Copilot AI balanced review requested due to automatic review settings October 27, 2026 05:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@semantic-kernel-automation semantic-kernel-automation Bot added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels Oct 27, 2026
@torrresagus

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

This branch was successfully deployed

1 active deployment
github-app-auth — 34246817 Deployed Oct 27, 2026 by torrresagus via add_label #29465
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants