DEV Community

Magnus for Modelflare

Posted on

One Key, a Dozen-Plus Models: Switching LLMs in VS Code Chat with Modelflare

How to use the Modelflare VS Code extension to put every text model your account can reach into the VS Code chat model picker, behind a single Smart API Key.

Most developers no longer use one model. A fast, cheap model is fine for "rename this variable everywhere." A frontier model earns its price on a gnarly refactor. A third model is the one you trust for reviewing a migration. The problem is that each of those usually lives behind its own extension, its own account, and its own key.

That setup has real costs:

  • Configuration sprawl. Three providers means three keys in three places, three billing dashboards, and three sets of rate limits.
  • Switching is slow. If changing models means changing extensions, you stop doing it, and you end up paying frontier prices for trivial edits.
  • New models lag. Every release means waiting for a provider extension update or editing config by hand.
  • Outages are your problem. When one provider has a bad hour, the chat panel just errors.

VS Code already has the right UI for this: the chat model picker. What it needs is one provider that can fill that picker with models from many vendors. That is what the Modelflare extension does.

What the extension does

Modelflare for VS Code registers Modelflare as a language model provider for VS Code chat. According to its README:

  • Text models available to your key are loaded from GET /v1/models, so new models appear without editing the key.
  • Responses stream, and tool calling works for agent mode.
  • Routing across groups, fallback and the routing strategy are handled server-side by the Smart API Key.
  • The key lives in VS Code's secret storage, never in settings.json.
  • It is bring-your-own-key: no Copilot subscription is required for BYOK models.

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

Step 1: Create a Smart API Key

This is the piece that makes "one key" true. An ordinary Modelflare key is bound to a single routing group and can only call that group's models. A Smart API Key is bound to auto. On every request Modelflare:

  1. collects every routing group your account may use,
  2. keeps only the groups that currently have a channel for the model you asked for,
  3. orders them by the key's strategy, and
  4. sends to the first candidate, moving to the next group if that one runs out of usable channels.

So a model that only one group serves still works, and a group that is momentarily unusable is skipped instead of failing your chat.

To create one:

  1. Sign up or open the console.
  2. Go to API Keys → Create Smart API Key.
  3. Pick a routing strategy:
Strategy Order of candidate groups
Balanced (default) Starts in the middle of the price range, works up to the most expensive candidate, then back down through the cheaper ones
Stability first Highest group multiplier first
Low price first Lowest group multiplier first

You can change the strategy on the existing key at any time; the next request uses the new order. Quota, expiry date and IP allowlist work as on any other key.

Step 2: Install the extension

From the VS Code Marketplace, search for Modelflare in the Extensions view, or install from the terminal:

code --install-extension modelflare.modelflare-vscode
Enter fullscreen mode Exit fullscreen mode

The same extension is also published on Open VSX, the registry used by VS Code-compatible builds such as VSCodium: open-vsx.org/extension/modelflare/modelflare-vscode. It needs a build based on VS Code 1.104 or newer, the release line with the chat model provider API the extension uses.

A note for early adopters: version 0.1.0 shipped under the ID modelflare.modelflare. From 0.1.1 the ID is modelflare.modelflare-vscode, because the shorter name is taken on the VS Code Marketplace. Commands and settings are unchanged, but VS Code keeps secrets per extension ID, so if you installed 0.1.0, run Manage Modelflare API Key once after updating.

Step 3: Add your key

Either:

  • open the chat model picker → Manage Models → Modelflare, or
  • run Modelflare: Manage Modelflare API Key from the Command Palette.

Paste the Smart API Key. It goes into VS Code's secret storage. Then open the model picker again and choose a Modelflare model.

The extension has exactly one setting:

{
  "modelflare.baseUrl": "global"
}
Enter fullscreen mode Exit fullscreen mode

global (the default) points at https://modelflare.dev/v1; china points at https://origin.modelflare.dev/v1; you can also give a custom URL. Most readers never need to touch it.

Worked example: three models, one task

To show why switching matters, here is a realistic loop on a small TypeScript service. All three models were picked from the same dropdown, on the same key, without leaving the chat panel.

The model IDs below are real entries in the Modelflare catalog. Each one was also returned by GET /v1/models for a Smart API Key on the day we wrote this, and that is the same list the extension loads. Which ones appear in your picker depends on what your account can reach.

1. Explore with a fast model. Pick gemini-3.5-flash and ask:

Summarize what src/billing/ does and list every place we compute a rounded price.
Enter fullscreen mode Exit fullscreen mode

Cheap, quick, and good enough to map a folder.

2. Refactor with a frontier model in agent mode. Switch the picker to claude-opus-5-5, switch the chat to agent mode, and ask:

Extract the rounding logic you found into src/billing/round.ts, update every caller, and add unit tests.
Enter fullscreen mode Exit fullscreen mode

This is where streaming plus tool calling matters: the model reads files, proposes edits, and runs through the change set the way agent mode normally does.

3. Get a second opinion. Switch to gpt-6.1-sol and ask:

Review the diff in this workspace. Look for behavior changes in rounding at .5 boundaries.
Enter fullscreen mode Exit fullscreen mode

A different model family reviewing another one's work catches a surprising number of edge cases.

Three vendors, one key, one bill. Every request shows up in the usage logs, billed with the multiplier of the group that actually served it, and the log records the resolved group and strategy (Usage and cost).

For reference, here are a dozen-plus text model IDs that were both in the live catalog and in a Smart API Key's GET /v1/models response on the day we wrote this:

Family Example IDs
OpenAI GPT gpt-6.1-sol, gpt-6-sol, gpt-5.5
Anthropic Claude claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5
Google Gemini gemini-3.8-flash, gemini-3.5-flash, gemini-3.1-pro-preview
xAI Grok grok-4.7
DeepSeek deepseek-v4-pro, deepseek-v4-flash
Others kimi-k3, glm-5.3, qwen3.8-max

Treat this as a snapshot. The picker is the source of truth for your account, and Models & Pricing is the source of truth for prices.

Tips

Refresh after a release. When a new model lands, run Modelflare: Refresh Modelflare Models. The key itself needs no edit: a Smart API Key has no per-model allowlist and always follows your account's current access.

Use the strategy, not a second key. If you want cheaper defaults for a side project and maximum stability for work, change the strategy, or create two Smart API Keys with different strategies. You do not need provider-specific keys.

Do not build your own fallback list. A Smart API Key already walks every group your account can use. Ordered fallback chains are for ordinary keys; see Group failover.

Pick the model per task, not per day. The cost difference between a flash-class model and a frontier model is large. Defaulting to a fast model and switching up only for the hard step is the habit this setup makes cheap.

Read errors literally.

  • 401: the key is missing or invalid. Create a Smart API Key at modelflare.dev/keys.
  • model_not_found: a regular key only calls its own group's models. If you already use a Smart API Key, that model is not available to your account right now.
  • 403 insufficient_user_quota: top up at modelflare.dev/billing.

Slow model list from mainland China? Set modelflare.baseUrl to china. Since 0.1.2, the extension's public catalog request times out after 8 seconds and falls back to the key's own model list, so the picker no longer hangs.

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

Where to go next

The model picker was always the right place to choose a model. With one key behind it, choosing is finally cheap enough to do on every task.

Disclosure: I'm part of the Modelflare team, which builds the AI API gateway mentioned in this article.

Top comments (0)