# 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2

**URL:** <https://discuss.huggingface.co/t/401-client-error-unauthorized-for-url-https-huggingface-co-api-whoami-v2/93981>\
**Category:** Beginners\
**Created:** [June 25, 2024, 11:35am UTC](https://discuss.huggingface.co/t/401-client-error-unauthorized-for-url-https-huggingface-co-api-whoami-v2/93981 "2024-06-25T11:35:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Himanshu9356](https://avatars.discourse-cdn.com/v4/letter/h/977dab/32.png) [@Himanshu9356](https://discuss.huggingface.co/u/Himanshu9356)\
**Post date:** [June 25, 2024, 11:35am UTC](https://discuss.huggingface.co/t/401-client-error-unauthorized-for-url-https-huggingface-co-api-whoami-v2/93981/1 "2024-06-25T11:35:56Z")

</div>

I am trying to access my model using ChatHuggingFace(llm=llm), however it is giving constant error. I have added images for details.  
I have access to the particular model as I am able to access it using langchain chains but there is some problem with ChatHuggingFace it seems.  
Please help!

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/2/9/2926d3315ee4557de6ec2960ee48f2c7e297bde8.png)

---

<div class="post-metadata">

**Author:** ![Himanshu9356](https://avatars.discourse-cdn.com/v4/letter/h/977dab/32.png) [@Himanshu9356](https://discuss.huggingface.co/u/Himanshu9356)\
**Post date:** [June 25, 2024, 11:36am UTC](https://discuss.huggingface.co/t/401-client-error-unauthorized-for-url-https-huggingface-co-api-whoami-v2/93981/2 "2024-06-25T11:36:27Z")

</div>

Here is the code:  
from langchain\_core.messages import (  
HumanMessage,  
SystemMessage,  
)  
from langchain\_huggingface import ChatHuggingFace

messages = [  
SystemMessage(content=“You’re a helpful assistant”),  
HumanMessage(  
content=“What happens when an unstoppable force meets an immovable object?”  
),  
]

chat\_model = ChatHuggingFace(llm=llm)

---

<div class="post-metadata">

**Author:** ![Quangnguyen711](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/quangnguyen711/32/29485_2.png) [@Quangnguyen711](https://discuss.huggingface.co/u/Quangnguyen711)\
**Post date:** [July 17, 2024, 6:24am UTC](https://discuss.huggingface.co/t/401-client-error-unauthorized-for-url-https-huggingface-co-api-whoami-v2/93981/3 "2024-07-17T06:24:07Z")

</div>

did you fix it?
