feat: Add LiteLLM AI Gateway support#40
Open
devhimanshuu wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds LiteLLM as an additional AI gateway option so Passmark can route model requests through a LiteLLM OpenAI-compatible proxy (supporting enterprise deployments like Azure OpenAI / Bedrock behind internal infrastructure).
Changes:
- Extends
AIGatewayto include"litellm"and wires LiteLLM routing intoresolveModel(). - Introduces a LiteLLM provider factory (
createOpenAIwithbaseURL) plus a small model-id remapping helper for LiteLLM. - Adds unit tests covering gateway configuration and basic LiteLLM env validation behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/models.ts | Adds LiteLLM provider creation, model-id remapping, and gateway routing branch. |
| src/config.ts | Extends AIGateway union type with "litellm". |
| src/tests/models.test.ts | New tests for LiteLLM gateway env validation and resolution behavior. |
| src/tests/config.test.ts | Adds a config test ensuring ai.gateway can be set to "litellm". |
Comments suppressed due to low confidence (1)
src/models.ts:178
- The
resolveModel()docstring lists supported gateways but doesn't mention the newly added "litellm" routing path, so it's now out of sync with behavior.
/**
* Resolves a canonical model ID to a LanguageModel instance wrapped with Axiom instrumentation.
* Input format: "provider/model-name" (e.g. "google/gemini-3-flash")
*
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+9
to
+13
| beforeEach(() => { | ||
| vi.resetModules(); | ||
| process.env = { ...originalEnv }; | ||
| resetConfig(); | ||
| }); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.