feat: add LiteLLM as LLM provider#2565
Open
RheagalFire wants to merge 2 commits into
Open
Conversation
Author
|
cc @openminddev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds LiteLLM as a new LLM plugin, enabling access to 100+ providers (OpenAI, Anthropic, Google, Azure, Bedrock, Ollama, etc.) via a single unified SDK. Follows the exact same plugin pattern as
OpenAILLM,DeepSeekLLM,GeminiLLM, etc.Type of change
Changes
src/llm/plugins/litellm.py- newLiteLLMplugin class with:LiteLLMConfigextendingLLMConfiglitellm.acompletion()for async completiondrop_params=Truefor cross-provider kwargs compatibility@AvatarLLMState.trigger_thinking()and@LLMHistoryManager.update_history()decoratorspyproject.toml- addedlitellm>=1.60.0,<2.0.0as optional dependency under[project.optional-dependencies]tests/llm/test_litellm.py- 12 unit tests (all passing)Unit tests (12/12 passing):
Live E2E test (Azure Foundry, Claude):
Example usage:
See https://docs.litellm.ai/docs/providers for 100+ supported model strings.
Checklist
Impact
litellmadded as optional dependency (pip install .[litellm])drop_params=Truesilently drops provider-unsupported kwargsfind_module_with_class()since the class inherits fromLLMAdditional Information
provider/modelformat (e.g.anthropic/claude-sonnet-4-20250514,azure/gpt-4o,bedrock/anthropic.claude-3-haiku)ANTHROPIC_API_KEY,OPENAI_API_KEY, etc.)