feat: add LiteLLM as AI gateway provider#379
Open
RheagalFire wants to merge 2 commits into
Open
Conversation
|
@RheagalFire is attempting to deploy a commit to the Raphael's projects Team on Vercel. A member of the Team first needs to authorize it. |
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 model provider, giving users access to 100+ LLM providers through a single
LiteLLMProviderclass. Follows the existingBaseModelProviderpattern exactly.Motivation
OpenAgents currently supports several providers (OpenAI, Anthropic, Bedrock, Gemini, MiniMax) with dedicated classes, plus a
SimpleGenericProviderfor OpenAI-compatible APIs. LiteLLM is a lightweight Python SDK that routes requests to the correct provider based on the model string (e.g.anthropic/claude-sonnet-4-5,vertex_ai/gemini-pro,cohere/command-r-plus). This gives users access to providers like Vertex AI, Cohere, AI21, and self-hosted endpoints without needing new provider classes for each one.Changes
sdk/src/openagents/lms/providers.py- newLiteLLMProviderclass extendingBaseModelProvidersdk/src/openagents/lms/__init__.py- registered in imports and__all__sdk/src/openagents/config/llm_configs.py- addedLITELLMenum value,MODEL_CONFIGSentry, andcreate_model_providerfactory casepyproject.toml- addedlitellm>=1.55.0,<1.85tosdkoptional dependenciesImplementation
LiteLLMProviderfollows the same pattern asOpenAIProvider:chat_completion()callslitellm.acompletion()and returns the standardized{"content": ..., "tool_calls": [...], "usage": {...}}formatformat_tools()uses OpenAI-compatible format (same asOpenAIProvider)toolsandtool_choiceparametersExample usage
Provider-specific API keys are read from environment variables automatically (e.g.
ANTHROPIC_API_KEY,OPENAI_API_KEY). See https://docs.litellm.ai/docs/providers for the full list.Tests
Risk / Compatibility
litellm>=1.55.0,<1.85added to thesdkoptional dependencies inpyproject.toml.