feat: add LiteLLM as LLM provider#69
Open
RheagalFire wants to merge 3 commits into
Open
Conversation
Author
|
cc @AmberSahdev |
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.
Summary
Adds LiteLLM as a new LLM provider, giving Open-Interface users access to 100+ LLM providers (Anthropic, AWS Bedrock, Vertex AI, Azure, Groq, Ollama, Cohere, Mistral, Together, Fireworks, etc.) through the LiteLLM Python SDK.
Uses
litellm.completion()directly withdrop_params=True. Provider API keys are read from environment variables (e.g.ANTHROPIC_API_KEY,AZURE_AI_API_KEY).Changes
app/models/litellm_model.py-- newLiteLLMModelextendingModel, callslitellm.completion()with vision support (base64 screenshots)app/models/factory.py-- route models with provider prefixes (anthropic/,bedrock/,vertex_ai/, etc.) toLiteLLMModelrequirements.txt-- addlitellm>=1.80.0,<1.87.0No UI changes -- users select Custom in settings, type the LiteLLM model string (e.g.
anthropic/claude-sonnet-4-20250514), and the factory routes it automatically based on theprovider/prefix.Live E2E (Azure Foundry -> Claude Sonnet 4.6, through actual codebase call path)
Tested using the same
litellm.completion()call pattern fromLiteLLMModel.send_message_to_llm():Example usage
Select Custom in the settings UI, enter a LiteLLM model string in the
provider/modelformat, and set your provider API key either in the UI's API Key field or as an environment variable:anthropic/claude-sonnet-4-20250514-- Anthropic (readsANTHROPIC_API_KEYfrom env)bedrock/anthropic.claude-sonnet-4-20250514-v1:0-- AWS Bedrock (readsAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY)vertex_ai/gemini-2.5-flash-- Google Vertex (readsGOOGLE_APPLICATION_CREDENTIALS)azure_ai/claude-sonnet-4-6-- Azure AI Foundry (readsAZURE_AI_API_KEY,AZURE_AI_API_BASE)groq/llama-3.3-70b-versatile-- Groq (readsGROQ_API_KEY)Risk / Compatibility
LiteLLMModelfollows the same pattern asGPT4v(chat completions with vision)GPT4vfallback