Repository navigation
feat(desktop): add LiteLLM Gateway provider preset - #463
Conversation
Add a LiteLLM Gateway entry to PROXY_PRESETS and the Settings add-provider menu. It pre-fills the OpenAI-compatible default http://localhost:4000/v1, starts in keyless mode via the existing requiresApiKey flag, and shows setup copy in all locales. LiteLLM is not bundled. Closes OpenCoworkAI#208
There was a problem hiding this comment.
Findings
-
[Minor]
Closes #208may overstate the scope this PR delivers — the PR body itself says "Connection diagnostics for LiteLLM 401/404 and the Chrome-timeout CI change are left for later PRs", and the repo template (.github/PULL_REQUEST_TEMPLATE.md) says to useCloses #123only when the PR fully resolves the issue andRefs #123for partial slices. If #208's acceptance criteria cover connection diagnostics or other deferred work, this PR does not fully resolve it. Note: I could not load the body of #208 in this run, so this is based on the PR's own description plus the template rule, not a line-by-line diff against the issue.
Suggested fix: if #208 includes the deferred diagnostics/CI work, change the link toRefs #208and keep (or open) a follow-up issue for the 401/404 diagnostics and CLI change. -
[Nit] The "base URL lives in one place" / single-source claim in the PR body is only partially true —
baseUrlis read from the shared preset (apps/desktop/src/renderer/src/components/settings/ModelsTab.tsx:1053), buthttp://localhost:4000/v1is also baked into the localizedhintstrings in all four locales (packages/i18n/src/locales/en.json:695,es.json:519,pt-BR.json:496,zh-CN.json:695) and the providername: 'LiteLLM Gateway'is hardcoded there too while also existing asPROXY_PRESETS[].label(packages/shared/src/proxy-presets.ts:63) andpresetName. Not blocking; if you want it truly single-source, derivenamefromgetPresetById('litellm')?.labeland/or drop the explicit URL from the hint text.
Suggested fix: low priority — either accept the duplication (it matches the existing CLIProxyAPI pattern) or centralize the name and URL.
Questions
- The LiteLLM preset opens with keyless mode on (
requiresApiKey: false,ModelsTab.tsx:1055), which is the trigger for endpoint auto-discovery (buildEndpointDiscoveryPayloadreturns a payload only whenrequiresApiKey === false,AddCustomProviderModal.tsx:110). If the modal auto-runs discovery on open, it would run against the localhost default with the private-network opt-in still unchecked, producing a failed discovery before the user ticks the box. Does the existing CLIProxyAPI preset also open keyless (i.e., is this already-shipped behavior), or is LiteLLM the first keyless-by-default localhost preset? If it's new, consider pre-checking the private-network toggle for localhost defaults, or deferring auto-discovery until the opt-in is set. (I couldn't verify the modal's on-mount discovery effect from the diff alone.)
Summary
Review mode: initial
Directionally sound and small: no new dependencies, no IPC/schema changes, no LiteLLM bundling, and a changeset is present for all three affected packages (@open-codesign/shared, @open-codesign/i18n, @open-codesign/desktop). The requiresApiKey init change (editTarget ?? initialValues)?.requiresApiKey !== false correctly preserves edit-mode precedence and only affects create-mode presets, matching the stated Compatibility/Upgradeability claims. The new tests (proxy-presets.test.ts, the added AddCustomProviderModal case) adequately cover the preset shape and prefill/hint rendering.
The only substantive item is the linked-issue claim (#208) — please confirm the deferred connection diagnostics are outside #208's acceptance criteria before keeping Closes #208. Residual risks: no test exercises the new onAddLiteLLM menu handler in ModelsTab, and the keyless + private-network interaction for a localhost default is unverified.
Testing
Not run (automation). Suggested additions: a ModelsTab test asserting the LiteLLM menu item calls the handler with the preset base URL and requiresApiKey: false, and (if applicable) a modal test confirming discovery behavior for a keyless localhost preset when private-network testing is off.
Open-CoDesign Bot
|
Thanks for the review. I checked #208, the CLIProxyAPI preset, and when the modal starts discovery. No code change.
Single source for the name and URL. The base URL the modal saves comes from Keyless localhost discovery. CLIProxyAPI does not open keyless. It omits Menu handler test. There is no ModelsTab render harness. The handler only stores the preset fields the modal test already covers: keyless, the preset base URL, and the hint. I am not adding a second harness for that wiring. |
Summary
Adds a slim LiteLLM Gateway preset so users with an existing LiteLLM proxy can connect without hand-rolling a custom provider. It reuses what main already has: the
PROXY_PRESETSlist (same shape as the Requesty preset in #397), the Add provider menu 鈫?AddCustomProviderModalprefill path (same as CLIProxyAPI), and the keylessrequiresApiKeyflag from 71dbd2f. No new IPC, schema, or dependencies, and LiteLLM is not bundled.packages/shared: newlitellmentry inPROXY_PRESETS(provider: 'openai',baseUrl: 'http://localhost:4000/v1').apps/desktop: an Add provider 鈫?LiteLLM Gateway menu item opens the custom-provider modal with the name, the base URL (read from the shared preset), and theopenai-chatwire filled in. It starts in keyless mode (requiresApiKey: false), which matches a LiteLLM proxy with nomaster_keyset. Users can untick it and paste a master or virtual key.initialValuesgains two optional fields,requiresApiKeyandhint. Edit mode is unchanged becauseeditTargetstill wins.packages/i18n:settings.providers.litellm.{presetName,presetDescription,hint}in en / zh-CN / es / pt-BR.This replaces the closed #419, which was too big for one PR. Connection diagnostics for LiteLLM 401/404 and the Chrome-timeout CI change are left for later PRs.
Type of change
Linked issue
Refs #208
Replaces #419 (closed).
Checklist
pnpm lint && pnpm typecheck && pnpm testpasses locally (lint and typecheck pass. Under Node 22, all 2088 desktop tests that loaded passed, but 29 desktop suites that need the Electron binary would not load, because Electron isn't installed in my environment. Every other workspace package passes.)pnpm changeset) if user-visiblePRINCIPLES 搂5b
requiresApiKeydefaults totrueunless a preset opts out.requiresApiKeyfield.PROXY_PRESETS, the existing modal prefill path, and the keyless flag. There is no LiteLLM-specific branching in the modal, and the base URL lives in one place (getPresetById('litellm')).Screenshots / recordings (UI changes)
No screenshot attached: the UI change is a new "LiteLLM Gateway" entry in the Add provider menu that opens the existing custom-provider modal prefilled with the name,
http://localhost:4000/v1, openai-chat, "No API key required" checked, and a short hint. Covered by the newAddCustomProviderModalrender test.