feat: add LiteLLM as a first-class AI translation provider - #448
Open
prodmanpd wants to merge 2 commits into
Open
feat: add LiteLLM as a first-class AI translation provider#448prodmanpd wants to merge 2 commits into
prodmanpd wants to merge 2 commits into
Conversation
buxuku
requested changes
Aug 20, 2026
buxuku
left a comment
Owner
There was a problem hiding this comment.
P1: LiteLLM model selector is empty — normal setup cannot configure a model
In types/provider.ts:813-850, the PR defines modelName as:
type: 'select',
options: []But it does not update the existing model-discovery logic:
- ProviderForm.tsx:100:
OPENAI_COMPAT_PROVIDERSdoes not includelitellm. - ProviderForm.tsx:164: unknown providers return early and never request
/models. - ProviderForm.tsx:456: the UI ends up using the empty
field.options. SearchableSelectonly allows choosing from existing options — it does not support typing a model name manually (ProviderForm.tsx:263).modelNameis required, so providerUtils.ts:13 treats the provider as unconfigured.
Repro: After a fresh install or migration, select LiteLLM, fill in Base URL and API Key — the model dropdown stays empty and configuration cannot be completed. The PR description (“model discovery works out of the box”) does not match the code.
Suggestions:
- Minimal fix: add
litellmtoOPENAI_COMPAT_PROVIDERS. - Better fix: support auto-discovery + manual input for the model field. LiteLLM’s model list depends entirely on the user’s proxy configuration, so a fixed fallback list is not reliable.
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
litellm), giving SmartSub a single OpenAI-compatible endpoint that routes to 100+ providers (OpenAI, Anthropic, Gemini, Bedrock, Vertex, Azure, Groq, ...) through a LiteLLM proxy.PROVIDER_TYPES, wired intoTRANSLATOR_MAP, reuses the OpenAI-compatible translator).Motivation
Adding each new backend today means a new
PROVIDER_TYPESentry plus per-providerthinkingControlbranches. Routing through LiteLLM collapses that: one provider reaches every model the proxy exposes, and the proxy handles cross-provider param compatibility centrally.Changes
types/provider.ts— registerlitellminPROVIDER_TYPES(built-in AI provider; default Base URLhttp://localhost:4000/v1, API key, model select). Model discovery via/v1/modelsworks out of the box, same as the other OpenAI-compatible providers.main/translate/services/translationProvider.ts—litellm->openaiTranslatorinTRANSLATOR_MAP.main/helpers/providerManager.ts— bump provider version to 24 so existing users receive the new built-in on migration.renderer/public/locales/{en,zh}/translateControl.json— tips/placeholder keys (English text;zhvalues left in English for a maintainer to localize, so thecheck:i18nkey-parity gate stays green).scripts/test-litellm-provider.ts+test:litellm-providerscript + CI step.Tests
1. Unit tests —
yarn test:litellm-providerCovers registration in
PROVIDER_TYPES, and thatresolveThinkingParamsnever injectsreasoning_effortfor alitellmprovider even forgpt-5/o3/geminimodel names, plus regressions proving non-litellm providers keep their existing mapping.2. i18n gate —
yarn check:i18n->zh/en key parity OK, no fallback patterns.3. Format —
prettier --checkclean on all changed files.4. Live E2E — the OpenAI JS SDK (the exact SDK
openaiTranslatoruses) pointed at a LiteLLM proxy, translating a subtitle JSON payload, with noreasoning_effortsent (mirroring the fix):This proves the full chain:
openaiTranslatortransport (OpenAI JS SDK) -> LiteLLM proxy -> provider -> parsed translation JSON.Risk / Compatibility
thinkingControlbranches are untouched.openaiTranslator, so there is no new transport code and no new npm dependency.Example usage
Run a LiteLLM proxy (
litellm --config ...), then in SmartSub pick the LiteLLM provider, set Base URL to your proxy (defaulthttp://localhost:4000/v1), the proxy key, and any model the proxy routes (e.g.gpt-4o-mini,anthropic/claude-3-5-sonnet,gemini/gemini-2.5-flash,bedrock/..., or a self-hosted model).