Feat/add litellm provider#338
Open
RheagalFire wants to merge 2 commits into
Open
Conversation
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
LiteLLMServiceextendingBaseService, following the Claude provider pattern.Motivation
UFO currently supports 6 individual LLM providers (OpenAI, Claude, Gemini, DeepSeek, Qwen, Ollama), each requiring separate configuration. Users who want providers not directly supported (Bedrock, Mistral, Cohere, Together AI, etc.) have no straightforward path.
LiteLLM routes to 100+ providers through provider-prefixed model names. Users switch providers by changing one config line - no additional SDKs needed.
Changes
ufo/llm/litellm.py- newLiteLLMServiceimplementingBaseServiceufo/llm/base.py- added"litellm": "LiteLLMService"toservice_mapand cost estimatorrequirements.txt- addedlitellm>=1.80,<1.87Implementation details
BaseService(notBaseOpenAIService) since LiteLLM handles all provider routing internally.litellm.completion()withdrop_params=Trueto silently drop provider-unsupported kwargs for cross-provider compatibility.import litellminside method bodies so the import only fails when litellm is actually used, not at module load.(responses, cost)tuple matching theBaseService.chat_completioncontract.Tests
1. Live E2E against Anthropic (via Azure Foundry):
Full chain verified:
LiteLLMService.chat_completion()->litellm.completion()-> Anthropic API -> response parsed with cost tracking.Risk / Compatibility
requirements.txtentry. Compatible with existingopenai==1.66.2pin.Example usage
Python: