Registry / ai-ml / llama-index-llms-litellm

llama-index-llms-litellm

JSON →
library0.7.1pypypi✓ verified 84d ago

LiteLLM integration for LlamaIndex, enabling access to 100+ LLM providers (OpenAI, Anthropic, Cohere, etc.) through a unified interface. Current version 0.7.1, fast-moving with frequent releases.

pip install llama-index-llms-litellm
INSTALL
IMPORT
SIG · LLAMA-INDEX-LLMS-L
L
llama-index-llms-litellm
ai-mlpythonv0.7.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LiteLLM
from llama_index.llms.litellm import LiteLLM
from llama_index.llms.litellm import LiteLLM as LLM
Avoid renaming if not necessary; direct use is expected.

Initialize LiteLLM with a model string and use it for completion.

import os from llama_index.llms.litellm import LiteLLM # Set API key for your provider (e.g., OpenAI) os.environ["OPENAI_API_KEY"] = "your-api-key" llm = LiteLLM(model="gpt-4o", temperature=0.7) response = llm.complete("Hello, how are you?") print(response)
Debug
Known issues
breakingBreaking change in v0.1.0: The import path changed from `llama_index.llms.litellm` to `llama_index.llms.litellm`. Old code using `from llama_index.llms.litellm import LiteLLM` still works, but ensure you don't use deprecated aliases.
fix
Update imports to use the correct path as shown in the quickstart.
affects: <0.1.0
gotchaLiteLLM inherits from `llama_index.core.llms.LLM` and requires `model` as a positional argument. It does not accept `model_name` as a kwarg.
fix
Always pass model as first argument: `LiteLLM('gpt-4o')`.
affects: all
deprecatedThe `temperature` parameter may be ignored for some providers; refer to LiteLLM documentation for provider-specific parameters.
fix
Check LiteLLM provider docs for supported kwargs and pass them using `**kwargs` if needed.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'llama_index.llms.litellm'
Package not installed or wrong import path.
fix
Run `pip install llama-index-llms-litellm`.
litellm.exceptions.BadRequestError: LLM API exception
Invalid API key or unsupported model/provider.
fix
Check the API key is set correctly and the model string matches a supported provider/model.
TypeError: __init__() got an unexpected keyword argument 'api_key'
Passing API key directly instead of via environment variable.
fix
Set the API key in the environment (e.g., `os.environ['OPENAI_API_KEY'] = '...'`) instead of passing it to the constructor.
Upgrade
Version history
0.7.1latest on PyPI · released Mar 20, 2026
Audit
Dependencies
llama-index-corerequiredCore LlamaIndex framework for LLM integrations
litellmrequiredUnderlying LiteLLM library for provider abstraction
Agent activity
6 hits · last 30 days
node
6
Resources

No resource links recorded.

llama-index-llms-litellm — pip install llama-index-llms-litellm · libregistry