You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(settings): CLIProxyAPI preset + smart model auto-discovery
Adds support for CLIProxyAPI (CPA) — a popular Go local proxy
(router-for-me/CLIProxyAPI, ~27K stars, MIT) that wraps Claude Code /
Codex / Gemini OAuth subscriptions into a unified API. Heavily requested
by the linux.do user base.
User flow: Settings → Add provider → "CLIProxyAPI" → baseUrl auto-fills
http://127.0.0.1:8317 with anthropic wire → typing baseUrl/key triggers
/v1/models auto-discovery (500ms debounce) → defaultModel becomes a
dropdown auto-selecting best model (claude-sonnet-4-5 > opus > sonnet >
gemini-2.5-pro > gpt-5 > first) → save & ready.
Zero backend code needed:
- CPA serves wildcard CORS
- pi-ai's anthropic-messages wire already speaks /v1/messages
- claude-code-compat already injects claude-cli identity headers for
any non-api.anthropic.com anthropic-wire baseUrl
- IPC config:v1:test-endpoint already calls /v1/models
Incidentally closes the long-standing model selector gap for imported
and custom providers.
Signed-off-by: hqhq1025 <1506751656@qq.com>
feat(settings): auto-discover models in custom provider modal
7
+
8
+
When adding a custom provider (e.g. a CPA at http://127.0.0.1:8317), the modal now probes the endpoint automatically after the user types a valid http(s) baseUrl, debouncing 500ms. A spinner appears inline next to the "Default model" label while discovery runs, then either a green "Found N models" badge or a muted "Could not connect" hint.
9
+
10
+
On success the "Default model" input becomes a `<select>` pre-populated with discovered model IDs, with smart auto-selection prioritising claude-sonnet-4-5 → claude-opus → claude-sonnet → gemini-2.5-pro → gpt-5 → first in list. A "Enter manually" escape hatch lets users type any ID instead, and a "Pick from list" link restores the dropdown. The probe re-fires when the API key or wire protocol changes. Empty or non-http(s) baseUrls are skipped so the existing manual flow is completely unaffected.
Adds CLIProxyAPI (`router-for-me/CLIProxyAPI`) as a first-class preset in the Add Provider menu. CLIProxyAPI is a Go local proxy on port 8317 that wraps Claude/Codex/Gemini OAuth subscriptions into a unified Anthropic Messages API — heavily requested by the Chinese user base.
10
+
11
+
-`packages/shared`: new `cli-proxy-api` entry in `PROXY_PRESETS` (anthropic wire, `http://127.0.0.1:8317`)
12
+
-`packages/i18n`: `settings.providers.cliProxyApi.*` keys in both `en.json` and `zh-CN.json` (preset name, description, api-key-optional hint, thinking-budget hint, model discovery strings)
13
+
-`apps/desktop`: `AddProviderMenu` gains a CLIProxyAPI item that opens `AddCustomProviderModal` pre-filled with the CPA endpoint and anthropic wire; claude-cli identity headers are injected automatically by the existing `shouldForceClaudeCodeIdentity` path (no extra code needed)
0 commit comments