Persistent 404 "Not Found" Error from API despite extensive troubleshooting

I am consistently receiving a 404 “Not Found” error when trying to make a POST request to the Inference API (e.g., for the gpt2 model).

Here is what I have already tried:

  1. Used the correct PowerShell command: Invoke-WebRequest -Uri “https://api-inference.huggingface.co/models/gpt2” -Method POST …
  2. Generated a new API token with “write” permissions.
  3. Tested the command on two completely different networks (my home Wi-Fi and my mobile data provider). The 404 error persists on both.
  4. To confirm my machine and network are working, I successfully made a POST request to https://httpbin.org/post. The test was successful (200 OK).

This indicates the issue is not with my local setup but is specific to the connection to the Hugging Face API from my location/account.`

Could you please help me investigate this?

1 Like

Hi @ai4bilal thanks for posting! This issue is similar to the one here: 404 to any API i tried - #6 by meganariley.

You can request inference provider support for gpt2 on the model page: openai-community/gpt2 · Hugging Face (Click on ‘Ask for provider support’) or use this model with Inference Endpoints instead.

To see which models are available to use with HF Inference, check out our filtered search here. You can also subscribe to PRO! Perks include: 20x more inference usage, 8x ZeroGPU quota, 10x private storage capacity :rocket: Check out PRO Account - Hugging Face for details.

1 Like