# Weaviate python client setup with Azure OpenAI keys

**URL:** <https://forum.weaviate.io/t/weaviate-python-client-setup-with-azure-openai-keys/576>\
**Category:** Support\
**Tags:** integration\
**Created:** [August 25, 2023, 5:52am UTC](https://forum.weaviate.io/t/weaviate-python-client-setup-with-azure-openai-keys/576 "2023-08-25T05:52:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shkamboj](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@shkamboj](https://forum.weaviate.io/u/shkamboj)\
**Post date:** [August 25, 2023, 5:52am UTC](https://forum.weaviate.io/t/weaviate-python-client-setup-with-azure-openai-keys/576/1 "2023-08-25T05:52:47Z")

</div>

Hi community,

I just want to know how can I pass Azure OpenAI key variables in weaviate client for python.

```auto
client = weaviate.Client(
    url=WEAVIATE_URL,
    auth_client_secret=auth_config, # Only necessary if authentication enabled
    additional_headers={
        "X-OpenAI-Api-Key": "YOUR-OPENAI-API-KEY", # Replace with your OpenAI key
    }
)

```

Instead of using OpenAI api key, we have azure openai key. Any help would be good.

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [August 25, 2023, 12:34pm UTC](https://forum.weaviate.io/t/weaviate-python-client-setup-with-azure-openai-keys/576/2 "2023-08-25T12:34:15Z")

</div>

Hi! Welcome to our Community 🤗

Looking into Weaviate code, I found this reference:

> <https://github.com/weaviate/weaviate/blob/4509be941e6ad261c1176d3dafd0439fc97b40d9/modules/generative-openai/clients/openai.go#L259>

And at docs this one:

> **[Question Answering - OpenAI | Weaviate - vector database](https://weaviate.io/developers/weaviate/modules/reader-generator-modules/qna-openai#providing-the-key-to-weaviate)**
>
> In short

I have never used OpenAI on Azure, but `X-Azure-Api-Key` should work, AFAIK.

Let me know if that helps 🙂

---

<div class="post-metadata">

**Author:** ![jphwang](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/jphwang/32/38_2.png) [@jphwang](https://forum.weaviate.io/u/jphwang)\
**Post date:** [August 25, 2023, 3:24pm UTC](https://forum.weaviate.io/t/weaviate-python-client-setup-with-azure-openai-keys/576/3 "2023-08-25T15:24:38Z")

</div>

Hi @shkamboj

Configuring Azure OpenAI for `text2vec-openai` requires different parameters.

For example, `"X-Azure-Api-Key": "YOUR-AZURE-API-KEY"` is used to set the Azure OpenAI key. Please take a look at this page for this and other configurations, like `resourceName` or `deploymentId` for example.

> **[text2vec-openai | Weaviate - vector database](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-openai#api-key)**
>
> Overview

---

<div class="post-metadata">

**Author:** ![shkamboj](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@shkamboj](https://forum.weaviate.io/u/shkamboj)\
**Post date:** [August 28, 2023, 8:22am UTC](https://forum.weaviate.io/t/weaviate-python-client-setup-with-azure-openai-keys/576/4 "2023-08-28T08:22:15Z")

</div>

Thanks @jphwang @DudaNogueira

---

<div class="post-metadata">

**Author:** ![jphwang](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/jphwang/32/38_2.png) [@jphwang](https://forum.weaviate.io/u/jphwang)\
**Post date:** [October 17, 2023, 10:50am UTC](https://forum.weaviate.io/t/weaviate-python-client-setup-with-azure-openai-keys/576/6 "2023-10-17T10:50:49Z")

</div>

Hi @c-lara - sorry for the late response!

Do you have a code snippet that we can take a look at? Given the nature of Azure openai it may be slightly difficult for us to test internally, but we can see if there are anything we can pick up in the code.

Is there a way to confirm that the key & the Azure setup is working, outside of Weaviate? For example, through a REST call or something like that?

---

<div class="post-metadata">

**Author:** ![digitechroshni](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/digitechroshni/32/1532_2.png) [@digitechroshni](https://forum.weaviate.io/u/digitechroshni)\
**Post date:** [May 20, 2024, 6:35am UTC](https://forum.weaviate.io/t/weaviate-python-client-setup-with-azure-openai-keys/576/7 "2024-05-20T06:35:40Z")

</div>

Thank you @jphwang for giving this information, this would be helpful for me! Thank you again!
