docs(release): add v4.0.10 release notes

This commit is contained in:
Jason committed 2026-10-13 00:19:45 +08:00
1 parent db29caefb7
commit 90fb37ffb7
4 files changed
+246

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
# CC Switch v4.0.10
### The sixth fix release for 4.0 stable
This release focuses on one-click import links (`ccswitch://` deep links): clicking a link while CC Switch is not running no longer loses it; links can declare the API format, import Pi providers and bring the site's own icon; Codex and Grok Build links keep the provider's own configuration instead of having it replaced with a fixed template; and the confirmation dialog lets you choose whether to switch right after import. Site owner guides in Chinese, English and Japanese and an online link generator are also published. Provider icons can now be uploaded from local images, and once saved to "My Icons" any provider can use them; the usage page adds first-token time, which can be estimated from session logs even when routing is off. It also fixes upstreams that require thinking rejecting Claude Code's haiku-tier requests in Routing mode, Codex sessions left by using an official account through routing in v3.20 and earlier failing to open, and Grok Build third-party providers being unable to generate session titles. For everything new in 4.0, see the [v4.0 release notes](https://github.com/farion1231/cc-switch/blob/main/docs/release-notes/v4.0.4-en.md).
---
## One-click import links
### What changes for users
- **Clicking a link while CC Switch is not running no longer loses it.** On Windows and Linux, clicking a one-click import link while CC Switch was not open used to start the app, but the import confirmation dialog did not appear; in lightweight mode the link was also lost when the window was recreated. On macOS the same link brought up the confirmation dialog twice. Links are now stored first and only count as handled once the confirmation dialog has been shown, so they are not lost if something interrupts along the way, and an older link arriving later does not overwrite a newer one.
- **The confirmation dialog lets you choose whether to switch right after import.** The confirmation dialog for provider links adds a "Switch to this provider after import" switch, off by default; when it is on, the dialog warns that client requests will be sent to the address in the link. Coexist-mode apps such as OpenCode, OpenClaw, Hermes and MiniMax Code get a switch like "Add to the OpenCode config after import", and Pi gets "Enable in Pi after import"; these two kinds are on by default. For prompts it is "Enable after import". The `enabled` value in a link only sets the switch's initial state. With the switch off, only the provider is saved and the client config is not changed, even if this is the app's first provider.
- **Links with a usage query script turn on usage query by default after import.** A site owner attaches a script to the link because they want you to see your balance right after import; previously you had to turn it on manually. Links that set `usageEnabled=false` still keep it off; links without a script behave as before. The script runs in a sandbox and can send only one request, over HTTPS to the same origin as the provider address, and the confirmation dialog still shows the full script as before.
- **Codex links keep the provider's own configuration.** When a link carried a full `config.toml`, only the Key, address and model used to be taken out and put into a fixed template, losing the provider's authentication method, request headers, WebSocket support and model catalog URL. Now the parts that belong to this provider are kept: connection and authentication fields, model, reasoning effort, context window, subagent model and so on; the model catalog URL is kept only when it has the same origin as the API address, because Codex sends the provider's credentials when fetching it. Global settings such as `[features]`, MCP and permissions are not imported. Provider configurations that would make Codex run commands or read local credentials (`auth`, `aws`, `gateway_oauth`, `env_http_headers`) are rejected outright. Links without a configuration import exactly as before.
- **Grok Build links keep the model configuration.** Links with a `config.toml` used to be replaced with a fixed template too, losing the display name, description, API type and context window. Now the model table that `[models] default` points to is kept, while the address, Key and model still come from the link parameters; links that use `auth_provider`, `env_http_headers` or `mtls_cert_dir` are rejected. A provider takes only one table in Grok Build, so other model tables are not imported.
- **Values that would be expanded and executed are always rejected.** Coexist-mode apps expand some special syntax in their configs: in Pi, values starting with `!` are run as commands and `$NAME` / `${NAME}` read environment variables; OpenCode has `{env:}` / `{file:}`; OpenClaw and Hermes have `${...}`. When a link contains this syntax, it could run commands or send secrets and file contents from this machine to the address in the link. This is now checked when parsing the link, merging configs and building the provider, and the import is rejected if any is found.
- **Other:** Links with `configUrl` now say it is not supported as soon as they are opened, instead of failing after you confirm; prompt links support MiniMax Code, and MCP links support Pi and MiniMax Code; the tray menu refreshes right after a provider is imported.
### New parameters for site owners
- **`apiFormat`:** One parameter declares the upstream API format (`anthropic` / `openai_chat` / `openai_responses` / `gemini_native`), and CC Switch turns it into each app's own fields. Non-native formats for Claude Code, Codex and Grok Build need local routing to be on; combinations an app does not support are rejected when the link is parsed. Links without this parameter behave as before.
- **Pi provider links:** Newly supported. After import they are written to Pi's `models.json`, and the link must include a model.
- **`iconUrl`:** The https address of the site's own logo. It is downloaded and shown at the top as soon as the confirmation dialog opens, and becomes the card's custom icon after import; if the download fails, the import still goes ahead and the card falls back to a built-in icon or the first letter of the name. The image is redrawn and saved as a small PNG; the address itself is neither saved nor rendered. Downloads connect only to public addresses and pin the resolved result, so a second DNS lookup cannot point somewhere else; each redirect hop is checked, up to 3 hops. No system proxy, no cookies, a 5-second timeout, 256 KB maximum, and the file type must match the content.
### Site owner guide and online generator
- **[Site owner integration guide](https://github.com/farion1231/cc-switch/blob/main/docs/guides/deeplink-site-integration-guide-en.md)** (also in [中文](https://github.com/farion1231/cc-switch/blob/main/docs/guides/deeplink-site-integration-guide-zh.md) and [日本語](https://github.com/farion1231/cc-switch/blob/main/docs/guides/deeplink-site-integration-guide-ja.md)): how to generate links, how to put a "one-click import" button on your page (the link is fetched from your backend when the button is clicked, so the Key never appears in the page source), what to show when the user hasn't installed CC Switch, and how to attach a usage query script. Sites built with New API or Sub2API already have an "Import to CC Switch" button in their Key list; the difference is that New API links carry no usage query script, so users don't see a balance after import.
- **[Online link generator](https://ccswitch.io/deplink.html)**: changed from a test page into a generator for site owners, covering four kinds of links (provider, MCP, prompt, Skill), listing the `apiFormat` options available for each app, with built-in usage script templates, and checking `icon` / `iconUrl` with the same rules as the app. The generator link in the user manual pointed to a GitHub Pages address that was never set up and opened a 404; the manual and README now point here.
## New
**Provider icons can be uploaded from local images and kept in "My Icons" for reuse.** The icon picker is split into two groups, "My Icons" and "Built-in Icons", and the search box filters both. Click "Upload", the first tile in "My Icons", pick a PNG, JPG, WebP or SVG (up to 2 MB) and give it a name (the file name by default), and it is saved to "My Icons" and used for the current provider; from then on other providers and other apps can pick it directly without uploading it again, and uploading the same image again reuses the existing entry. Hover over an icon to rename or delete it; cards store the image itself, so renaming or deleting does not affect providers already using it. Images are shrunk to a 96×96 PNG, and "My Icons" and provider configs both travel with cloud sync, with no separate files saved on disk; SVGs are converted to bitmaps first, any scripts and external requests inside them are not run, and the original file does not go into the database. Site icons brought in by one-click import links are shown as "Current icon" and can be saved to "My Icons". In the picker, one click on an icon now selects it and closes the picker; to remove the icon, click "Clear icon" next to the search box.
**The usage page shows first-token time.** The routing service has always recorded first-token time, but it used to be visible only in hover tooltips and request details. Provider stats and model stats now have a "First token" column, which takes the median of successful streaming requests through the routing service, so occasional slow requests from queuing or cold starts don't pull it up; the request log also adds a "First token" column after "Speed". When routing is off, it is estimated from session log timestamps and shown with ≈: for Claude Code, from replies that start with thinking; for Codex, from timestamps written by newer versions; replies that start with body text or a tool call have no estimate. Records imported before the upgrade are not backfilled.
**Usage query adds a Sub2API template.** The templates in "Configure usage query" add Sub2API, which needs only the provider's Key and address, with or without `/v1`; it shows the plan name, and unlimited subscriptions no longer show as a negative balance.
**New presets:** NekoCode (Claude Code, Claude Desktop, Codex, OpenCode, OpenClaw, Hermes, Pi; MiniMax Code uses the Pi preset). YYLX is shown as 「鱼鱼连线」 in the Simplified Chinese interface (「魚魚連線」 in Traditional Chinese); the English interface still shows YYLX.
## Fixes
- **In Routing mode, upstreams rejected Claude Code's haiku-tier requests** ([#8118](https://github.com/farion1231/cc-switch/issues/8118)). Routing mode writes fixed model aliases into `settings.json`, and Claude Code decides how to send thinking parameters based on the alias. The haiku tier used to be written as `claude-haiku-4-5`; Claude Code considers that model able to turn thinking off, so it sent requests with thinking turned off, which upstreams that require thinking reject outright. It is now `claude-haiku-5-5`, sent the same way as the sonnet and opus tiers. Routing itself still maps by the "haiku" keyword, so the model it picks does not change.
- **Codex sessions left by using an official account through routing in v3.20 and earlier could not be opened** ([#7948](https://github.com/farion1231/cc-switch/issues/7948)). From v3.17 to v3.20, when an official account went through local routing, Codex recorded its sessions under `cc-switch-official`; v4.0 no longer writes that table, so when Codex resumed those sessions it reported "Model provider `cc-switch-official` not found". CC Switch now moves them back to Codex's built-in `openai` group at startup, changing only the session records and not touching `config.toml`. These sessions used the official sign-in all along and Codex always treated them as OpenAI, so behavior does not change after the move.
- **Grok Build could not generate session titles with a third-party provider** ([#7003](https://github.com/farion1231/cc-switch/issues/7003)). When `models.session_summary` was not set, Grok Build generated titles with the built-in `grok-4.6` but sent the request to the default model table's address, which third-party upstreams reject. Now, when you switch providers, `session_summary` follows the current provider if it is unset or points to a table CC Switch wrote, and it is removed when you switch back to the official account; a built-in model or a table you set yourself is left alone.
- **OpenRouter and Novita cards showed "Plan expired" when the balance was zero** ([#8148](https://github.com/farion1231/cc-switch/issues/8148)). When the balance was zero or negative, the Key actually still worked, but the card and the tray showed the plan as expired. They now show "Balance used up"; when the API returns a missing or malformed balance, an error is reported instead of treating it as a zero balance.
- **After switching models mid-thread in Codex, usage was recorded under the previous model.** When the model is changed in Codex's thread settings, the log does not always get a new turn context, so usage import used to record later requests under the previous model name (or as `unknown` when there was no earlier record) and price them at the previous model's rate. That setting is now read. Records already imported are not rewritten automatically; if the source session logs still exist, click "Rebuild Codex Usage" under "Data sources" on the usage page (the database is backed up automatically before rebuilding).
- **After changing a config directory in Settings without clicking Save, changing another setting saved the directory too** ([#7849](https://github.com/farion1231/cc-switch/issues/7849)). When other settings auto-save, only confirmed directories are now included, and discarded drafts no longer stay in the input box either.
- **On Windows, the window flashed when opening the add or edit provider page.** v4.0.9 fixed the edit page showing a loading page first, but the full-page fade still flashed on Windows. These two pages no longer fade in and out; other pages are not affected.
- **On Windows, a deleted desktop shortcut came back with every update.** An MSI upgrade uninstalls the old version and then fully installs the new one, and it used to create the desktop shortcut again every time. It is now created only on a fresh install; on upgrade it is kept only if the original shortcut is still there.
**Other:** The description of "Connection mode" now leads with what each mode is good at: Direct is the most native, Routing can hot-switch providers and supports failover and format conversion, and Aggregation lets you switch seamlessly between models from several providers inside the client. All usage table columns are now left-aligned, and the provider and model columns in the request log give up some width to the number columns. The Japanese interface changes 「高級オプション」 to 「詳細オプション」.
## Upgrade Notes
**The database schema is unchanged**, still at 20.
- If Claude Code is already in Routing mode, CC Switch writes the new haiku alias into `settings.json` when it starts after the upgrade, and new Claude Code sessions will use it.
- The Codex session migration runs automatically when CC Switch starts, once per Codex config directory, and the session records from before the change are backed up in the existing session-group migration backup directory. If you manually restored the `cc-switch-official` table and still use it, this migration is skipped.
- The new presets only affect newly added providers.
---
## Thanks
Thanks to [@funkpopo](https://github.com/funkpopo) (OpenRouter showing the plan as expired when the balance is zero, and Codex usage recorded under the wrong model after switching models mid-thread), [@hulkbig](https://github.com/hulkbig) (unconfirmed directories being saved when settings auto-save) and [@NestorRay](https://github.com/NestorRay) (the flash on Windows when opening provider pages) for their contributions.
Thanks to [@hao-lin-lwh](https://github.com/hao-lin-lwh), [@desmonna](https://github.com/desmonna), [@mossonli](https://github.com/mossonli), [@enderzcx](https://github.com/enderzcx), [@nbcoming](https://github.com/nbcoming), [@liyangdeamo-svg](https://github.com/liyangdeamo-svg), [@linhay](https://github.com/linhay) and [@aofee](https://github.com/aofee) for reporting issues, providing reproduction details and helping verify fixes.
For the full technical details, see the [CHANGELOG](https://github.com/farion1231/cc-switch/blob/main/CHANGELOG.md).
+71
View File
@@ -0,0 +1,71 @@
# CC Switch v4.0.10
### 4.0 正式版の 6 回目の修正リリース
今回の中心はワンクリックインポートのリンク(`ccswitch://` ディープリンク)です。CC Switch が起動していないときにリンクを押しても失われなくなりました。リンクで API の形式を宣言したり、Pi のプロバイダーをインポートしたり、サイト自身のアイコンを付けたりできます。Codex と Grok Build のリンクはプロバイダー独自の設定を保ち、固定のテンプレートに置き換えられなくなりました。確認ダイアログでは、インポート後すぐに切り替えるかどうかを選べます。あわせて、中国語・英語・日本語のサイト運営者向け連携ガイドと、オンラインのリンク生成ツールを公開しました。プロバイダーのアイコンにはローカルの画像をアップロードできるようになり、「マイアイコン」に保存すればすべてのプロバイダーで選べます。使用量ページには最初のトークンまでの時間を追加し、ルーティングを使っていなくてもセッションログから推定します。また、ルーティングモードで Claude Code の haiku 階層のリクエストが、思考を必須とする上流に拒否される問題、v3.20 以前に公式アカウントでルーティングを使ったときに残った Codex のセッションが開けない問題、Grok Build でサードパーティのプロバイダーを使うとセッションのタイトルを生成できない問題などを修正しました。4.0 の更新内容の全体は [v4.0 リリースノート](https://github.com/farion1231/cc-switch/blob/main/docs/release-notes/v4.0.4-ja.md) をご覧ください。
---
## ワンクリックインポートのリンク
### ユーザーから見た変化
- **CC Switch が起動していないときにリンクを押しても、失われなくなりました。** これまで Windows と Linux では、CC Switch を起動していない状態でワンクリックインポートのリンクを押すと、アプリは起動するもののインポートの確認ダイアログが表示されませんでした。軽量モードでウィンドウを作り直したときにも失われていました。macOS では同じリンクで確認ダイアログが 2 回表示されていました。現在はリンクをいったん保存し、確認ダイアログが表示されて初めて処理済みとします。途中で中断されても失われず、後から届いた古いリンクが新しいリンクを上書きすることもありません。
- **確認ダイアログで、インポート後すぐに切り替えるかどうかを選べるようになりました。** プロバイダーのリンクの確認ダイアログに「インポート後にこのプロバイダーへ切り替える」スイッチを追加しました。デフォルトはオフで、オンにすると、クライアントのリクエストの送り先がリンクに書かれたアドレスに変わることが表示されます。OpenCode、OpenClaw、Hermes、MiniMax Code のような共存型アプリでは「インポート後に OpenCode の設定へ追加する」のようなスイッチ、Pi では「インポート後に Pi で有効にする」で、この 2 種類はデフォルトでオンです。プロンプトは「インポート後に有効にする」です。リンクの `enabled` が決めるのはスイッチの初期状態だけです。スイッチをオフにするとプロバイダーを保存するだけで、クライアントの設定は変更しません。そのアプリで最初のプロバイダーであっても同じです。
- **使用量クエリスクリプト付きのリンクは、インポート後に使用量クエリがデフォルトで有効になります。** サイト運営者がリンクにスクリプトを付けるのは、インポートしてすぐに残高を見てほしいからですが、これまではさらに手動で有効にする必要がありました。リンクに `usageEnabled=false` と書かれていれば引き続きオフです。スクリプトのないリンクはこれまでと同じです。スクリプトはサンドボックスで実行され、プロバイダーのアドレスと同一オリジンの HTTPS に 1 回だけリクエストを送れます。確認ダイアログには、これまでどおりスクリプトの内容がすべて表示されます。
- **Codex のリンクで、プロバイダー独自の設定を保つようになりました。** リンクに完全な `config.toml` が含まれている場合、これまでは Key、アドレス、モデルだけを取り出して固定のテンプレートに当てはめていたため、プロバイダーの認証方式、リクエストヘッダー、WebSocket 対応、モデルカタログのアドレスが失われていました。現在はそのうち、このプロバイダーに属する部分を保ちます。接続と認証のフィールド、モデル、推論強度、コンテキストウィンドウ、サブエージェントモデルなどです。モデルカタログのアドレスは、API のアドレスと同一オリジンの場合にだけ保ちます。Codex はこれを取得するときにプロバイダーの認証情報を付けるためです。`[features]`、MCP、権限のようなグローバル設定はインポートしません。Codex にコマンドを実行させたり、ローカルの認証情報を読ませたりするプロバイダー設定(`auth`、`aws`、`gateway_oauth`、`env_http_headers`)を含むリンクは、全体を拒否します。設定を含まないリンクのインポート結果は、これまでと一字一句同じです。
- **Grok Build のリンクで、モデルの設定を保つようになりました。** `config.toml` を含むリンクも、これまでは固定のテンプレートに置き換えられ、表示名、説明、API の種類、コンテキストウィンドウが失われていました。現在は `[models] default` が指すモデルテーブルを保ち、アドレス、Key、モデルは引き続きリンクのパラメーターを優先します。`auth_provider`、`env_http_headers`、`mtls_cert_dir` を使うリンクは拒否されます。Grok Build では 1 つのプロバイダーが使うテーブルは 1 つだけなので、ほかのモデルテーブルはインポートしません。
- **展開して実行される値は、すべて拒否するようになりました。** 共存型アプリは、設定にある特殊な書き方を展開します。Pi では `!` で始まる値がコマンドとして実行され、`$NAME` / `${NAME}` は環境変数を読みます。OpenCode には `{env:}` / `{file:}`、OpenClaw と Hermes には `${...}` があります。リンクにこうした書き方があると、コマンドが実行されたり、ローカルの秘密情報やファイルの内容がリンクに書かれたアドレスに送られたりするおそれがあります。現在はリンクの解析、設定のマージ、プロバイダーの生成のそれぞれで確認し、見つかればインポートを拒否します。
- **その他:** `configUrl` を含むリンクは、開いた時点で非対応であることを表示するようになり、確認した後で失敗することはなくなりました。プロンプトのリンクが MiniMax Code に、MCP のリンクが Pi と MiniMax Code に対応しました。プロバイダーをインポートすると、トレイメニューがすぐに更新されます。
### サイト運営者向けの新しいパラメーター
- **`apiFormat`:** 1 つのパラメーターで上流の API 形式(`anthropic` / `openai_chat` / `openai_responses` / `gemini_native`)を宣言でき、CC Switch が各アプリ自身のフィールドに置き換えます。Claude Code、Codex、Grok Build でネイティブでない形式を使うには、ローカルルーティングを有効にする必要があります。アプリが対応していない組み合わせは、解析の時点で拒否されます。このパラメーターのないリンクの動作は変わりません。
- **Pi のプロバイダーのリンク:** 新たに対応しました。インポートすると Pi の `models.json` に書き込まれます。リンクにはモデルが必須です。
- **`iconUrl`:** サイト自身のロゴの https アドレスを指定します。確認ダイアログを開いた時点でダウンロードして上部に表示し、インポート後はカードのカスタムアイコンになります。ダウンロードに失敗してもインポートには影響せず、カードは内蔵アイコンか名前の頭文字に戻ります。画像は小さな PNG に描き直して保存し、アドレス自体は保存も表示もしません。ダウンロード時にはパブリックなアドレスにだけ接続し、名前解決の結果を固定して、2 回目の DNS 解決で別の場所を指されるのを防ぎます。リダイレクトは 1 回ごとに確認し、最大 3 回までです。システムプロキシは使わず、Cookie も送りません。タイムアウトは 5 秒、サイズは最大 256 KB で、ファイルの種類が内容と一致している必要があります。
### サイト運営者向け連携ガイドとオンライン生成ツール
- **[サイト運営者向け連携ガイド](https://github.com/farion1231/cc-switch/blob/main/docs/guides/deeplink-site-integration-guide-ja.md)**(ほかに [中文](https://github.com/farion1231/cc-switch/blob/main/docs/guides/deeplink-site-integration-guide-zh.md)、[English](https://github.com/farion1231/cc-switch/blob/main/docs/guides/deeplink-site-integration-guide-en.md)):リンクの生成方法、ページに「ワンクリックインポート」ボタンを置く方法(ボタンを押したときにバックエンドへリンクを要求するので、Key がページのソースに現れません)、ユーザーが CC Switch をインストールしていないときに何を表示するか、使用量クエリスクリプトの付け方を説明しています。New API や Sub2API で構築したサイトでは、Key 一覧に「CC Switch へのインポート」ボタンが最初から付いています。違いは、New API のリンクには使用量クエリスクリプトが含まれないため、ユーザーがインポートしても残高が表示されないことです。
- **[オンラインのリンク生成ツール](https://ccswitch.io/deplink.html)**:テストページから、サイト運営者向けの生成ツールに作り替えました。プロバイダー、MCP、プロンプト、Skill の 4 種類に分かれ、アプリごとに選べる `apiFormat` を一覧にし、使用量スクリプトのテンプレートを内蔵しています。`icon` / `iconUrl` を入力すると、アプリ内と同じルールで確認します。ユーザーマニュアルにあった生成ツールへのリンクは、一度も公開されたことのない GitHub Pages のアドレスを指しており、開くと 404 でした。現在はマニュアルと README のどちらもここを指すようにしました。
## 新機能
**プロバイダーのアイコンにローカルの画像をアップロードし、「マイアイコン」に保存して繰り返し使えるようになりました。** アイコンの選択画面は「マイアイコン」と「内蔵アイコン」の 2 グループに分かれ、検索欄で両方を同時に絞り込めます。「マイアイコン」の最初のマスにある「アップロード」を押し、PNG、JPG、WebP、SVG のいずれか(2 MB まで)を選んで名前を付ける(デフォルトはファイル名)と、「マイアイコン」に保存され、現在のプロバイダーに使われます。以降はほかのプロバイダーやほかのアプリでもそのまま選べ、もう一度アップロードする必要はありません。同じ画像をもう一度アップロードすると、既存のものを再利用します。アイコンにマウスを重ねると、名前の変更や削除ができます。カードには画像そのものを保存しているため、名前を変えても削除しても、すでにそのアイコンを使っているプロバイダーには影響しません。画像は 96×96 の PNG に縮小され、「マイアイコン」もプロバイダーの設定もクラウド同期で引き継がれます。ディスクに別のファイルとして保存することはありません。SVG はまずビットマップに変換し、中のスクリプトや外部へのリクエストは実行されず、元のファイルはデータベースに入りません。ワンクリックインポートのリンクで付いてきたサイトのアイコンは「現在のアイコン」として表示され、「マイアイコン」に保存できます。選択画面ではアイコンを 1 回クリックすると選択して閉じるようになりました。アイコンを外すには、検索欄の横の「アイコンをクリア」を押します。
**使用量ページに最初のトークンまでの時間を表示するようになりました。** ルーティングサービスはこれまでも最初のトークンまでの時間を記録していましたが、見られるのはツールチップとリクエストの詳細だけでした。現在はプロバイダー統計とモデル統計に「最初のトークン」列を追加しました。値はルーティングサービス経由で成功したストリーミングリクエストの中央値なので、キュー待ちやコールドスタートでたまに遅くなったリクエストに引き上げられることはありません。リクエストログでも「速度」の後ろに「最初のトークン」列を追加しました。ルーティングを使っていないときは、セッションログのタイムスタンプから推定し、≈ を付けて表示します。Claude Code は思考から始まる返信を、Codex は比較的新しいバージョンが書き込んだタイムスタンプを使います。本文やツール呼び出しから始まる返信には推定値がありません。アップグレード前にインポートした記録は計算し直しません。
**使用量クエリに Sub2API のテンプレートを追加しました。** 「利用状況を設定」のテンプレートに Sub2API を追加しました。必要なのはプロバイダーの Key とアドレスだけで、アドレスに `/v1` が付いていてもいなくても構いません。プラン名を表示し、無制限のサブスクリプションがマイナスの残高として表示されることもなくなりました。
**新しいプリセット:** NekoCode(Claude Code、Claude Desktop、Codex、OpenCode、OpenClaw、Hermes、Pi。MiniMax Code は Pi のプリセットを使います)。YYLX は中国語(簡体字)の画面では「鱼鱼连线」(繁体字中国語では「魚魚連線」)と表示されます。日本語の画面では引き続き YYLX と表示されます。
## 修正
- **ルーティングモードで、Claude Code の haiku 階層のリクエストが上流に拒否されていた問題**([#8118](https://github.com/farion1231/cc-switch/issues/8118))。ルーティングモードでは `settings.json` に固定のモデルエイリアスを書き込み、Claude Code はエイリアスによって思考パラメーターの送り方を決めます。haiku 階層にはこれまで `claude-haiku-4-5` を書いていたため、Claude Code はこのモデルでは思考をオフにできると判断して思考をオフにしたリクエストを送り、思考を必須とする上流にそのまま拒否されていました。現在は `claude-haiku-5-5` に変え、sonnet、opus 階層と同じ送り方になりました。ルーティング自体は引き続き「haiku」というキーワードでマッピングするため、選ばれるモデルは変わりません。
- **v3.20 以前に公式アカウントでルーティングを使ったときに残った Codex のセッションが開けなかった問題**([#7948](https://github.com/farion1231/cc-switch/issues/7948))。v3.17 から v3.20 で公式アカウントからローカルルーティングを使っていたとき、Codex はセッションを `cc-switch-official` の名前で記録していました。v4.0 はこのテーブルを書き込まなくなったため、Codex がこれらのセッションを再開しようとすると「Model provider `cc-switch-official` not found」というエラーになっていました。現在は CC Switch の起動時に、これらのセッションを Codex 内蔵の `openai` グループに戻します。変更するのはセッションの記録だけで、`config.toml` には触れません。これらのセッションはもともと公式ログインを使っており、Codex も一貫して OpenAI として扱っていたため、移動後も動作は変わりません。
- **Grok Build でサードパーティのプロバイダーを使うと、セッションのタイトルを生成できなかった問題**([#7003](https://github.com/farion1231/cc-switch/issues/7003))。`models.session_summary` が設定されていない場合、Grok Build は内蔵の `grok-4.6` でタイトルを生成しますが、リクエストはデフォルトのモデルテーブルのアドレスに送られるため、サードパーティの上流に拒否されていました。現在はプロバイダーを切り替えるとき、`session_summary` が未設定か CC Switch が書いたテーブルを指している場合は、現在のプロバイダーを指すように合わせ、公式アカウントに戻すときは削除します。自分で設定した内蔵モデルや自分のテーブルはそのまま残します。
- **OpenRouter、Novita の残高がゼロのとき、カードに「プラン期限切れ」と表示されていた問題**([#8148](https://github.com/farion1231/cc-switch/issues/8148))。残高がゼロまたはマイナスでも Key は実際には使えるのに、カードとトレイにはプランの期限が切れたと表示されていました。現在は「残高なし」と表示します。API が返す残高が欠けていたり形式が正しくなかったりする場合はエラーとし、残高ゼロとしては扱わなくなりました。
- **Codex で途中でモデルを変えた後も、使用量が元のモデルで記録されていた問題。** Codex がスレッドの設定でモデルを変えたとき、ログに新しいターンのコンテキストが書かれるとは限らず、使用量の取り込みではこれまで、その後のリクエストを直前のモデル名で記録し(それより前の記録がなければ `unknown`)、料金も元のモデルで計算していました。現在はこの設定を読み取ります。すでに取り込んだ記録は自動では書き換えません。元のセッションログが残っていれば、使用量ページの「データソース」で「Codex 使用量を再構築」を押して作り直せます(再構築の前にデータベースが自動でバックアップされます)。
- **設定画面で設定ディレクトリを変更し、まだ保存を押していないときに別の設定を変更すると、ディレクトリまで保存されていた問題**([#7849](https://github.com/farion1231/cc-switch/issues/7849))。ほかの設定が自動保存されるとき、確定済みのディレクトリだけを含めるようになりました。破棄した下書きが入力欄に残ることもなくなりました。
- **Windows でプロバイダーの追加・編集ページを開くと、ウィンドウが一瞬ちらついていた問題。** v4.0.9 では編集ページで先に読み込み中の画面が表示される問題を修正しましたが、ページ全体のフェードイン・フェードアウトが Windows ではまだちらついていました。現在はこの 2 つのページでフェードイン・フェードアウトをしなくなりました。ほかのページには影響しません。
- **Windows で削除したデスクトップのショートカットが、更新のたびに作り直されていた問題。** MSI のアップグレードは旧バージョンをアンインストールしてから新バージョンを完全にインストールするため、これまでは毎回デスクトップのショートカットを作り直していました。現在は新規インストールのときにだけ作成し、アップグレードでは元のショートカットが残っている場合にだけ保持します。
**その他:** 「接続モード」の説明を、まずそれぞれのモードの長所を述べる形に改めました。直接接続は最もネイティブ、ルーティングはプロバイダーのホットスイッチができ、フェイルオーバーとフォーマット変換に対応、集約はクライアント内で複数のプロバイダーのモデルをシームレスに切り替えられます。使用量ページの表の列はすべて左揃えにし、リクエストログではプロバイダーとモデルの 2 列の幅を少し減らして数値の列に回しました。日本語の画面では「高級オプション」を「詳細オプション」に改めました。
## アップグレードに関する注意
**データベースの構造は変わっていません。** バージョンは 20 のままです。
- すでにルーティングモードで Claude Code を使っている場合、アップグレード後に CC Switch を起動すると新しい haiku のエイリアスが `settings.json` に書き込まれ、新しく開いた Claude Code のセッションから使われます。
- Codex のセッションの移行は CC Switch の起動時に自動で行われ、Codex の設定ディレクトリごとに 1 回だけです。変更前のセッション記録は、既存のセッショングループ移行用のバックアップディレクトリに保存されます。`cc-switch-official` テーブルを手動で復元していて、まだ使っている場合、この移行はスキップされます。
- 新しいプリセットは新しく追加するプロバイダーにだけ影響します。
---
## 謝辞
[@funkpopo](https://github.com/funkpopo)(OpenRouter の残高がゼロのときにプラン期限切れと表示される問題、Codex で途中でモデルを変えた後に使用量が誤ったモデルで記録される問題)、[@hulkbig](https://github.com/hulkbig)(設定の自動保存で未確定のディレクトリまで保存される問題)、[@NestorRay](https://github.com/NestorRay)(Windows でプロバイダーのページを開くときのちらつき)の貢献に感謝します。
問題の報告、再現情報の提供、検証に協力してくださった [@hao-lin-lwh](https://github.com/hao-lin-lwh)、[@desmonna](https://github.com/desmonna)、[@mossonli](https://github.com/mossonli)、[@enderzcx](https://github.com/enderzcx)、[@nbcoming](https://github.com/nbcoming)、[@liyangdeamo-svg](https://github.com/liyangdeamo-svg)、[@linhay](https://github.com/linhay)、[@aofee](https://github.com/aofee) に感謝します。
技術的な詳細は [CHANGELOG](https://github.com/farion1231/cc-switch/blob/main/CHANGELOG.md) をご覧ください。
+71
View File
@@ -0,0 +1,71 @@
# CC Switch v4.0.10
### 4.0 正式版的第六个修复版本
这一版的重点是一键导入链接(`ccswitch://` 深度链接):CC Switch 没在运行时点链接不会再丢;链接可以声明接口格式、导入 Pi 供应商、带上网站自己的图标;Codex 和 Grok Build 的链接保留供应商自带的配置,不再被换成固定模板;确认框里可以选导入后是否立即切换。同时发布了中、英、日三语的站长接入指南和在线链接生成器。供应商图标现在可以上传本地图片,存进「我的图标」后所有供应商都能选用;用量页新增首字时间,没开路由也能按会话日志估算。另外修复了路由模式下 Claude Code 的 haiku 档请求被要求思考的上游拒绝、v3.20 及更早用官方账号走路由留下的 Codex 会话打不开、Grok Build 第三方供应商生成不了会话标题等问题。4.0 完整的更新内容请见 [v4.0 发布说明](https://github.com/farion1231/cc-switch/blob/main/docs/release-notes/v4.0.4-zh.md)。
---
## 一键导入链接
### 用户能感受到的变化
- **CC Switch 没在运行时点链接,不会再丢。** 以前在 Windows 和 Linux 上,CC Switch 没开着时点一键导入链接,应用会启动,但导入确认框不出现;轻量模式下窗口重建时也会丢。macOS 上同一个链接会弹两次确认框。现在链接会先存下来,确认框显示出来之后才算处理完,中途被打断也不会丢,后到的旧链接也不会盖掉新链接。
- **确认框里可以选导入后是否立即切换。** 供应商链接的确认框新增「导入后立即切换到这个供应商」开关,默认关闭,打开时会提示客户端请求将改发到链接里的地址。OpenCode、OpenClaw、Hermes、MiniMax Code 这类共存式应用是「导入后立即添加到 OpenCode 配置」这样的开关,Pi 是「导入后立即在 Pi 中启用」,这两类默认打开;提示词是「导入后立即启用」。链接里的 `enabled` 只决定开关的初始状态。关掉开关就只保存供应商,不改客户端配置,即使这是该应用的第一个供应商。
- **带用量查询脚本的链接,导入后默认开启用量查询。** 站长在链接里附上脚本,就是想让你导入后直接看到余额,以前还要再手动打开一次。链接写了 `usageEnabled=false` 时仍然关闭;不带脚本的链接和以前一样。脚本在沙箱里运行,只能向供应商地址的同源 HTTPS 发一次请求,确认框里照常完整显示脚本内容。
- **Codex 链接保留供应商自带的配置。** 链接带完整 `config.toml` 时,以前只取出 Key、地址和模型,再套进固定模板,供应商的认证方式、请求头、WebSocket 支持和模型目录地址都会丢。现在保留其中属于这个供应商的部分:连接和认证字段、模型、推理强度、上下文窗口、子代理模型等;模型目录地址只在和接口地址同源时保留,因为 Codex 拉取它时会带上供应商的凭据。`[features]`、MCP、权限这类全局设置不导入。会让 Codex 执行命令或读取本机凭据的供应商配置(`auth`、`aws`、`gateway_oauth`、`env_http_headers`)整条拒绝。不带配置的链接导入结果和以前逐字一致。
- **Grok Build 链接保留模型配置。** 带 `config.toml` 的链接以前也会被换成固定模板,丢掉显示名、说明、接口类型和上下文窗口。现在保留 `[models] default` 指向的那张模型表,地址、Key 和模型仍以链接参数为准;用到 `auth_provider`、`env_http_headers`、`mtls_cert_dir` 的链接会被拒绝。一个供应商在 Grok Build 里只占一张表,所以其他模型表不导入。
- **会被展开执行的值一律拒绝。** 共存式应用会展开配置里的一些特殊写法:Pi 里以 `!` 开头的值会被当成命令执行,`$NAME` / `${NAME}` 会读环境变量;OpenCode 有 `{env:}` / `{file:}`;OpenClaw 和 Hermes 有 `${...}`。链接里出现这些写法时,可能执行命令,或者把本机的密钥和文件内容发到链接里的地址。现在解析链接、合并配置和生成供应商时都会检查,发现就拒绝导入。
- **其他:** 带 `configUrl` 的链接现在一打开就提示不支持,不会等你确认后才失败;提示词链接支持 MiniMax Code,MCP 链接支持 Pi 和 MiniMax Code;导入供应商后托盘菜单会立即刷新。
### 站长能用的新参数
- **`apiFormat`:** 一个参数声明上游的接口格式(`anthropic` / `openai_chat` / `openai_responses` / `gemini_native`),CC Switch 会换成各应用自己的字段。Claude Code、Codex、Grok Build 的非原生格式需要开启本地路由;应用不支持的组合在解析时就会被拒绝。不带这个参数的链接行为不变。
- **Pi 供应商链接:** 新增支持,导入后写进 Pi 的 `models.json`,链接必须带模型。
- **`iconUrl`:** 填网站自己 logo 的 https 地址。确认框打开时就下载并显示在顶部,导入后作为卡片的自定义图标;下载失败不影响导入,卡片退回内置图标或名称首字母。图片会重绘成小尺寸 PNG 保存,地址本身不保存也不渲染。下载时只连公网地址,并锁定解析结果,防止第二次 DNS 解析指向别处;重定向逐跳检查,最多 3 跳。不走系统代理、不带 Cookie,5 秒超时,最大 256 KB,文件类型必须和内容一致。
### 站长接入指南和在线生成器
- **[站长接入指南](https://github.com/farion1231/cc-switch/blob/main/docs/guides/deeplink-site-integration-guide-zh.md)**(另有 [English](https://github.com/farion1231/cc-switch/blob/main/docs/guides/deeplink-site-integration-guide-en.md)、[日本語](https://github.com/farion1231/cc-switch/blob/main/docs/guides/deeplink-site-integration-guide-ja.md)):怎么生成链接、怎么在页面上放「一键导入」按钮(点按钮时再向后端取链接,Key 不会出现在页面源码里)、用户没装 CC Switch 时显示什么、怎么附上用量查询脚本。用 New API 或 Sub2API 搭的站,Key 列表里已经自带「导入到 CC Switch」按钮;区别是 New API 的链接不带用量查询脚本,用户导入后看不到余额。
- **[在线链接生成器](https://ccswitch.io/deplink.html)**:从测试页改成给站长用的生成器,分供应商、MCP、提示词、Skill 四类,按应用列出可选的 `apiFormat`,内置用量脚本模板,填 `icon` / `iconUrl` 时按应用内同样的规则检查。用户手册里原来的生成器链接指向一个从没开通的 GitHub Pages 地址,打开是 404,现在手册和 README 都改指这里。
## 新增
**供应商图标可以上传本地图片,存进「我的图标」反复使用。** 图标选择器分成「我的图标」和「内置图标」两组,搜索框同时筛两组。点「我的图标」第一格的「上传」,选一张 PNG、JPG、WebP 或 SVG(不超过 2 MB),起个名字(默认是文件名)就存进「我的图标」并用在当前供应商上;以后其他供应商、其他应用都能直接选,不用再传一次,重复上传同一张图会复用已有的那条。鼠标移到图标上可以重命名或删除;卡片保存的是图片本身,所以重命名、删除都不影响已经在用它的供应商。图片会缩成 96×96 的 PNG,「我的图标」和供应商配置都随云同步带走,不在磁盘上另存文件;SVG 会先转成位图,里面的脚本和外部请求都不会执行,原始文件不进数据库。一键导入链接带来的网站图标会以「当前图标」显示,可以存进「我的图标」。选择器现在点一下图标就选好并关闭,去掉图标点搜索框旁的「清除图标」。
**用量页显示首字时间。** 路由服务一直记录首字时间,以前只在悬停提示和请求详情里能看到。现在供应商统计和模型统计新增「首字」列,取经路由服务的成功流式请求的中位数,偶尔排队、冷启动的慢请求不会把它拉高;请求日志在「速度」后面也加了「首字」列。没开路由时,按会话日志的时间戳估算,带 ≈ 显示:Claude Code 看以思考开头的回复,Codex 看较新版本写入的时间戳;以正文或工具调用开头的回复没有估算值。升级前导入的记录不补算。
**用量查询新增 Sub2API 模板。** 「配置用量查询」的模板里新增 Sub2API,只需要供应商的 Key 和地址,地址带不带 `/v1` 都行;会显示套餐名,额度不限的订阅不再显示成负余额。
**新增预设:** NekoCode(Claude Code、Claude Desktop、Codex、OpenCode、OpenClaw、Hermes、Pi,MiniMax Code 沿用 Pi 预设)。YYLX 在中文界面显示为「鱼鱼连线」(繁体中文为「魚魚連線」)。
## 修复
- **路由模式下 Claude Code 的 haiku 档请求被上游拒绝**([#8118](https://github.com/farion1231/cc-switch/issues/8118))。路由模式往 `settings.json` 里写的是固定的模型别名,Claude Code 按别名决定怎么发思考参数。haiku 档以前写的是 `claude-haiku-4-5`,Claude Code 认为这个模型可以关思考,就发出关闭思考的请求,要求必须开思考的上游会直接拒绝。现在改成 `claude-haiku-5-5`,和 sonnet、opus 档的发法一致。路由本身仍按「haiku」关键词映射,选到哪个模型不变。
- **v3.20 及更早用官方账号走路由留下的 Codex 会话打不开**([#7948](https://github.com/farion1231/cc-switch/issues/7948))。v3.17 到 v3.20 用官方账号走本地路由时,Codex 把会话记在 `cc-switch-official` 名下;v4.0 不再写这张表,Codex 恢复这些会话时就会报「Model provider `cc-switch-official` not found」。现在 CC Switch 启动时会把它们移回 Codex 内置的 `openai` 分组,只改会话记录,不碰 `config.toml`。这些会话本来就用官方登录,Codex 也一直把它们当 OpenAI 处理,移动后行为不变。
- **Grok Build 用第三方供应商时生成不了会话标题**([#7003](https://github.com/farion1231/cc-switch/issues/7003))。没设 `models.session_summary` 时,Grok Build 用内置的 `grok-4.6` 生成标题,却把请求发到默认模型表的地址,第三方上游会拒绝。现在切换供应商时,`session_summary` 在没设或指向 CC Switch 写的表时会跟着指向当前供应商,切回官方账号时删掉;你自己设的内置模型或自己的表保持不动。
- **OpenRouter、Novita 余额为零时卡片显示「套餐已过期」**([#8148](https://github.com/farion1231/cc-switch/issues/8148))。余额为零或为负时,Key 其实还能用,卡片和托盘却显示套餐已过期。现在显示「余额已用完」;接口返回缺失或格式不对的余额时报错,不再当成零余额。
- **Codex 中途换模型后,用量记在了原来的模型上。** Codex 在线程设置里换模型时,日志里不一定会写新的轮次上下文,用量导入以前会把之后的请求记在上一个模型名下(没有更早记录时记成 `unknown`),价格也按原模型算。现在会读取这条设置。已经导入的记录不会自动改写,源会话日志还在的话,可以在用量页的「数据来源」里点「重建 Codex 用量」(重建前会自动备份数据库)。
- **在设置里改了配置目录、还没点保存,改另一项设置时目录也被保存了**([#7849](https://github.com/farion1231/cc-switch/issues/7849))。其他设置自动保存时,现在只会带上已确认的目录;被放弃的草稿也不会再留在输入框里。
- **Windows 上打开添加或编辑供应商页面时窗口闪一下。** v4.0.9 修了编辑页先显示加载页的问题,但整页的淡入淡出在 Windows 上仍会闪。现在这两个页面不再做淡入淡出,其他页面不受影响。
- **Windows 上删掉的桌面快捷方式,每次更新都会被装回来。** MSI 升级会先卸载旧版再完整安装新版,以前每次都会重新创建桌面快捷方式。现在只在全新安装时创建;升级时只有原来的快捷方式还在才保留。
**其他:** 「连接模式」的说明改为先讲每种模式的长处:直连最原生,路由可热切换供应商、支持故障转移和格式转换,聚合可在客户端内无缝切换多家模型。用量页的所有表格列统一左对齐,请求日志里供应商和模型两列让出一些宽度给数字列。日文界面把「高級オプション」改为「詳細オプション」。
## 升级说明
**数据库结构没有变化**,仍然是 20。
- 已经在用路由模式的 Claude Code,升级后启动 CC Switch 时会把新的 haiku 别名写进 `settings.json`,新开的 Claude Code 会话会用上。
- Codex 会话的迁移在 CC Switch 启动时自动进行,每个 Codex 配置目录只做一次,改动前的会话记录备份在原有的会话分组迁移备份目录。如果你手动恢复过 `cc-switch-official` 表并且仍在使用,这次迁移会跳过。
- 新增预设只影响新添加的供应商。
---
## 致谢
感谢 [@funkpopo](https://github.com/funkpopo)(OpenRouter 余额为零时显示套餐已过期、Codex 中途换模型后用量记错模型)、[@hulkbig](https://github.com/hulkbig)(设置自动保存时带上未确认的目录)、[@NestorRay](https://github.com/NestorRay)(Windows 上打开供应商页面时的闪烁)的贡献。
感谢 [@hao-lin-lwh](https://github.com/hao-lin-lwh)、[@desmonna](https://github.com/desmonna)、[@mossonli](https://github.com/mossonli)、[@enderzcx](https://github.com/enderzcx)、[@nbcoming](https://github.com/nbcoming)、[@liyangdeamo-svg](https://github.com/liyangdeamo-svg)、[@linhay](https://github.com/linhay)、[@aofee](https://github.com/aofee) 报告问题、提供复现信息和帮忙验证。
完整的技术细节请见 [CHANGELOG](https://github.com/farion1231/cc-switch/blob/main/CHANGELOG.md)。
+33
View File
@@ -0,0 +1,33 @@
{
"version": "4.0.10",
"items": [
{
"type": "new",
"zh": "供应商图标可以上传本地图片,存进「我的图标」反复使用",
"zh-TW": "供應商圖示可以上傳本機圖片,存進「我的圖示」重複使用",
"en": "Upload your own provider icons and reuse them from My Icons",
"ja": "プロバイダーのアイコンに画像をアップロードし、「マイアイコン」から使い回せるように"
},
{
"type": "improve",
"zh": "一键导入链接不再丢失,导入时可选是否立即切换",
"zh-TW": "一鍵匯入連結不再遺失,匯入時可選擇是否立即切換",
"en": "Import links are no longer lost, and you choose whether to switch right after importing",
"ja": "インポートリンクが失われなくなり、インポート後すぐに切り替えるかを選べるように"
},
{
"type": "new",
"zh": "用量页显示首字时间,没开路由也能估算",
"zh-TW": "用量頁顯示首字時間,沒開路由也能估算",
"en": "The usage page shows first-token time, estimated even without routing",
"ja": "使用量ページに最初のトークンまでの時間を表示(ルーティングなしでも推定)"
},
{
"type": "fix",
"zh": "路由模式下 Claude Code 的 haiku 档请求不再被上游拒绝",
"zh-TW": "路由模式下 Claude Code 的 haiku 檔請求不再被上游拒絕",
"en": "Routed Claude Code haiku-tier requests are no longer rejected by upstreams",
"ja": "ルーティング時に Claude Code の haiku 枠のリクエストが上流で拒否されないように"
}
]
}