Overview
CrewAI supports two paths for connecting to LLM providers:- Native integrations — direct SDK connections to OpenAI, Anthropic, Google Gemini, Azure OpenAI, and AWS Bedrock
- LiteLLM fallback — a translation layer that supports 100+ additional providers
Why Remove LiteLLM?
- Reduced dependency surface — fewer packages means fewer potential supply-chain risks
- Better performance — native SDKs communicate directly with provider APIs, eliminating a translation layer
- Simpler debugging — one less abstraction layer between your code and the provider
- Smaller install footprint — LiteLLM brings in many transitive dependencies
Native Providers (No LiteLLM Required)
These providers use their own SDKs and work without LiteLLM installed:OpenAI
GPT-4o, GPT-4o-mini, o1, o3-mini, and more.
Anthropic
Claude Sonnet, Claude Haiku, and more.
Google Gemini
Gemini 2.0 Flash, Gemini 2.0 Pro, and more.
Azure OpenAI
Azure-hosted OpenAI models.
AWS Bedrock
Claude, Llama, Titan, and more via AWS.
If you only use native providers, you never need to install
crewai[litellm]. The base crewai package plus your chosen provider extra is all you need.How to Check If You’re Using LiteLLM
Check your model strings
If your code uses model prefixes like these, you’re routing through LiteLLM:Check if LiteLLM is installed
Check your dependencies
Look at yourpyproject.toml for crewai[litellm]:
Migration Guide
Step 1: Identify your current provider
Find allLLM() calls and model strings in your code:
Step 2: Switch to a native provider
- Switch to OpenAI
- Switch to Anthropic
- Switch to Gemini
- Switch to Azure OpenAI
- Switch to AWS Bedrock
Step 3: Keep Ollama without LiteLLM
If you’re using Ollama and want to keep using it, you can connect via Ollama’s OpenAI-compatible API:Step 4: Update your YAML configs
Step 5: Remove LiteLLM
Once you’ve migrated all your model references:Step 6: Verify
Run your project and confirm everything works:Custom OpenAI-Compatible Endpoints
Many providers and local servers (Ollama, vLLM, LM Studio, llama.cpp, LiteLLM proxies, and hosted gateways) expose an OpenAI-compatible API. Instead of routing these through LiteLLM, you can talk to them directly with CrewAI’s native OpenAI integration by settingcustom_openai=True.
This is the recommended replacement for any LiteLLM provider that offers an OpenAI-compatible endpoint.
How it works
-
custom_openai=Trueforces CrewAI to use the native OpenAI SDK, regardless of the model name. -
The model ID is passed to the endpoint without validation against OpenAI’s known-model list. This lets you use arbitrary model IDs your gateway expects (for example,
anthropic/claude-sonnet-4-6served behind an OpenAI-compatible proxy). An optional leadingopenai/routing prefix is stripped. -
A base URL is required. CrewAI resolves it, in order, from:
base_url=...api_base=...OPENAI_BASE_URLenvironment variableOPENAI_API_BASEenvironment variable (legacy)
ValueErrorso misconfiguration fails fast instead of silently hittingapi.openai.com.
Connect to common servers
- Ollama
- vLLM
- LM Studio
- Env vars
Quick Reference: Model String Mapping
Here are common migration paths from LiteLLM-dependent providers to native ones:FAQ
Do I lose any functionality by removing LiteLLM?
Do I lose any functionality by removing LiteLLM?
No, if you use one of the five natively supported providers (OpenAI, Anthropic, Gemini, Azure, Bedrock). These native integrations support all CrewAI features including streaming, tool calling, structured output, and more. You only lose access to providers that are exclusively available through LiteLLM (like Groq, Together AI, Mistral as first-class providers).
Can I use multiple native providers at the same time?
Can I use multiple native providers at the same time?
Yes. Install multiple extras and use different providers for different agents:
Is LiteLLM safe to use now?
Is LiteLLM safe to use now?
Regardless of quarantine status, reducing your dependency surface is good security practice. If you only need providers that CrewAI supports natively, there’s no reason to keep LiteLLM installed.
What about environment variables like OPENAI_API_KEY?
What about environment variables like OPENAI_API_KEY?
Native providers use the same environment variables you’re already familiar with. No changes needed for
OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, etc.How do I connect to Groq, Together AI, or other OpenAI-compatible providers without LiteLLM?
How do I connect to Groq, Together AI, or other OpenAI-compatible providers without LiteLLM?
Most of these providers expose an OpenAI-compatible API. Use
custom_openai=True with their base URL and API key — see Custom OpenAI-Compatible Endpoints. For example, Groq: LLM(model="llama-3.1-70b-versatile", custom_openai=True, base_url="https://api.groq.com/openai/v1", api_key="..."). The model ID is passed through untouched, so use whatever ID the provider expects.Related Resources
- LLM Connections — Full guide to connecting CrewAI with any LLM
- LLM Concepts — Understanding LLMs in CrewAI
- LLM Selection Guide — Choosing the right model for your use case
