Skip to content

Conversation

@castortech
Copy link

Started getting error:
[cause]: Error: "https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co/hf-inference instead."
2025-11-03T20:03:28:802 |- at request (file:///usr/local/lib/node_modules/@alpic80/rivet-cli/node_modules/@huggingface/inference/dist/index.js:204:15)

Started getting error:
[cause]: Error: "https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co/hf-inference instead."
2025-11-03T20:03:28:802 |-       at request (file:///usr/local/lib/node_modules/@alpic80/rivet-cli/node_modules/@huggingface/inference/dist/index.js:204:15)
@jyroscoped
Copy link

  • The upgrade of the @huggingface/inference package from version ^2.6.4 to ^4.13.0 is a significant version jump. Verify that version 4.13.0 is fully compatible with your existing codebase, as major version bumps can introduce breaking changes.

  • The imports have been updated to replace HfInference and HfInferenceEndpoint with the single InferenceClient class, reflecting an API change in the new library version. This is correct, but ensure that all usages of the old classes throughout the codebase are updated accordingly to prevent inconsistencies.

  • Instantiation of the client has changed to use new InferenceClient(accessToken, {endpointUrl: endpoint}) when an endpoint is specified, and new InferenceClient(accessToken) otherwise. This is appropriate per the new API, but be sure the endpointUrl option is supported as shown.

  • In textGenerationStream() and textToImage() calls, the parameter structure has been adapted to the new client API, including returning a blob from textToImage() by specifying { outputType: \"blob\" }. This matches typical usage patterns in the latest SDK.

  • Consider adding error handling around the new InferenceClient usages, as new API versions often return different error types or messages.

  • To future-proof the code, add comments referencing the version upgrade and client change for maintainers to understand the context of the update.

  • Double-check if other Hugging Face SDK usages elsewhere in the project require similar refactors to maintain consistency.

  • Confirm through tests that streaming of generated text and image generation functionality operate correctly with the new client and version.

  • Since this is a major dependency upgrade, run thorough integration and regression tests to catch any subtle issues from the API changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants