feat: Add LiteLLM AI Gateway support#40
Open
devhimanshuu wants to merge 1 commit intobug0inc:mainfrom
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.
Support for LiteLLM Gateway & Enterprise Models
Description
This PR introduces support for LiteLLM, a popular open-source AI proxy. By adding LiteLLM as an officially supported AI gateway, Passmark now seamlessly integrates with enterprise providers like Azure OpenAI and AWS Bedrock.
Enterprise users who mandate strict compliance requirements and cannot use public APIs can now configure Passmark to route requests securely through their internal infrastructure via LiteLLM.
Changes Made
src/config.ts:'litellm'to theAIGatewayunion type.LITELLM_BASE_URLandLITELLM_API_KEY).src/models.ts:@ai-sdk/openaiprovider to interact with LiteLLM's OpenAI-compatible endpoints.getLiteLLMProvider()to securely instantiate the model client based on environment variables.resolveLiteLLMModelId()to seamlessly map Passmark's default canonical model prefixes (e.g.,google/togemini/) to match LiteLLM's expected formats.resolveModel().src/__tests__/):config.test.tsto verify the new gateway configuration parsing.models.test.tsto fully cover the environment validation, provider creation, and prefix-mapping logic for LiteLLM.How to Test
LITELLM_BASE_URLto your local or hosted LiteLLM instance (e.g.,export LITELLM_BASE_URL=http://localhost:4000/v1).LITELLM_API_KEYif your proxy requires authentication.