# API Token not being recognized

**URL:** <https://discuss.huggingface.co/t/api-token-not-being-recognized/156624>\
**Category:** Beginners\
**Created:** [May 24, 2025, 2:14pm UTC](https://discuss.huggingface.co/t/api-token-not-being-recognized/156624 "2025-05-24T14:14:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [May 24, 2025, 11:08pm UTC](https://discuss.huggingface.co/t/api-token-not-being-recognized/156624/2 "2025-05-24T23:08:08Z")

</div>

401 errors are usually caused by network errors or environment variables, but there seem to be rare cases like this.

> [@401 Error when trying to upload model from local machine](https://discuss.huggingface.co/t/401-error-when-trying-to-upload-model-from-local-machine/156020):
>
> Hello everyone, im currently training LLMs locally with the Unsloth framework. After training they provide a way to upload your model to the Huggingface Hub. model.push\_to\_hub\_gguf( “LuuWee/modelspacename”, # Change hf to your username! tokenizer, quantization\_method = [“q4\_k\_m”, “q8\_0”, “q5\_k\_m”,], token = “hf\_access\_token”, ) For it to upload you need to add your username and an Accesstoken in the request. This worked for me when i trained in Google Colab. I tried the same thing in my …

> [@Huggingface-cli login issue](https://discuss.huggingface.co/t/huggingface-cli-login-issue/136547/3):
>
> i seemed to have in ~/.netrc credentials for [huggingface.co](http://huggingface.co), which i think they might have overridden my Authorization header. a smiple rm ~/.netrc did the trick

> i seemed to have in `~/.netrc` credentials for [huggingface.co](http://huggingface.co), which i think they might have overridden my Authorization header.  
> a smiple `rm ~/.netrc` did the trick

---

_[View the full topic](https://discuss.huggingface.co/t/api-token-not-being-recognized/156624)._
