Skip to content

Commit bb58afd

Browse files
fylornclaude
andauthored
Import links v2: per-service parameters, grouped import page, builder and docs (#72)
* Import links v2: per-service parameters, grouped import page, builder and docs The import page and the link builder now follow version 2 of the import link: every parameter the New upstream dialog shows for the chosen service and authentication method (service, auth, site, OAuth, Bedrock access keys, headers, client identity, concurrency, balance source, models_only, specs, billing, price sheet), with the same per-service rules as the app. The page lists the receiving hosts first and the settings in the dialog's groups; a parameter from a newer version shows that a newer ThinkWatch Lite is needed and is passed on to the app. Proxies, AWS profiles, aliases, routes, weights, the disabled switch and the checking-only access token are rejected. The Import links docs are rewritten for v2, the Lite features and comparison pages updated, and the enterprise docs describe the Add to ThinkWatch Lite button (Lite 2026.10.16 or later), fix the Configuration Guide path to /guide, and note that GET /v1/models lists only the models the calling key may use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Import links v2.1: a link without service falls back to custom Without `service`, the service recognized from the address is used only when every parameter fits it; otherwise the link is a custom upstream, so every link written for the first version stays valid (an official address with another path, an Ollama address with a key, DeepSeek with protocol=openai-chat). An explicit `service` stays strict. The docs say so next to the v1 example and under `service`, the balance source is detected automatically when omitted, and the builder's default reads Auto-detect like the app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Import links v2.2: plain http on private networks `url` and `oauth_endpoint` accept plain http:// for loopback, private IPv4 ranges (10/8, 172.16/12, 192.168/16, 100.64/10, 169.254/16), IPv6 fc00::/7 and fe80::/10, names without a dot and names ending in .local, .lan, .internal, .intranet, .corp, .home.arpa or .localhost, so an enterprise gateway on the company intranet can be imported. Other http addresses stay rejected. The import page states under such a host that the key and request content travel in plain text; the docs list the rule, and the enterprise docs note that intranet http gateways work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Import links: the chat preset for New API sites A New API or One API admin can add ThinkWatch Lite to every key's chat menu with one preset; no change to the site's code is needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 2cf6839 commit bb58afd

17 files changed

Lines changed: 2015 additions & 400 deletions

‎src/components/ImportLinkBuilder.astro‎

Lines changed: 379 additions & 85 deletions
Large diffs are not rendered by default.

‎src/components/pages/ImportPage.astro‎

Lines changed: 314 additions & 114 deletions
Large diffs are not rendered by default.

‎src/content/docs-lite/en/compare-cc-switch.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ A dash means the feature is not described in that product's documentation.
1717
| | CC Switch | ThinkWatch Lite |
1818
|---|---|---|
1919
| Clients | Claude Code, Claude Desktop, Codex, Gemini CLI, Grok Build, OpenCode, OpenClaw, Hermes Agent, Pi, MiniMax Code | In one step: Claude Code, Claude Desktop, Codex (also in the ChatGPT desktop app), opencode, Pi, oh-my-pi, Grok Build, Qwen Code, Hermes Agent, Zed, Aider, DeepSeek Harness. With instructions: Cursor, Continue, Antigravity CLI |
20-
| Adding providers | More than 50 presets; `ccswitch://` links import providers, MCP servers, prompts and skills | A new upstream starts from the service, in three groups: model vendors (Anthropic, OpenAI, Google Gemini, DeepSeek, Z.ai / BigModel), platforms and relays (Amazon Bedrock, OpenRouter, ThinkWatch Enterprise, Sub2API, New API / One API), and Ollama or any compatible endpoint; ChatGPT and Z.ai / BigModel accounts sign in inside the dialog; `thinkwatch://import` links from a relay or vendor pre-fill one upstream |
20+
| Adding providers | More than 50 presets; `ccswitch://` links import providers, MCP servers, prompts and skills | A new upstream starts from the service, in three groups: model vendors (Anthropic, OpenAI, Google Gemini, DeepSeek, Z.ai / BigModel), platforms and relays (Amazon Bedrock, OpenRouter, ThinkWatch Enterprise, Sub2API, New API / One API), and Ollama or any compatible endpoint; ChatGPT and Z.ai / BigModel accounts sign in inside the dialog; `thinkwatch://import` links from a relay, a vendor or a ThinkWatch Enterprise console fill in the New upstream dialog for any service, headers, models and prices included |
2121
| Routing | In proxy mode, each client's requests go to its current provider; models can be mapped per provider | Ordered rules per key by model, API format, input tokens, tools, images, extended thinking and more; rules can rewrite the model |
2222
| Failover | Queue in priority order with a circuit breaker (proxy mode) | Next upstream in the group when an attempt fails before the answer begins; a session stays on one upstream |
2323
| Load balancing | — | Group strategies: in order, manual, round robin, lowest latency, lowest cost |

‎src/content/docs-lite/en/features.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Each upstream is also compared over the last 7 days with the others serving the
6161

6262
API keys and header values can be written as `${NAME}` to read a system environment variable. On macOS these come from the login shell, so variables exported in `~/.zshrc` and similar files apply, and the same holds on Linux (`~/.bashrc`, `~/.profile` and so on); on Windows they are the environment variables configured in system settings. After a variable changes, reopening the app picks it up. Proxy variables such as `HTTPS_PROXY`, and `PATH`, are not read.
6363

64-
A relay or vendor can hand out an import link, `thinkwatch://import?…` or its web form `https://thinkwat.ch/import#…`, that pre-fills a new upstream with a name, base URL, protocol, API key and model list. The app shows the settings and the host that will receive requests and the key in a confirmation dialog, and writes nothing and contacts nothing before Create is chosen. A link only ever adds one upstream: it cannot change existing ones, headers, proxies, pricing or routing, and a key that refers to an environment variable is rejected. The parameters and a link builder are in [Import links](/docs/lite/import-links).
64+
A relay, a vendor or a ThinkWatch Enterprise console can hand out an import link, `thinkwatch://import?…` or its web form `https://thinkwat.ch/import#…`, that opens the New upstream dialog with the service, address, key, headers, concurrency limit, models, model specs and a price sheet already filled in. The dialog names the host that will receive requests and keys, and nothing is written or sent before Next is chosen or a sign-in is started. A link only ever adds one upstream and cannot set proxies, aliases, routes or environment variable references; a link that needs a newer version of the app says so. The parameters for each service and a link builder are in [Import links](/docs/lite/import-links).
6565

6666
## Routing and failover
6767

‎src/content/docs-lite/en/import-links.md‎

Lines changed: 168 additions & 44 deletions
Large diffs are not rendered by default.

‎src/content/docs-lite/zh-CN/compare-cc-switch.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ThinkWatch Lite 在本机运行网关 ThinkWatch Core。在客户端页把每个
1717
| | CC Switch | ThinkWatch Lite |
1818
|---|---|---|
1919
| 客户端 | Claude Code、Claude Desktop、Codex、Gemini CLI、Grok Build、OpenCode、OpenClaw、Hermes Agent、Pi、MiniMax Code | 一键接管:Claude Code、Claude Desktop、Codex(含 ChatGPT 桌面版中的 Codex)、opencode、Pi、oh-my-pi、Grok Build、Qwen Code、Hermes Agent、Zed、Aider、DeepSeek Harness;提供配置方法:Cursor、Continue、Antigravity CLI |
20-
| 添加供应商 | 50 余个供应商预设;`ccswitch://` 链接可导入供应商、MCP 服务器、提示词与技能 | 新建上游先选择服务,分三组:模型厂商(Anthropic、OpenAI、Google Gemini、DeepSeek、Z.ai / BigModel)、平台与中转(Amazon Bedrock、OpenRouter、ThinkWatch 企业版、Sub2API、New API / One API),以及 Ollama 与任何兼容接口;ChatGPT 与 Z.ai / BigModel 账号在对话框内登录;中转站或服务商可通过 `thinkwatch://import` 链接预填一个上游 |
20+
| 添加供应商 | 50 余个供应商预设;`ccswitch://` 链接可导入供应商、MCP 服务器、提示词与技能 | 新建上游先选择服务,分三组:模型厂商(Anthropic、OpenAI、Google Gemini、DeepSeek、Z.ai / BigModel)、平台与中转(Amazon Bedrock、OpenRouter、ThinkWatch 企业版、Sub2API、New API / One API),以及 Ollama 与任何兼容接口;ChatGPT 与 Z.ai / BigModel 账号在对话框内登录;中转站、服务商或 ThinkWatch 企业版控制台可通过 `thinkwatch://import` 链接为任一服务类型预填「新建上游」对话框,包括请求头、模型与价目表 |
2121
| 路由 | 代理模式下,每个客户端的请求发往它当前的供应商;可按供应商映射模型 | 每把密钥的规则按顺序匹配模型、API 格式、输入 token、工具、图片、扩展思考等条件;规则可以改写模型 |
2222
| 故障转移 | 按优先级排列的故障转移队列,带熔断(代理模式) | 回答开始之前尝试失败时,转到策略组中的下一个上游;同一会话默认保持在同一个上游 |
2323
| 负载均衡 | — | 策略组:按顺序、手动选择、轮询、延迟最低、费用最低 |

‎src/content/docs-lite/zh-CN/features.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ WSL 2 默认使用 NAT 网络,此时 Windows 上的网关无法从 WSL 内访
6161

6262
API 密钥和请求头的值可以写成 `${变量名}`,读取系统环境变量。macOS 上读的是登录 shell 里的环境变量,`~/.zshrc` 等文件中 `export` 的变量都会生效,Linux 同理(`~/.bashrc`、`~/.profile` 等);Windows 上读的是系统设置里配置的环境变量。修改变量后,重新打开应用即可生效。代理相关的变量(`HTTPS_PROXY` 等)和 `PATH` 不会被读取。
6363

64-
中转站或服务商可以提供导入链接(`thinkwatch://import?…`,或网页形式 `https://thinkwat.ch/import#…`),预填新上游的名称、接口地址、接口协议、API 密钥与模型清单。应用在确认对话框中列出这些设置,并写明请求与密钥将发往的主机;选择「创建」之前不写入配置,也不连接该地址。一条链接只能新增一个上游,不能修改已有的上游、请求头、代理、价目表或路由,引用环境变量的密钥一律拒绝。参数说明与链接生成器见[导入链接](/zh-CN/docs/lite/import-links)。
64+
中转站、服务商或 ThinkWatch 企业版控制台可以提供导入链接(`thinkwatch://import?…`,或网页形式 `https://thinkwat.ch/import#…`),打开预填好的「新建上游」对话框,服务类型、地址、密钥、请求头、并发上限、模型、模型规格与价目表都可以预先填写。对话框写明接收请求与密钥的主机;选择「下一步」或开始登录之前,不写入配置,也不发出任何请求。一条链接只能新增一个上游,不能设置代理、模型别名、路由或环境变量引用;需要更新版本应用的链接会提示更新。各服务类型的参数与链接生成器见[导入链接](/zh-CN/docs/lite/import-links)。
6565

6666
## 路由与故障转移
6767

0 commit comments

Comments
 (0)