# Facing issue using a model hosted on HuggingFace Server and talking to it using API\_KEY

**URL:** <https://discuss.huggingface.co/t/facing-issue-using-a-model-hosted-on-huggingface-server-and-talking-to-it-using-api-key/154529>\
**Category:** Beginners\
**Created:** [May 11, 2025, 9:15am UTC](https://discuss.huggingface.co/t/facing-issue-using-a-model-hosted-on-huggingface-server-and-talking-to-it-using-api-key/154529 "2025-05-11T09:15:16Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mahmutc](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mahmutc/32/52583_2.png) [@mahmutc](https://discuss.huggingface.co/u/mahmutc)\
**Post date:** [May 11, 2025, 4:04pm UTC](https://discuss.huggingface.co/t/facing-issue-using-a-model-hosted-on-huggingface-server-and-talking-to-it-using-api-key/154529/4 "2025-05-11T16:04:11Z")

</div>

`pip install langchain-huggingface langchain`

```auto
from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint
llm = HuggingFaceEndpoint(
  repo_id="deepseek-ai/DeepSeek-R1",
  provider="together"
)
model = ChatHuggingFace(llm=llm)
result = model.invoke("What is the capital of India")

```

This works for me with the following setup:

```auto
$ pip freeze | grep huggingface
huggingface-hub==0.31.1
langchain-huggingface==0.2.0
$ pip freeze | grep langchain
langchain==0.3.25
langchain-core==0.3.59
langchain-huggingface==0.2.0
langchain-text-splitters==0.3.8

```

---

_[View the full topic](https://discuss.huggingface.co/t/facing-issue-using-a-model-hosted-on-huggingface-server-and-talking-to-it-using-api-key/154529)._
