401 - but my API key should be valid

I am completely new to Hugging Face. So I asked Grok to hold my hand while I entered. After a long discussion and many tries Grok kind of gave up and told me to ask here.

I have this curl command (windows cmd format):

curl -v https://huggingface.co/proxy/api-inference.huggingface.co/models/microsoft/DialoGPT-medium ^
-X POST ^
-d ‘{“inputs”: “The goal of life is”}’ ^
-H ‘Authorization: Bearer %KEY_HF%’ ^
-H ‘Content-Type: application/json’ ^
-o temp.html 2> curl_debug.txt

I am on a free plan. The API key is fresh and should be valid for READ. I get 401. Why?

Hi @Lejonhjarta welcome :waving_hand: We have info on authentication here. Make sure you’re using a fine-grained token with Make calls to Inference Providers permissions enabled.

Unfortunately, the model microsoft/DialoGPT-medium · Hugging Face isn’t deployed with any Inference Provider at this time. On the model page you can click ‘Ask for Provider Support’.

Check out our filtered list of 48k+ models deployed with at least one Inference Provider. You can also use DialoGPT-medium with Inference Endpoints instead.

We have a guide Send Your First API Call if you’d like a walkthrough, and make sure to subscribe to PRO to unlock 20× included inference credits!

Hope this helps! :hugs:

Thanks. I created a new access token with permissions FINEGRAINED (where I checked “inference”).

And I switched to the first model in that “filtered list”.
set MODEL=zai-org/GLM-4.6

Unfortunately I still get 401.

I think I have to give up on Hugging Face. I have not find anything that works on the free tier. So I can not test.

And unfortunately I have not find any info about how secure the payment system is. There does not seem to have been any evaluation of that?

Can you please double check that your code snippet looks like this: zai-org/GLM-4.6 · Hugging Face? (You can find this on the model page by clicking Deploy > Inference Providers)

Check out our guide here as well: Inference Providers .

informative!