# Text2vec-huggingface and text2vec-openai API key is invalid after installing weaviate through docker

**URL:** <https://forum.weaviate.io/t/text2vec-huggingface-and-text2vec-openai-api-key-is-invalid-after-installing-weaviate-through-docker/399>\
**Category:** General\
**Created:** [July 20, 2023, 6:27am UTC](https://forum.weaviate.io/t/text2vec-huggingface-and-text2vec-openai-api-key-is-invalid-after-installing-weaviate-through-docker/399 "2023-07-20T06:27:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zmliu213](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/zmliu213/32/3427_2.png) [@zmliu213](https://forum.weaviate.io/u/zmliu213)\
**Post date:** [July 20, 2023, 6:27am UTC](https://forum.weaviate.io/t/text2vec-huggingface-and-text2vec-openai-api-key-is-invalid-after-installing-weaviate-through-docker/399/1 "2023-07-20T06:27:39Z")

</div>

I installed weaviate through docker and enable text2vec-huggingface. I use additional\_headers to input huggingface API key. But when adding documents with huggingface model, I get this error "message’: ‘update vector: failed with status: 400 error: Authorization header is correct, but the token seems invalid’. But when swtiching to Weaivate cloud service, it is working with the same API key. Do you have a clue?

**This works:**

client = weaviate.Client(  
url= WCS\_url, # Replace w/ your endpoint  
auth\_client\_secret=weaviate.AuthApiKey(api\_key=WCS\_API\_key), # Replace w/ your Weaviate instance API key. Delete if authentication is disabled.  
#url = local\_instance\_url,  
additional\_headers={  
“X-HuggingFace-Api-Key”: hf\_api\_key  
},

)

**This does not work:**

client = weaviate.Client(  
#url= WCS\_url, # Replace w/ your endpoint  
#auth\_client\_secret=weaviate.AuthApiKey(api\_key=WCS\_API\_key), # Replace w/ your Weaviate instance API key. Delete if authentication is disabled.  
url = local\_instance\_url,  
additional\_headers={  
“X-HuggingFace-Api-Key”: hf\_api\_key  
},

)

---

<div class="post-metadata">

**Author:** ![zmliu213](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/zmliu213/32/3427_2.png) [@zmliu213](https://forum.weaviate.io/u/zmliu213)\
**Post date:** [July 21, 2023, 4:58pm UTC](https://forum.weaviate.io/t/text2vec-huggingface-and-text2vec-openai-api-key-is-invalid-after-installing-weaviate-through-docker/399/2 "2023-07-21T16:58:11Z")

</div>

We eventually solved this issue by adding the API key in the docker image.

---

<div class="post-metadata">

**Author:** ![Gokalp\_Ercilasun](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/gokalp_ercilasun/32/304_2.png) [@Gokalp\_Ercilasun](https://forum.weaviate.io/u/Gokalp_Ercilasun)\
**Post date:** [July 23, 2023, 8:13pm UTC](https://forum.weaviate.io/t/text2vec-huggingface-and-text2vec-openai-api-key-is-invalid-after-installing-weaviate-through-docker/399/3 "2023-07-23T20:13:55Z")

</div>

How did you add this in docker? I have an issue that the docker image will not pull the huggingface models in docker. Wondering if its related to your fix

---

<div class="post-metadata">

**Author:** ![zmliu213](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/zmliu213/32/3427_2.png) [@zmliu213](https://forum.weaviate.io/u/zmliu213)\
**Post date:** [July 24, 2023, 5:21pm UTC](https://forum.weaviate.io/t/text2vec-huggingface-and-text2vec-openai-api-key-is-invalid-after-installing-weaviate-through-docker/399/4 "2023-07-24T17:21:40Z")

</div>

![Screen Shot 2023-07-24 at 10.18.36 AM](https://canada1.discourse-cdn.com/flex027/uploads/weaviate/original/1X/2f17cfba99c811f9abee05e0f8d069d5993ee76d.png)

We add the API key here (HUGGINGFAC\_APIKEY: sk-foobar). I test it with “microsoft/BiomedNLP-PubMedBERT-base-uncased-abstract” and it is working. Hope this helps!
