# Error while kicking off the Crew with custom LLM - AzureOpenAI

**URL:** <https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339>\
**Category:** CrewAI Community Support\
**Tags:** tools\_issues, agent, crewai\
**Created:** [November 11, 2024, 1:09pm UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339 "2024-11-11T13:09:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhavalkaku](https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/32.png) [@dhavalkaku](https://community.crewai.com/u/dhavalkaku)\
**Post date:** [November 11, 2024, 1:09pm UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/1 "2024-11-11T13:09:45Z")

</div>

Hello Team,

I’m performing one operation using PDF Rag search, and in that I have added configuration of AzureOpenAI to read the PDF file for the user query.  
Then I have created agent and tasks to perform the operations, but when I’m kicking off the crew, it is giving me the error as below:

llm.py-llm:161 - ERROR: LiteLLM call failed: litellm.NotFoundError: NotFoundError: OpenAIException - Error code: 404 - {‘error’: {‘code’: ‘404’, ‘message’: ‘Resource not found’}}

I double checked all the credentials which I’m trying but still no luck.

I’m attaching my code snapshot here for the reference.

 ![Code_1](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/1X/802f465722f3e3225f5ce3e3671462c603cae9c2.png)

---

<div class="post-metadata">

**Author:** ![olaservo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/olaservo/32/971_2.png) [@olaservo](https://community.crewai.com/u/olaservo)\
**Post date:** [November 11, 2024, 5:04pm UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/2 "2024-11-11T17:04:16Z")

</div>

What does your Azure url look like?

---

<div class="post-metadata">

**Author:** ![dhavalkaku](https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/32.png) [@dhavalkaku](https://community.crewai.com/u/dhavalkaku)\
**Post date:** [November 12, 2024, 4:42am UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/3 "2024-11-12T04:42:03Z")

</div>

It is like this : “https://{my-resource-name}.openai.azure.com/”

---

<div class="post-metadata">

**Author:** ![dhavalkaku](https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/32.png) [@dhavalkaku](https://community.crewai.com/u/dhavalkaku)\
**Post date:** [November 13, 2024, 6:29am UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/4 "2024-11-13T06:29:06Z")

</div>

Is there any update for the same ?

---

<div class="post-metadata">

**Author:** ![bigilad](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/bigilad/32/935_2.png) [@bigilad](https://community.crewai.com/u/bigilad)\
**Post date:** [November 13, 2024, 7:19am UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/5 "2024-11-13T07:19:29Z")

</div>

this is happenning to me as well. there is an issue when using crewai with azure openai endpoint due to crewai using litellm  
CrewAI is using LiteLLM internally to make API calls  
When we pass our model name gpt-4o\_2024-08-06, LiteLLM doesn’t know which provider (Azure) to use…

---

<div class="post-metadata">

**Author:** ![olaservo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/olaservo/32/971_2.png) [@olaservo](https://community.crewai.com/u/olaservo)\
**Post date:** [November 13, 2024, 1:02pm UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/6 "2024-11-13T13:02:00Z")

</div>

Are you setting the model using this format?

model = “azure/\<your\_deployment\_name\>”

---

<div class="post-metadata">

**Author:** ![rokbenko](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/rokbenko/32/492_2.png) [@rokbenko](https://community.crewai.com/u/rokbenko)\
**Post date:** [November 13, 2024, 1:07pm UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/7 "2024-11-13T13:07:12Z")

</div>

@bigilad As @olaservo mentioned above, make sure to set the LLM provider before configuring the LLM. For Azure OpenAI, use `azure/<your deployment name>`. See the official LiteLLM [docs on Azure OpenAI](https://docs.litellm.ai/docs/providers/azure).

If you’re unsure how to do this for a specific LLM provider, refer to the [LiteLLM Providers page](https://docs.litellm.ai/docs/providers) for guidance.

```auto
from crewai import Agent, LLM

my_llm = LLM(
    api_key=os.getenv("AZURE_API_KEY"),
    model="azure/<your_deployment_name>",
),

my_agent = Agent(
    ...,
    llm=my_llm,
)

```

---

<div class="post-metadata">

**Author:** ![bigilad](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/bigilad/32/935_2.png) [@bigilad](https://community.crewai.com/u/bigilad)\
**Post date:** [November 13, 2024, 3:33pm UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/8 "2024-11-13T15:33:26Z")

</div>

in [here](https://docs.crewai.com/concepts/llms#azure) it says:

AZURE\_API\_KEY= # “my-azure-api-key”  
AZURE\_API\_BASE= # “[https://example-endpoint.openai.azure.com](https://example-endpoint.openai.azure.com)”  
AZURE\_API\_VERSION= # “2023-05-15”  
AZURE\_AD\_TOKEN= # Optional  
AZURE\_API\_TYPE= # Optional

and finally what actually worked is:

```
llm = AzureChatOpenAI(
        #azure_deployment="gpt-4",#gpt-4o_2024-08-06
        azure_deployment="gpt-4o",
        openai_api_version="2024-02-15-preview",
        azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
        api_key=os.getenv("AZURE_OPENAI_API_KEY"),
        temperature=0.7
    )

```

which is different when NOT using crewai:

> llm = AzureChatOpenAI(  
> openai\_api\_key=os.getenv(“AZURE\_OPENAI\_API\_KEY”),  
> azure\_endpoint=os.getenv(“AZURE\_OPENAI\_ENDPOINT”),  
> AZURE\_OPENAI\_DEPLOYMENT\_NAME=“gpt-4o\_2024-08-06”,  
> openai\_api\_version=“2024-02-15-preview”,  
> temperature=0.7  
> )

azure is letting me define DEPLOYMENT\_NAME and if , as i did define it, without crewai it will work with its full name, but when using crewai with litellm than

---

<div class="post-metadata">

**Author:** ![dhavalkaku](https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/32.png) [@dhavalkaku](https://community.crewai.com/u/dhavalkaku)\
**Post date:** [November 14, 2024, 6:22am UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/9 "2024-11-14T06:22:09Z")

</div>

Yes, after initializing model with this format it worked.  
Thank you !

---

<div class="post-metadata">

**Author:** ![dhavalkaku](https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/32.png) [@dhavalkaku](https://community.crewai.com/u/dhavalkaku)\
**Post date:** [November 14, 2024, 6:22am UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/10 "2024-11-14T06:22:39Z")

</div>

Yes, after initializing model with this format for LLM it worked.  
Thank you !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/1X/ecda97e72f77c7100e0a761444b1c991925cc789.png) [@system](https://community.crewai.com/u/system)\
**Post date:** [November 15, 2024, 6:23am UTC](https://community.crewai.com/t/error-while-kicking-off-the-crew-with-custom-llm-azureopenai/1339/11 "2024-11-15T06:23:15Z")

</div>

Closed on November 15, 2024, 6:23am UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
