Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Claude Code Model SwitcherNew to Visual Studio Code? Get it now.
Claude Code Model Switcher

Claude Code Model Switcher

koupualen

|
3 installs
| (1) | Free
Quickly switch Claude Code API providers and models / 快速切换 Claude Code API 提供商
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Claude Code Model Switcher

A VS Code extension for managing and switching between multiple Claude Code API providers and models. Bilingual UI (English / 中文).


Table of Contents

  • Features
  • Usage Guide
    • Add Provider
    • Switch Provider
    • Sync from Claude Code
    • Import / Export
    • Auto Compact Window
    • Language Toggle
    • Status Bar
  • Settings Storage
  • Requirements
  • Changelog

Features

  • Multi-Provider Management — add, edit, delete multiple API provider configurations (DeepSeek, SiliconFlow, official, etc.)
  • One-Click Switching — activate any saved provider instantly via a button or status bar click
  • Sub-Model Auto-Fill — when setting the main model, sub-models (Opus / Sonnet / Haiku / Subagent) are auto-populated to match
  • API Key Visibility Toggle — show/hide token directly in the editor form
  • Sync from Claude Code — one button to read your existing ~/.claude/settings.json and auto-create matching provider configs
  • Import / Export — backup provider configurations as JSON and restore on any machine
  • Auto Compact Window — set effective context window (tokens) and compaction trigger percentage for per-model compression control. Overrides the 200K default fallback for third-party models
  • Bilingual UI — English / 中文, auto-detects VS Code language on first run
  • Status Bar Indicator — always visible in the bottom bar showing the currently active provider name

Usage Guide

Add Provider

  1. Click the icon in the Activity Bar to open the Provider Manager panel
  2. Click + Add New Provider
  3. Fill in the fields:
    • Name — a friendly label to identify this provider (e.g., deepseek, siliconflow-qwen)
    • Base URL — your API proxy or provider endpoint (e.g., https://api.deepseek.com/anthropic)
    • Auth Token — API key (use the eye icon to show/hide while typing)
    • Model — the main model name (e.g., deepseek-chat, qwen3.6-plus)
    • Sub-models — auto-filled from the main Model; you can override individually
      • Opus Model / Sonnet Model / Haiku Model / Subagent Model
    • Effort Level — optional (e.g., high)
    • Auto Compact Window — effective context window in tokens (e.g., 1000000). Overrides the 200K default fallback for third-party models
    • Auto Compact % — compaction trigger percentage, 1-100 (e.g., 75). Default ~95%. Lower = compact sooner
  4. If editing an active provider, click Save & Take Effect to save and apply immediately
  5. If editing an inactive provider, click Save to store only, or Save & Apply to store and switch

Switch Provider

  • From the Provider Panel: click Switch on any saved provider card to activate it
  • From the Status Bar: click the status bar item (e.g., ⚡ deepseek) to quickly switch between recent providers
  • The active provider is marked with a green Active badge on the card

Sync from Claude Code

This button reads your current ~/.claude/settings.json and intelligently syncs it into the extension's provider list:

Scenarios:

Situation What happens
settings.json doesn't exist Nothing happens (no warning popup)
settings.json exists but has no env or ANTHROPIC_MODEL Nothing happens (no warning popup)
Current config matches an existing provider (same Base URL + Auth Token + Model) Shows "Matched existing provider: xxx" — no duplicate created
Current config is new (doesn't match any saved provider) Creates a new provider automatically, named after the model (e.g., qwen3.6-plus)

Tip: Sync is useful when you've manually edited ~/.claude/settings.json outside the extension and want to pull those changes back into the Provider Manager.

Import / Export

Export:

  1. Click the Export button in the toolbar
  2. Choose a destination file location
  3. All saved providers are written as a JSON array to the selected file

Import:

  1. Click the Import button in the toolbar
  2. Select a previously exported JSON file
  3. Providers in the file are merged with your existing ones:
    • If a provider has the same name as an existing one, it is updated (replaced)
    • If a provider has a new name, it is added
  4. A notification shows how many providers were imported

Use case: backup your config before migrating to a new machine, or share provider configs with teammates.

Auto Compact Window

Claude Code auto-compacts the conversation when context usage approaches a threshold. For third-party models (DeepSeek, Qwen, etc.), Claude Code defaults to a 200K context window regardless of the model's actual capacity — causing compaction to fire too late and triggering "context length exceeded" errors. These two settings give you per-model control.

Two settings, one purpose:

Field Env Variable What it does
Auto Compact Window CLAUDE_CODE_AUTO_COMPACT_WINDOW Sets the effective context window in tokens. Overrides the 200K default fallback.
Auto Compact % CLAUDE_AUTOCOMPACT_PCT_OVERRIDE Sets the compaction trigger percentage (1-100). Default ~95%.

How they work together:

Compaction fires at = Auto Compact Window × Auto Compact %

Example: Window = 1000000, % = 70 → compaction at 700K tokens.

Why this matters for third-party models:

  • Without these vars, a 1M model (e.g., DeepSeek V4) gets treated as 200K, and compaction fires at ~167K — wasting the extra capacity
  • With Window = 1000000 and % = 70, you get predictable compaction at 700K

Sync behavior:
Both values are read and written directly with no transformation. What you see in the Provider Manager is exactly what goes into ~/.claude/settings.json.

Language Toggle

  • Click the language button in the toolbar (shows 中文 or English) to switch the UI language
  • The default language is auto-detected from VS Code's display language
  • You can also set the language permanently in VS Code Settings: Claude Code Model Switcher > Language

Status Bar

The status bar shows ⚡ <provider-name> when a provider is active, or ⚡ Not configured if nothing is set. Click it to open the Provider Manager.


Settings Storage

  • Provider configurations are stored in VS Code's global settings (~/.vscode/...)
  • Activating a provider writes environment variables to ~/.claude/settings.json
  • Claude Code reads ~/.claude/settings.json on every invocation, so changes take effect immediately

Requirements

  • Claude Code installed (npm i -g @anthropic-ai/claude-code) or the "Claude Code for VS Code" extension

中文说明

Claude Code Model Switcher 是一个 VS Code 扩展,用于管理并快速切换多个 Claude Code API 提供商和模型。

功能列表

  • 多 Provider 管理 — 添加、编辑、删除多个 API 提供商配置
  • 一键切换 — 通过面板按钮或状态栏快速激活指定 Provider
  • 子模型自动填充 — 设置主模型时自动填充 Opus / Sonnet / Haiku / Subagent 子模型
  • API Key 显示/隐藏 — 表单内直接切换 Token 可见性
  • 从 Claude Code 同步 — 一键读取 ~/.claude/settings.json 自动创建匹配的 Provider
  • 导入/导出 — 以 JSON 格式备份和恢复 Provider 配置
  • Auto Compact Window — 设置有效上下文窗口(tokens)和压缩触发百分比。覆盖第三方模型默认 200K 回退
  • 中英文双语界面 — 自动检测 VS Code 语言
  • 状态栏指示器 — 底部状态栏始终显示当前使用的 Provider

使用方法

添加 Provider

  1. 点击左侧活动栏图标打开 Provider 管理面板
  2. 点击 + 添加新 Provider
  3. 填写字段:
    • 名称 — 用于标识的标签(如 deepseek、siliconflow-qwen)
    • Base URL — API 代理或提供商地址
    • Auth Token — API 密钥(点击眼睛图标切换显示/隐藏)
    • Model — 主模型名称
    • 子模型 — 自动从主模型填充,可单独修改
    • Effort Level — 可选(如 high)
    • Auto Compact Window — 有效上下文窗口大小(tokens),如 1000000。覆盖第三方模型默认 200K 回退
    • Auto Compact % — 触发压缩的百分比(1-100),如 75。默认约 95%,越低越早压缩
  4. 编辑已启用的配置时,点击 保存并生效 直接保存并写入 settings.json
  5. 编辑未启用的配置时,点击 保存 仅存储,或 保存并切换 存储并切换

切换 Provider

  • 从面板:点击任意 Provider 卡片上的 切换 按钮
  • 从状态栏:点击底部状态栏(如 ⚡ deepseek)快速切换
  • 当前活跃的 Provider 会显示绿色的 当前使用中 标记

从 Claude Code 同步

同步按钮会读取 ~/.claude/settings.json 并智能同步到扩展的 Provider 列表中:

情况 行为
settings.json 不存在 无反应(不弹警告)
settings.json 存在但无 env 或 ANTHROPIC_MODEL 无反应(不弹警告)
当前配置已匹配现有 Provider(Base URL + Token + Model 相同) 提示"已匹配现有 Provider: xxx",不重复创建
当前配置是新的 自动创建新 Provider,以模型名命名

导入/导出

导出:点击导出按钮,选择保存路径,所有 Provider 以 JSON 数组写入文件

导入:选择 JSON 文件,按名称合并:

  • 同名 Provider → 覆盖更新
  • 新名 Provider → 新增

Auto Compact Window

Claude Code 在上下文接近阈值时会自动压缩。对于第三方模型(DeepSeek、Qwen 等),Claude Code 默认按 200K 上下文窗口计算,导致压缩触发太晚、频繁报"上下文超限"。这两个配置让你按模型精细控制。

两个配置,一个目标:

字段 环境变量 作用
Auto Compact Window CLAUDE_CODE_AUTO_COMPACT_WINDOW 有效上下文窗口大小(tokens)。覆盖默认 200K 回退
Auto Compact % CLAUDE_AUTOCOMPACT_PCT_OVERRIDE 触发压缩的百分比(1-100)。默认约 95%

配合使用:

压缩触发点 = Auto Compact Window × Auto Compact %

例如:Window = 1000000,% = 70 → 在 700K tokens 时压缩。

为什么对第三方模型重要:

  • 不设这两个变量,1M 模型(如 DeepSeek V4)被当作 200K 处理,压缩在 ~167K 就触发,浪费大量容量
  • 设 Window = 1000000、% = 70,可预测地在 700K 触发压缩

同步行为:
两个值均直接读取和写入,不做任何变换。面板显示的值就是写入 ~/.claude/settings.json 的值。

语言切换

点击工具栏的语言按钮(显示 中文 或 English)切换界面语言。默认跟随 VS Code 显示语言。

状态栏

状态栏显示 ⚡ <provider名称>(已激活)或 ⚡ 未配置(未设置)。点击可打开 Provider 管理器。

配置存储

  • Provider 配置存储在 VS Code 全局设置中
  • 激活 Provider 时写入 ~/.claude/settings.json
  • Claude Code 每次调用时读取该文件,更改即时生效

前置要求

  • 已安装 Claude Code(npm i -g @anthropic-ai/claude-code)或 "Claude Code for VS Code" 插件

Changelog

v0.2.0

  • New: Bilingual UI — English / 中文 with language toggle button. Auto-detects VS Code display language.
  • New: Sync from Claude Code — one-click button to read ~/.claude/settings.json and auto-create matching provider configs. Silently does nothing if no config exists.
  • New: Import / Export — backup provider configurations as JSON and restore on any machine. Import merges by name (existing providers are updated, new ones are added).
  • New: Auto Compact Window — set CLAUDE_CODE_AUTO_COMPACT_WINDOW (effective context window, overrides 200K fallback for third-party models) and CLAUDE_AUTOCOMPACT_PCT_OVERRIDE (trigger percentage). Values are written directly with no ratio transformation.
  • New: Save behavior — editing an active provider shows only "Save & Take Effect" (auto-applies to settings.json). Inactive providers keep "Save" / "Save & Apply" buttons.
  • New: Delete confirmation — deleting a provider now shows a confirmation dialog.
  • Removed: Auto-detection on startup — replaced by manual Sync button for better control.

v0.1.0

  • Initial release with multi-provider management, one-click switching, sub-model auto-fill, API key visibility toggle, and status bar indicator.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft