# Unauthorized for url error with huggingface

**URL:** <https://discuss.huggingface.co/t/unauthorized-for-url-error-with-huggingface/162606>\
**Category:** Beginners\
**Created:** [July 11, 2025, 9:32am UTC](https://discuss.huggingface.co/t/unauthorized-for-url-error-with-huggingface/162606 "2025-07-11T09:32:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anilsingh29](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@anilsingh29](https://discuss.huggingface.co/u/anilsingh29)\
**Post date:** [July 11, 2025, 9:32am UTC](https://discuss.huggingface.co/t/unauthorized-for-url-error-with-huggingface/162606/1 "2025-07-11T09:32:35Z")

</div>

Keep getting this error message

File “\langchain-models\venv\Lib\site-packages\huggingface\_hub\utils\_http.py”, line 477, in hf\_raise\_for\_status  
raise \_format(HfHubHTTPError, str(e), response) from e  
huggingface\_hub.errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: [https://api-inference.huggingface.co/models/deepseek-ai/DeepSeek-R1-0528/v1/chat/completions](https://api-inference.huggingface.co/models/deepseek-ai/DeepSeek-R1-0528/v1/chat/completions) (Request ID: Root=1-6870d8eb-5a9733c17f893c654b51371f;0a7a931e-b853-48bd-9540-91a1fb0f9316)

**Invalid username or password.**

---

<div class="post-metadata">

**Author:** ![Felicitywood](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/felicitywood/32/49463_2.png) [@Felicitywood](https://discuss.huggingface.co/u/Felicitywood)\
**Post date:** [July 11, 2025, 10:43am UTC](https://discuss.huggingface.co/t/unauthorized-for-url-error-with-huggingface/162606/2 "2025-07-11T10:43:12Z")

</div>

The token might be missing or may not have access. Recheck that.

---

<div class="post-metadata">

**Author:** ![anilsingh29](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@anilsingh29](https://discuss.huggingface.co/u/anilsingh29)\
**Post date:** [July 11, 2025, 11:02am UTC](https://discuss.huggingface.co/t/unauthorized-for-url-error-with-huggingface/162606/3 "2025-07-11T11:02:52Z")

</div>

![hf_token](https://us1.discourse-cdn.com/hellohellohello/original/3X/4/f/4f23414fb5865aa709f1c6b4b9fe57b3584d35f9.png)

I had created this read-only token, which I am using it by setting HUGGINGFACEHUB\_ACCESS\_TOKEN

---

<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:** [July 11, 2025, 1:37pm UTC](https://discuss.huggingface.co/t/unauthorized-for-url-error-with-huggingface/162606/5 "2025-07-11T13:37:07Z")

</div>

> [api-inference.huggingface.co](http://api-inference.huggingface.co)

[This format’s endpoint has probably been discontinued](https://discuss.huggingface.co/t/dumb-question-seeing-that-my-inference-api-links-not-working/162505), so you will need to find a new endpoint URL. It should be relatively easy to find by searching from the Deploy button [on the model page](https://huggingface.co/models?inference_provider=all&sort=trending).
