When making requests to HuggingFace Inference API, replace https://api-inference.huggingface.co/models/ in the URL you’re currently using with https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/huggingface. Note that the model you’re trying to access should come right after, for example https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/huggingface/bigcode/starcoder.
Examples
cURL
Use HuggingFace.js library with JavaScript
If you are using the HuggingFace.js library, you can set your inference endpoint like this:
Was this helpful?
What did you like?
What went wrong?
Thank you for helping improve Cloudflare's documentation!