AI Account Manager CloudyWing
Install AI Account Manager with WinGet
winget install --id=CloudyWing.AiAccountManager -e Desktop tool for managing AI service accounts and usage.
winget install --id=CloudyWing.AiAccountManager -e Desktop tool for managing AI service accounts and usage.
我訂了多個 AI 帳號,為了更換帳號方便和控管額度,會需要一些第三方工具。
雖然很多人有寫相應的開源工具,但我需要的功能散布在不同工具裡,而我 Claude Code 和 Codex 都有在使用。別人寫的工具有些對我來說有點不足,有些則是有很多功能用不到,反而讓操作過於複雜。
後來想想,都 AI 時代了,自己需要的工具,讓 AI 幫我產生一個客製化版本就好。
Windows x64 桌面應用程式,以 WPF 承載 Blazor Hybrid 與 MudBlazor。提供 Claude 與 Codex 的帳號快速切換、額度顯示,以及 Claude 切換帳號時的 Code Session 索引同步。
> [!WARNING] > 本專案為個人專案,功能依我自己的使用情境設計。帳號切換與額度查詢依賴 Claude Desktop、Codex Desktop 的本機檔案格式與非公開 API,官方更新後可能失效。
安裝器會處理 Microsoft Edge WebView2 Evergreen Runtime,程式啟動時仍會檢查 Runtime。產品使用目前 Windows 使用者的 DPAPI 保護本機 identity key;Codex OAuth token 由隔離 profile 的 Codex app-server/keyring 管理,不寫入產品 JSON 檔。
從 GitHub Releases 下載 ai-account-manager-win-Setup.exe 執行即可。安裝目錄為 %LOCALAPPDATA%\ai-account-manager\current,使用者資料獨立保存於 %LOCALAPPDATA%\AiAccountManager\data,解除安裝與升級都不影響該資料目錄。
也可以用 WinGet 安裝:
winget install CloudyWing.AiAccountManager
每次發佈正式版時,release workflow 會自動把 manifest 以 PR 提交至 microsoft/winget-pkgs。PR 經 winget-pkgs 審核合併後,該版本才能用上述命令安裝;審核期間請改用 GitHub Releases 的安裝檔。以本機 manifest 安裝的步驟見 docs/packaging.md。
在 Windows PowerShell 執行:
$env:NUGET_PACKAGES = Join-Path $env:LOCALAPPDATA 'AiAccountManager\NuGet'
$env:DOTNET_CLI_HOME = Join-Path (Get-Location).Path '.local\dotnet-home'
$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1'
$env:DOTNET_NOLOGO = '1'
dotnet restore .\AiAccountManager.slnx
dotnet build .\AiAccountManager.slnx -c Release --no-restore
dotnet test .\tests\AiAccountManager.Tests\AiAccountManager.Tests.csproj -c Release --no-build --no-restore
dotnet test .\tests\AiAccountManager.Components.Tests\AiAccountManager.Components.Tests.csproj -c Release --no-build --no-restore
測試專案分工:
AiAccountManager.Tests:Application、Windows 介面卡與頁面靜態渲染測試。AiAccountManager.Components.Tests:以 bUnit 驗證 Razor 元件的點擊、輸入與 callback 行為。AiAccountManager.UiTests:以 FlaUI 啟動實際的桌面程式,驗證主視窗、WebView2 內容與頁面導覽;測試分類為 UI。UI 測試需要互動式 Windows 桌面與 WebView2 Runtime,並會啟動與測試相同組態建置的 Desktop 執行檔。程式以 --data-root 指向暫存目錄,不讀寫 %LOCALAPPDATA%\AiAccountManager\data;但仍會讀取本機 Claude Desktop 與 Codex 的安裝與登入狀態。程式採單一執行個體,執行 UI 測試前請先結束正在執行的 AI 帳號管理工具,否則測試會略過。
dotnet test .\tests\AiAccountManager.UiTests\AiAccountManager.UiTests.csproj -c Release --no-build --no-restore
若要測試其他位置的執行檔,可設定 AIACCOUNTMANAGER_DESKTOP_EXE 環境變數指定完整路徑。執行整個方案的測試時,可用 --filter "TestCategory!=UI" 排除 UI 測試。
所有驗證與 packaging 命令需在 Windows 執行。細節見 docs/packaging.md。
Codex Desktop 的 %USERPROFILE%\.codex\auth.json 只在使用者保存登入或執行帳號切換時讀寫。切換會先正常關閉 Codex Desktop,寫入目標帳號的登入快照並確認身分後再重新開啟;失敗時還原原本的登入。CODEX_HOME 路徑以 profile GUID 固定,刪除 profile 會先清除該隔離 home 的 keyring entry。
package-windows.ps1 需要本機的 app-server ZIP cache 與 Velopack CLI。Velopack CLI 以 dotnet local tool 宣告於 .config\dotnet-tools.json,腳本會先執行 dotnet tool restore 再呼叫 dotnet tool run vpk。app-server ZIP 預設讀取 repository .local 目錄,也可提供可攜參數:
pwsh -NoProfile -File .\scripts\package-windows.ps1 -Version 0.3.1 -AppServerZipPath .\.local\cache\codex-app-server\rust-v0.162.1\codex-app-server-x86_64-pc-windows-msvc.exe.zip
需要改用其他位置的 vpk.exe 時,以 -VpkToolPath 指定。
輸出包含 artifacts\releases\ai-account-manager-win-Setup.exe、Velopack .nupkg、releases.win.json、第三方 notices 與 SHA-256 manifest。驗證通過後會替換 artifacts\releases 與 outputs\first-release,不使用版本子目錄。封裝腳本不執行安裝器,也不發布更新 feed。
本專案以 MIT License 授權。
安裝套件內附的 OpenAI Codex app-server 以 Apache License 2.0 授權,未經修改直接散布,來源版本、SHA-256 與授權全文見 packaging/THIRD-PARTY-NOTICES.md。