# BadRequestError: litellm.BadRequestError: LLM Provider NOT provided

**URL:** <https://community.crewai.com/t/badrequesterror-litellm-badrequesterror-llm-provider-not-provided/918>\
**Category:** LLMs\
**Tags:** llama-31-8b\
**Created:** [October 21, 2024, 11:44am UTC](https://community.crewai.com/t/badrequesterror-litellm-badrequesterror-llm-provider-not-provided/918 "2024-10-21T11:44:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yash](https://avatars.discourse-cdn.com/v4/letter/y/f17d59/32.png) [@Yash](https://community.crewai.com/u/Yash)\
**Post date:** [October 21, 2024, 11:44am UTC](https://community.crewai.com/t/badrequesterror-litellm-badrequesterror-llm-provider-not-provided/918/1 "2024-10-21T11:44:35Z")

</div>

I am getting the below error when trying to use litellm

code snippet :

from crewai import LLM  
llm = LLM(  
model="my-model,  
openai\_api\_base=“[http://localhost:4000](http://localhost:4000)”,  
api\_key=“api-key”  
)

get\_research = CustomResearcherTool()

researcher = Agent(  
role=‘{topic} Senior Data Researcher’,  
goal= ‘Uncover cutting-edge developments in {topic}’,  
backstory=(  
“”“You’re a seasoned researcher with a knack for uncovering the latest  
developments in {topic}. Known for your ability to find the most relevant  
information and present it in a clear and concise manner.”“”  
),  
tools=[get\_research],  
llm=llm  
)

Error :  
BadRequestError: litellm.BadRequestError: LLM Provider NOT provided. Pass in the LLM provider you are trying to call. You passed model=my-model  
Pass model as E.g. For ‘Huggingface’ inference endpoints pass in `completion(model='huggingface/starcoder',..)` Learn more: [Providers | liteLLM](https://docs.litellm.ai/docs/providers)

---

<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:** [October 21, 2024, 11:58am UTC](https://community.crewai.com/t/badrequesterror-litellm-badrequesterror-llm-provider-not-provided/918/2 "2024-10-21T11:58:14Z")

</div>

@Yash The error occurs because of how you set your LLM. Using the CrewAI `LLM` class, which uses [LiteLLM](https://docs.litellm.ai/) in the background, you also need to provide the LLM provider.

For example, if you use the Anthropic Claude 3.5 Sonnet LLM, you need to put `anthropic/` before setting the LLM.

```auto
from crewai import Agent, LLM

my_llm = LLM(
    api_key=os.getenv("ANTHROPIC_API_KEY"),
    model="anthropic/claude-3-5-sonnet-20240620",
)

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

```

---

<div class="post-metadata">

**Author:** ![Yash](https://avatars.discourse-cdn.com/v4/letter/y/f17d59/32.png) [@Yash](https://community.crewai.com/u/Yash)\
**Post date:** [October 21, 2024, 12:01pm UTC](https://community.crewai.com/t/badrequesterror-litellm-badrequesterror-llm-provider-not-provided/918/3 "2024-10-21T12:01:48Z")

</div>

@rokbenko like if i am using sagemaker then i guess i might give the sagemaker endpoint for my model.

and when i am doing that, i am getting

AttributeError: ‘Response’ object has no attribute ‘get’

---

<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:** [October 21, 2024, 12:17pm UTC](https://community.crewai.com/t/badrequesterror-litellm-badrequesterror-llm-provider-not-provided/918/4 "2024-10-21T12:17:14Z")

</div>

@Yash Take a look at the official LiteLLM [docs on the LLM providers](https://docs.litellm.ai/docs/providers). The part of the docs you’re interested in is the [AWS Sagemaker](https://docs.litellm.ai/docs/providers/aws_sagemaker).

---

<div class="post-metadata">

**Author:** ![Yash](https://avatars.discourse-cdn.com/v4/letter/y/f17d59/32.png) [@Yash](https://community.crewai.com/u/Yash)\
**Post date:** [October 21, 2024, 12:37pm UTC](https://community.crewai.com/t/badrequesterror-litellm-badrequesterror-llm-provider-not-provided/918/5 "2024-10-21T12:37:33Z")

</div>

@rokbenko just need to ask can’t we use litellm proxy server with crewai

---

<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 20, 2024, 11:45am UTC](https://community.crewai.com/t/badrequesterror-litellm-badrequesterror-llm-provider-not-provided/918/6 "2024-11-20T11:45:30Z")

</div>

Closed on November 20, 2024, 11:45am UTC

This topic was automatically closed after 30 days. New replies are no longer allowed.
