Skip to content

feat(providers): add first-class LiteLLM Gateway preset - #419

Open
Lxr-max wants to merge 2 commits into
OpenCoworkAI:mainfrom
Lxr-max:cursor/litellm-gateway-preset-87d2
Open

Lxr-max wants to merge 2 commits into
OpenCoworkAI:mainfrom
Lxr-max:cursor/litellm-gateway-preset-87d2

Conversation

@Lxr-max

@Lxr-max Lxr-max commented Sep 14, 2026

Copy link
Copy Markdown

Summary

LiteLLM gateways already worked as a generic custom OpenAI-compatible provider, but setup was too manual: users had to pick a wire, decide how to store a proxy key (or fail because empty keys were rejected), and read generic connection errors that did not mention LiteLLM. This PR adds a first-class LiteLLM Gateway preset in Settings so an externally hosted LiteLLM proxy can be added like other first-class gateway presets (for example CLIProxyAPI).

LiteLLM is not bundled. The app still talks to a user-hosted gateway over HTTP. BYOK and local-first storage are unchanged: proxy keys stay in local encrypted secrets, and keyless / IP-allowlist deployments store no secret.

How users add it

Settings → Models → Add Provider → LiteLLM Gateway. The modal prefills:

  • Default base URL http://localhost:4000/v1
  • Default wire openai-chat (user can change it)
  • LiteLLM-specific help copy for master/virtual keys vs keyless allowlists
  • Private-network access enabled by default for local gateways

Key paths

  • Proxy-key: paste LITELLM_MASTER_KEY or a virtual key. The secret is stored encrypted. The provider entry is still marked requiresApiKey: false so it can later switch to keyless.
  • Keyless / IP-allowlist: leave the key empty. No secret is stored. Activation and hasKey behave like other keyless local providers (Ollama-style).
  • Generic custom providers still require an API key. Empty keys are allowed only when the client sends requiresApiKey: false (the LiteLLM preset).

Discovery and diagnostics

  • config:v1:test-endpoint can probe /models with an empty key so discovery works on keyless gateways.
  • 401/403, connection refused, and /models 404 get LiteLLM-specific cause/fix strings plus a hint in the connection diagnostic panel.

CI follow-up

The first runPreview with real Chrome Vitest case was racing Puppeteer's 30s launch default on busy GitHub runners and reporting Test timed out. This PR now uses a 60s Chrome launch timeout, warms Chrome once, and gives the Chrome suite a 90s budget so Lint/typecheck/test can finish. Coverage is unchanged.

Type of change

  • New feature

Linked issue

Fixes #208

Checklist

  • I checked the linked issue / relevant context before starting
  • pnpm lint && pnpm typecheck && pnpm test passes locally
  • Added/updated tests for the change
  • Added a changeset (pnpm changeset) if user-visible
  • Updated docs if behavior changed

Dependency additions (if any)

None. No LiteLLM runtime, binary, or SDK is added.

Principles 5b

  • Compatible: existing custom-provider and CLIProxyAPI flows are unchanged; generic empty API keys are still rejected.
  • Upgradeable: new preset is additive (schemaVersion unchanged); keyless flag is optional on the add-provider payload.
  • Lean: reuses the Add Custom Provider modal and existing proxy-preset / diagnostics patterns instead of a new provider SDK.
  • Elegant: LiteLLM-specific copy and diagnostics live next to the existing gateway preset, not a parallel settings path.

Screenshots / recordings (UI changes)

Settings Add Provider menu now includes LiteLLM Gateway; the modal shows LiteLLM help copy and an optional proxy-key field. Electron UI was not recorded in this cloud environment.

Allow Settings users to add an externally hosted LiteLLM gateway without
hand-rolling a custom provider. Support proxy-key and keyless/IP-allowlist
deployments, LiteLLM-specific diagnostics, and /models discovery when the
gateway exposes it. LiteLLM is not bundled.
The first real-Chrome runPreview test raced Puppeteer's 30s launch default
on busy GitHub runners and surfaced as a Vitest timeout. Raise the launch
timeout, warm Chrome once, and keep the Chrome suite budget above launch
plus navigation so Lint/typecheck/test can finish.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:desktop apps/desktop (Electron shell, renderer) docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: 增加 LiteLLM Gateway 一等预设 / Add a first-class LiteLLM gateway preset

1 participant