# Azure with Mistral

**URL:** https://community.crewai.com/t/azure-with-mistral/4679
**Category:** CrewAI Community Support
**Created:** [March 14, 2025, 3:28pm UTC](https://community.crewai.com/t/azure-with-mistral/4679 "2025-03-14T15:28:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kenpachi](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@kenpachi](https://community.crewai.com/u/kenpachi)
#### Post date: [March 14, 2025, 3:28pm UTC](https://community.crewai.com/t/azure-with-mistral/4679/1 "2025-03-14T15:28:50Z")

</div>

Hello,

do someone has ever setup Mistral deployed on Azure for embedding ?

Because when i’m using the provider azure\_openai, it request the OPENAI\_API-KEY, even though I use mistral.

And if i use mistralai it request MISTRAL\_API\_KEY which is not the one provided by Azure.

litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - Error code: 401 - {‘error’: {‘message’: ‘Incorrect API key provided: \*\*\*\*\*\*\*\*\*\*\*. You can find your API key at [https://platform.openai.com/account/api-keys.](https://platform.openai.com/account/api-keys.)’, ‘type’: ‘invalid\_request\_error’, ‘param’: None, ‘code’: ‘invalid\_api\_key’}}

this is my config :

pdf\_search\_tool = PDFSearchTool(  
pdf=pdf\_file\_path,  
config=dict(  
llm=dict(  
provider=“azure\_openai”,  
config=dict(  
model=model\_llm,  
),  
),  
embedder=dict(  
provider=“azure\_openai”,  
config=dict(  
model=model\_embedding,  
api\_base=os.getenv(“AZURE\_OPENAI\_ENDPOINT”),  
),  
),  
),  
)

---

<div class="post-metadata">

### Author: ![maxmoura](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/maxmoura/32/4206_2.png) [@maxmoura](https://community.crewai.com/u/maxmoura)
#### Post date: [March 16, 2025, 3:13pm UTC](https://community.crewai.com/t/azure-with-mistral/4679/3 "2025-03-16T15:13:09Z")

</div>

First things first, it’s important to remember that CrewAI uses the [EmbedChain library](https://docs.embedchain.ai/) under the hood for its tools. So the configuration pattern for your tool should follow the EmbedChain standard.

I recommend taking a look at the EmbedChain documentation, especially [where it discusses the Azure OpenAI embedding model](https://docs.embedchain.ai/components/embedding-models#azure-openai). Adapting the example from the documentation, your code would look something like this:

```python
from crewai_tools import PDFSearchTool
import os

os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["OPENAI_API_VERSION"] = "<XXX>"
os.environ["AZURE_OPENAI_ENDPOINT"] = "https://<XXX>.openai.azure.com/"
os.environ["AZURE_OPENAI_API_KEY"] = "<XXX>"

pdf_source_file_path = "<YOUR_PDF_PATH>"

rag_llm = {
    "provider": "azure_openai",
    "config": {
        "model": "<YOUR_LLM_MODEL_NAME>",
        "deployment_name": "<YOUR_LLM_DEPLOYMENT_NAME>",
        "temperature": 0.2
    }
}
rag_embedder = {
    "provider": "azure_openai",
    "config": {
        "model": "<YOUR_EMBEDDING_MODEL_NAME>",
        "deployment_name": "<YOU_EMBEDDING_MODEL_DEPLOYMENT_NAME>",
    }
}

pdf_search_tool = PDFSearchTool(
    pdf=pdf_source_file_path,
    config={
        "llm": rag_llm,
        "embedder": rag_embedder
    }
)

```

---

<div class="post-metadata">

### Author: ![kenpachi](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@kenpachi](https://community.crewai.com/u/kenpachi)
#### Post date: [March 17, 2025, 8:29am UTC](https://community.crewai.com/t/azure-with-mistral/4679/4 "2025-03-17T08:29:05Z")

</div>

Hello,

I tried with your recommendations but i still have an error with the API key.

when I use azure\_openai it use by default OPEN API key so I have the error : “Incorrect API key provided”. because it’s an Azure key
