Feat/add litellm provider#168
Open
RheagalFire wants to merge 4 commits into
Open
Conversation
Collaborator
|
Thank you for your support of this project. The project currently supports OpenAI-compatible API formats, which are already a common format and support local models such as Ollama. Personally, I don't think it's necessary to add a general-purpose SDK, as this would make it difficult for users to choose the appropriate API type. |
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
createOpenAIClient()hardcoded"OpenAI"for base URL resolution instead of using the actual provider type.Test Plan
pnpm format:checkpnpm lintpnpm typecheckpnpm test(850 passed, 171 suites)pnpm buildNotes
docs/localization-pr-guide.mdand documented intentional English fallbacks.\Changes
Provider registration (7 files):
src/lib/providers/types.ts- Added"LiteLLM"toProviderTypeunionsrc/lib/providers/providerTypes.ts- AddedLITELLM_PROVIDER_TYPEconstant, updatedisProviderType()andisOpenAIProviderType()src/lib/api/schemas.ts- Added"LiteLLM"to the Zod runtime validation enumsrc/lib/security/urlPolicy.ts- Added default LiteLLM base URL (http://localhost:4000/v1)src/utils/apiHelpers.ts- Added"LiteLLM"to theProviderConfigtype unionsrc/components/settings/ProviderSettings.tsx- Added LiteLLM to provider type dropdownTests (4 files, +100 lines):
src/__tests__/providerRuntimeSchema.test.ts- LiteLLM schema validationsrc/__tests__/urlPolicy.test.ts- 5 tests: default URL, custom URL with/without/v1, models pathsrc/__tests__/providerConfig.test.ts- 1 test: normalizeModelProvider preserves LiteLLM typesrc/__tests__/providerOutbound.test.ts- 3 tests: client creation, localhost blocked in hosted mode, public URL allowedExample usage
Risk / Compatibility
localhost:4000is correctly blocked in hosted mode (tested).provider.typefix is a correctness improvement for any future provider type.