APISwitch

kbkkb·kbkkb.APISwitch

Provider switcher and local routing gateway for AI coding assistants.

APISwitch is a lightweight desktop management tool and local protocol routing gateway for third-party API providers and Google Antigravity official subscriptions. It manages provider configurations for Google Antigravity, Claude Code, Claude Desktop, Codex, OpenCode, and Pi, switches Google accounts with credential snapshots, tracks quota usage, and bridges OpenAI/Anthropic protocols through a local gateway with hot reload. ✨ Key Features 1. Unified Multi-Tool Management & Zero-Intrusion Switching - Antigravity Quick Account Switching: Save credential snapshots and switch Google accounts with one click. Automatically captures and synchronizes the latest credentials before switching (preventing Refresh Token rotation expiration). Optionally auto-closes and smoothly restarts the IDE. - Cross-Client Provider Sharing: One-click copy of provider configurations across Claude CLI, Claude Desktop, Codex, OpenCode, and Pi with intelligent field mapping (Auth Token ↔ Bearer Token / API Key). Enter once, use everywhere. - Model Pool Management: Dedicated model pool mechanism for OpenCode and Pi, clearly distinguishing "In Config" from "Not in Config" states, supporting on-demand activation and batch maintenance. - One-Click cc-switch Migration: Built-in migration wizard directly reads ~/.cc-switch/cc-switch.db, allowing checkbox selection to import existing providers with automatic deduplication and overwriting. 2. Built-in Local Protocol Routing Gateway - High-Performance Local Gateway: Built-in lightweight HTTP gateway service (listening on 127.0.0.1:15725 by default, configurable Host and Port in settings, supports LAN sharing). - Seamless Multi-Protocol Bridging: - Codex Protocol Bridge: Translates standard OpenAI Chat Completions / Anthropic endpoints into Codex native Responses protocol. - Claude CLI Protocol Bridge: Automatically manages authentication headers and request format mapping. - Claude Desktop Model Mapping: Intercepts and rewrites claude-sonnet / opus / haiku requests to your designated upstream custom models. - Long-Context Protection & Prompt Stripping: Automatically strips non-essential excessive system prompts and provides safeguards against massive 1M context overflows to prevent upstream 400 errors or unexpected costs. - Zero-Restart Hot Reload: Point your client to the local gateway once. Provider switches reload instantly in the gateway with no client restarts needed. 3. Data Backup & Multi-Device Roaming - One-Click Full Export: Bundle all tool provider configurations and Antigravity account data into a standardized JSON backup file. - Flexible Restore Modes: Supports both "Merge & Append" (recommended: keeps existing configs while adding new or updating matching items) and "Full Overwrite" modes for seamless roaming across multiple machines. - Direct Local Management: One click to open the local physical storage directory for full data ownership and transparency. 🔬 How It Works - Google Antigravity: Login sessions are stored in VS Code's globalStorage SQLite database (ItemTable) under antigravityUnifiedStateSync.oauthToken and userStatus (base64-encoded Protobuf). APISwitch includes a lightweight Protobuf parser to safely extract email, subscription tier, and quota information. Account switching executes safe transactional writes with automatic .backup creation. - Claude Code CLI: Precisely rewrites ANTHROPIC_* environment variables in ~/.claude/settings.json, strictly preserving all other configuration sections such as hooks and permissions. - Claude Desktop: Manages Cowork inference gateway parameters (inferenceProvider, inferenceGatewayBaseUrl, inferenceGatewayApiKey, etc.). Switching back to "Official" cleanly removes these fields to restore native official login. - OpenAI Codex: Configures model_provider and [model_providers.<id>] in ~/.codex/config.toml, synchronizing authentication with auth.json. Supports direct upstream connections or routing through the local gateway for protocol adaptation. - OpenCode & Pi: Strictly adheres to their official specifications to read and write opencode.json and models.json / auth.json, ensuring immediate recognition by CLI and runtime environments. - Safe Atomic Writes: All file modifications follow a "write temporary file → verify integrity → atomic replace" workflow, generating automatic .bak backups to prevent corruption from unexpected interruptions.

winget install --id kbkkb.APISwitch --exact --source winget

Latest 0.3.8·December 1, 2026

Release Notes

[Fixes · Anti-Glitch Quota Reconciliation & Multi-Pod Rollout Guard]

  • Proto3 0.0 Omission Fix & Honest null Rendering: Fixed a bug where omitted remainingFraction fields on exhausted (0%) Proto3 payloads defaulted to 1.0 (100%). Removed Profile.cs fallback formatting that rendered null 5H quotas on Pro accounts as "100%", and prevented writing null fractions into quota_snapshots.
  • Cross-Endpoint Validation (Summary vs fetchAvailableModels): Added ApplyAntiGlitchAndRolloutGuard and standby-pool reconciliation—whenever an unscheduled summary response flashes 100% (or drops the 5H bucket) while fetchAvailableModels in the same refresh reports active remaining quota < 90%, the glitch is rejected and unexpired Pro 5H values are preserved.
  • Official Reset Rollout Bounce Suppression: After a pool legitimately enters a new reset epoch (e.g., an official early mass reset), stale-pod responses within a strict immutable 30-minute rollout window whose resetTime jumps backward by > 30m are ignored rather than bouncing the UI back to pre-reset percentages, while normal post-reset token burn and independent 5H resets remain unrestricted. [Fixes · Per-Account Attribution Isolation & Self-Healing (acctAttrVer=4)]
  • Authoritative Credential Manager Source & CLI Swap Guard: ReadCurrentAntigravityEmailFast now reads Windows Credential Manager (gemini:antigravity) first (<0.1ms), drops the cross-tool Gemini CLI fallback, and ignores non-IDE CLI turns missing an Antigravity brain directory. AgCliService activates an ag_cli_swap_guard.json lock during background account activations to prevent cross-account token misattribution.
  • Pre-Switch Flush & Quota Contradiction Healing: Flushes pending usage events immediately via ScanAntigravityQuick() before switching accounts, reconciles historical misattributions where quota drops occurred exclusively on another account, and upgrades ProfileStore writes with an in-process mutex and atomic .tmp replacement. [Fixes & Improvements · Weekly-Exhausted 5H Lockout & 100% Pure Per-Account Calibration]
  • Weekly Exhaustion Hard-Lock on 5H Pools: When the Gemini or Claude & GPT 7-day weekly base quota reaches 0%, the constrained 5H pool automatically locks to 0%, Weekly Exhausted, and ≈ $0.00 across MainWindow cards, the Floating Widget, tray menu, and Quota Insights, suppressing false 5H reset events while weekly quota remains exhausted.
  • 100% Pure Per-Account Real Calibration: Removed synthetic tier priors and cross-account cap pooling; each (account, bucket) cap is derived strictly from that account's own verified local spend divided by verified quota drops, filtering out off-PC zero-log quota drop steps and labeling untouched pools honestly as Pending Data. [New · Portable Cross-Device Antigravity Account Export & Import]
  • Batch Export & Per-Card Context Export: Added an Export JSON toolbar button and per-card right-click Export this account as JSON… action generating portable JSON bundles that restore full APISwitch metadata cleanly on another device while remaining compatible with Antigravity Tools import formats.
  • Flexible Multi-Format Account Import: Upgraded the toolbar import action to support selecting any .json backup (APISwitch bundles, Antigravity Tools arrays / accounts.json / .json, or single profile JSONs) in addition to one-click local Antigravity Tools import. [Reliability · Floating Widget Persistence, Fast Live Sync & Win32 Anti-Vanish Guard]
  • Persistent Enable State Across Restarts: Isolated host shutdown/closing from explicit user hiding so closing or restarting APISwitch never overwrites FloatingWidgetEnabled.
  • Real-Time .pb & Hook Activity Sync: Added conversations/*.pb and ag_hook_turns.jsonl watchers (1.5s debounce), 18s-throttled active-account quota polling when new token usage is detected, automatic due-reset refreshes, and non-blocking per-account incremental pushes.
  • Win32 Anti-Minimize, Z-Order & Multi-Monitor Self-Healing: Applied WS_EX_TOOLWINDOW, blocked accidental Win+M / SC_MINIMIZE hiding, handled WM_DISPLAYCHANGE / WM_DPICHANGED bounds clamping, and added a 5s focus-free (SWP_NOACTIVATE) watchdog that restores HWND_TOPMOST after Win+D, fullscreen switches, or off-screen wakes.

Installer type: inno

x64—2DC9B4BBF27D0E00537FC2AFB14F3ED2FE5AFF155008423CE43582D63379C93E

Details

Homepage
https://github.com/kbkkb/APISwitch
License
MIT
Publisher
kbkkb
Support
https://github.com/kbkkb/APISwitch/issues
Copyright
Copyright © 2026 kbkkb

Tags

aiapigatewayproxy

Older versions (6)

0.3.7
x64—BEC749212FF5BF283B8822B399CAA93B5F66A49213A809E41D9BE6E6805FA9A8
0.3.6
x64—615CB5E4D58474B241571A73EACDCFFC06BB8FF15B3FAAA05A97E8AB3D6A5E83
0.3.5
x64—A3A1E52CE0AEEAFC93803B4A6E10FDB02CC9D3E28F437010CE2B109142C5A872
0.3.4
x64—9641D0885BE3D2B0F25AE11A1F836E075917BE053D5DCA0F607BA02FD27965A6
0.3.3
x64—4B204AE67FC7E7D2E20460F32D6652CE27873C35A0E66CF7B5FEB098325A9AFC
0.3.2
x64—4DC4B5BADEADFC639EC74A5D1F37023084709671CDB2DD0106DE711F123EB58B