[KongchangAI]
· 4 min read· 2,161 words

One Key, A Dozen LLMs: Switching Models in VS Code Chat in Practice

One Key, A Dozen LLMs: Switching Models in VS Code Chat in Practice

The Modelflare extension aggregates multiple vendors' models into the VS Code model picker, enabling zero-cost switching with one Smart API Key.

This article discusses the fragmentation developers face when using multiple models in VS Code: scattered configurations, split keys and billing, and high switching costs. Modelflare for VS Code registers as a language model provider for VS Code Chat, putting a dozen-plus text models your account can access into the native model picker, so users can switch between gemini-3.5-flash, claude-opus-5-5, gpt-6.1-sol, and others with a single Smart API Key. The Smart API Key binds to auto routing: on each request it collects available groups, filters for groups with channels, sorts by the Balanced/Stability/Low price policy, and falls through in order. The article also covers installation and configuration steps, a three-model collaborative workflow, and troubleshooting advice.

The Model Selection Dilemma in VS Code

Most developers stopped using just one model a long time ago. Renaming a variable only warrants a fast, cheap model; a complex refactor justifies the price of a frontier model; and for reviewing a migration plan, you might trust a third model entirely. The problem is that these three models often hide behind their own extensions, accounts, and keys.

The cost of this fragmentation is real. Configurations scatter everywhere; three providers mean three keys, three billing dashboards, three sets of rate limits. The switching cost is so high that people give up switching altogether—so you end up paying frontier-model prices to rename a variable. When a new model drops, you have to wait for an extension update or manually edit configs. And when one provider goes down, the chat panel just throws an error.

VS Code already has the right UI for this—the chat model picker. What it lacks is a provider that can fill that picker with models from multiple vendors. According to Modelflare's official README, its VS Code extension is designed for exactly this: a single Smart API Key that puts every text model your account can access into one dropdown. Based on hands-on feedback from several developer channels on Bilibili and YouTube, this "single key, multiple models" approach is becoming the mainstream way to handle BYOK (Bring Your Own Key) workflows.

BYOK (Bring Your Own Key) is an integration paradigm that has become popular in AI toolchains in recent years: the application itself doesn't bundle or resell model access. Instead, users supply their own API key from a provider, and the application simply forwards requests. For vendors, this sidesteps the compliance and billing complexity of resale; for developers, the benefit is bypassing subscription lock-in—for example, using BYOK models in VS Code to drive the Chat panel without a Copilot subscription. The trade-off is that key management, scattered billing, and separate rate limits shift to the user. This is precisely why consolidating multiple vendors' keys behind a single gateway has become a key direction for BYOK workflow evolution.

What the Modelflare Extension Does

Modelflare for VS Code registers itself as a language model provider for VS Code Chat. The core mechanism isn't complicated:

  • It fetches the text models available to your key via GET /v1/models, so new models can go live without changing your key;
  • Responses support streaming, and tool calling works for agent mode;
  • Cross-group routing, fallback, and routing policies are all handled server-side by the Smart API Key;
  • The key is stored in VS Code's secret storage and never appears in settings.json;
  • Fully BYOK—using BYOK models requires no Copilot subscription.

The extension ID is modelflare.modelflare-vscode and requires VS Code 1.104 or newer.

The Modelflare VS Code extension's interface in the chat model picker

VS Code Chat's Language Model Provider is an extension API capability introduced after VS Code 1.90. It lets third-party extensions plug into the chat model picker, register callable models in the dropdown, and implement streaming responses and tool-calling interfaces. For users, models registered by these extensions behave identically to built-in models: they appear in the picker, support agent mode, and go through the chat panel's context management. This means "multi-vendor aggregation" no longer requires vendors' own sidebars or standalone panels—it converges on the editor's native model selection entry point.

Tool calling refers to a model's ability, beyond generating text, to output a structured request to "invoke a tool/function with arguments," which the host program executes and then feeds the result back to the model to form a multi-turn loop. It's the foundation for agent mode to read files, edit code, and run commands. So whether a model provider supports tool calling directly determines whether it can participate in agent workflows, not just chat Q&A.

Core Mechanism: The Smart API Key

The key to "one key" is the Smart API Key. A regular Modelflare key is bound to a single route group and can only call models in that group; a Smart API Key is bound to auto, and on each request the server will:

  1. Collect all route groups available to your account;
  2. Keep the groups that currently have channels for the models you need;
  3. Sort them by key policy;
  4. Send to the first candidate, and if that group's channels are exhausted, fall through to the next.

This means models served by only one group remain available, and temporarily unavailable groups get skipped rather than failing the chat.

Creating one is straightforward: register or log into the console, go to API Keys → Create Smart API Key, then choose a routing policy.

PolicyCandidate group order
Balanced (default)Starts from the middle of the price range, goes up to the most expensive candidate, then falls back to cheaper ones
Stability firstPrioritizes the group with the highest multiplier
Low price firstPrioritizes the group with the lowest multiplier

The policy can be changed on an existing key at any time and takes effect on the next request. Quotas, expiration, and IP allowlists work the same as with other keys.

Route groups and group multipliers are a common billing abstraction in aggregation gateways. The same upstream model may correspond to multiple source channels, each with different costs, stability, and concurrency limits. The gateway groups them and uses a "multiplier" to represent a billing coefficient relative to a baseline price—a higher multiplier typically means higher channel cost or better stability. Regular keys are bound to a fixed group and can only call models covered by that group; a Smart API Key is bound to auto, deferring the group decision to request time, thereby dynamically balancing "model availability" against "cost/stability preference." This also explains why policies sorted by price or stability can take effect by changing only the key config without touching code.

Installation and Configuration Steps

Search for Modelflare in the Extensions view of the VS Code Marketplace, or install it from the terminal:

code --install-extension modelflare.modelflare-vscode

The extension is also published on Open VSX for compatible builds like VSCodium, with the same requirement of VS Code 1.104 or newer.

Early adopters should note one gotcha: version 0.1.0 used the ID modelflare.modelflare, changed to modelflare.modelflare-vscode starting with 0.1.1. Commands and settings didn't change, but VS Code stores keys by extension ID, so if you installed 0.1.0, you'll need to run Manage Modelflare API Key once after updating to re-enter it.

There are two ways to add a key: open the chat model picker → Manage Models → Modelflare, or run Modelflare: Manage Modelflare API Key from the Command Palette. After pasting your Smart API Key, it goes into VS Code secret storage, and you can pick models from the picker.

The extension has only one setting: modelflare.baseUrl. The default value global points to https://modelflare.dev/v1; china points to https://origin.modelflare.dev/v1; you can also enter a custom URL. Most people won't need to touch it.

Hands-On Example: Three Models, One Task

To illustrate why switching matters, here's a real workflow using a small TypeScript service. All three models are selected from the same dropdown with the same key—no need to leave the chat panel.

Step one: explore with a fast model. Select gemini-3.5-flash and type: "Summarize what src/billing/ does, and list all the places that compute rounded prices." Cheap, fast, and enough to get a handle on a folder.

Step two: refactor in agent mode with a frontier model. Switch the picker to claude-opus-5-5, switch chat to agent mode, and type: "Extract the rounding logic you found into src/billing/round.ts, update all callers, and add unit tests." This is where streaming plus tool calling pays off: the model reads files, proposes edits, and completes the whole changeset the way agent mode usually does.

Step three: get a second opinion. Switch to gpt-6.1-sol and type: "Review the diff in the workspace, paying attention to behavior changes in rounding at .5 boundaries." Having another model family review the previous one's output catches a surprising number of edge cases.

Three vendors, one key, one bill. All requests show up in usage logs, billed at the multiplier of the group that actually served them, with the log recording the resolved group and policy.

Below are the IDs of a dozen-plus text models that were both in the live catalog that day and present in a Smart API Key's GET /v1/models response, as a snapshot reference:

FamilyExample IDs
OpenAI GPTgpt-6.1-sol, gpt-6-sol, gpt-5.5
Anthropic Claudeclaude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5
Google Geminigemini-3.8-flash, gemini-3.5-flash, gemini-3.1-pro-preview
xAI Grokgrok-4.7
DeepSeekAddeepseek-v4-pro, deepseek-v4-flash
Otherskimi-k3, glm-5.3, qwen3.8-max

This is just a snapshot. Your picker is the source of truth for your account; check the Models & Pricing page for prices.

Practical Tips and Troubleshooting

Refresh after releases. When new models go live, run Modelflare: Refresh Modelflare Models. The key itself doesn't need changing, because Smart API Keys have no per-model allowlist and always follow your account's current permissions.

Use policies, not a second key. If you want side projects to default cheaper and work to be more stable, just change the policy, or create two Smart API Keys with different policies. No vendor-specific keys needed.

Don't build your own fallback list. The Smart API Key already iterates over all groups available to your account. Ordered fallback chains are a feature of regular keys.

Choose models by task, not by day. The cost gap between flash-class models and frontier models is large. Defaulting to fast models and only upgrading on hard steps is exactly what makes this setup turn "cheap switching" into a habit.

Read error messages literally.

  • 401: key missing or invalid—create a Smart API Key at modelflare.dev/keys;
  • model_not_found: a regular key can only call models in its own group; if you're already using a Smart API Key, this means the model is currently unavailable to your account;
  • 403 insufficient_user_quota: top up at modelflare.dev/billing.

Slow model list loading in mainland China? Set modelflare.baseUrl to china. Since 0.1.2, the extension's public catalog request falls back to the key's own model list after an 8-second timeout, so the picker no longer gets stuck.

Also want images and video? The VS Code extension only covers text models. For media generation in an agent, see the Media Skill or the @modelflare/mcp-server package.

The division of labor between HTTP status codes and gateway error codes is worth noting: 401 is a transport-layer authentication failure, typically meaning the key is missing, misspelled, or revoked; while underscore-delimited identifiers like model_not_found and insufficient_user_quota are business error codes returned by the gateway after authentication passes, with finer-grained semantics. When troubleshooting, first look at the status code to determine the problem layer, then read the error code to pinpoint the specific cause—this avoids misdiagnosing a quota issue as a key issue. Also, VS Code's secret storage is OS-level encrypted storage, separate from ordinary settings files, so keys won't be synced with workspace configs or committed to version control—especially important when collaborating across multiple devices.

What This Integration Model Means

The model picker has always been the right place to choose models. Putting a dozen-plus models behind one key essentially erases "switching cost" from the process. When the marginal cost of switching models approaches zero, developers will genuinely choose at task granularity, rather than being locked into a single model—one that isn't necessarily the right fit—just because configuring things is a hassle.

For BYOK workflows, the division of labor between server-side routing and a lightweight client extension is also worth attention: the client only handles presentation and transport, while routing policies, fallback, and billing resolution all sink into the gateway. This avoids scattered configurations and gives key security boundaries clearer definition.

One-line Summary

The Modelflare extension aggregates multiple vendors' models into the VS Code model picker, enabling zero-cost switching with a single Smart API Key.

Paragraph Summary

This article discusses the fragmentation developers face when using multiple models in VS Code: scattered configurations, split keys and billing, and high switching costs. Modelflare for VS Code registers as a language model provider for VS Code Chat, putting a dozen-plus text models your account can access into the native model picker, so users can switch between gemini-3.5-flash, claude-opus-5-5, gpt-6.1-sol, and others with a single Smart API Key. The Smart API Key binds to auto routing: on each request it collects available groups, filters for groups with channels, sorts by the Balanced/Stability/Low price policy, and falls through in order. The extension supports streaming and tool calling, stores keys in secret storage, and works for BYOK models without a Copilot subscription. The article also covers installation and configuration steps, a three-model collaborative workflow, and troubleshooting advice for issues like 401, model_not_found, insufficient quota, and slow loading in mainland China.

#VS Code extension#LLM model picker#Smart API Key#BYOK#Modelflare#AI coding workflow
Share:

Related articles