Docs · Guide

Use DeepSeek, Kimi, GLM or your Claude and ChatGPT subscription in OpenCode

OpenCode reaches a model through a provider in its config. magpie adds one provider, named magpie, that leads to a gateway on your computer. Every model you have in magpie is listed under it: DeepSeek, Kimi, GLM and Qwen keys, and the models of a Claude, ChatGPT or Copilot sign-in.

The gateway runs at 127.0.0.1:3425. OpenCode sends it OpenAI Chat Completions, and magpie passes each request on in the API its provider speaks, translating the request and the reply where they differ, streaming and tool calls included. OpenCode’s own providers stay as they were, next to magpie’s.

Chinese models

DeepSeek, Kimi and Kimi Code, Zhipu GLM (pay as you go or Coding Plan), Z.ai, MiniMax and Qwen.

Subscriptions

Claude Pro/Max, ChatGPT Plus/Pro and GitHub Copilot, signed in once in magpie.

Anything else

Any OpenAI- or Anthropic-compatible URL and key, Ollama and LM Studio.

Set it up

  1. Add the providerIn magpie’s Providers tab, press + Add provider, pick DeepSeek, Kimi, Zhipu GLM, MiniMax or Qwen, paste your API key and save. magpie asks the vendor which models it serves.
  2. Pick the model for OpenCodeIn the Agents tab, click the model on OpenCode’s row and choose one, such as deepseek/deepseek-v4-pro. magpie writes "model": "magpie/deepseek/deepseek-v4-pro" into OpenCode’s config, with the magpie provider beside it.
  3. Or pick it in OpenCodeOnce the provider is there, magpie’s models are in OpenCode’s own /models list under magpie, so you can switch there too.

The same from a terminal:

Terminal
magpie provider add deepseek sk-…
magpie models                                    # every model, as provider/model
magpie opencode deepseek/deepseek-v4-pro         # OpenCode's model
magpie opencode small deepseek/deepseek-v4-flash # its small_model

OpenCode’s small_model is a field of its own on the row, so it can run on a cheaper model than the main one.

Zhipu GLM Coding Plan. When you add Zhipu GLM or Z.ai, pick the plan your key is for. A Coding Plan key has its own endpoints, and sent to the pay-as-you-go one it is told it has no balance.

Subscriptions

Sign in once in magpie, from + Add provider or a terminal, and the subscription’s models are listed under magpie in OpenCode like any other. No API key.

SubscriptionModels areFrom a terminal
Claude (Pro, Max, Team)claude/…magpie accounts add claude
magpie opencode claude/claude-opus-5-5
ChatGPT (Plus, Pro, Business)codex/…magpie accounts add codex
magpie opencode codex/gpt-5.5
GitHub Copilotcopilot/…magpie accounts add copilot

Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed. Copilot gives you a code to enter on GitHub’s page. Several accounts of one subscription can share the load and fail over; see Subscriptions in any agent.

What changes in opencode.json

magpie writes to the config file OpenCode reads from its config folder, $OPENCODE_CONFIG_DIR when that is set and ~/.config/opencode otherwise: the first of opencode.jsonc, opencode.json and config.json that exists, or a new opencode.json. It changes only these keys; your other settings stay.

KeySet to
modelmagpie/<provider>/<model>
small_modelThe same form, when you set one
provider.magpie.npm@ai-sdk/openai-compatible
provider.magpie.options.baseURLhttp://127.0.0.1:3425/v1
provider.magpie.options.apiKeyThe gateway’s key
provider.magpie.modelsEvery model magpie lists for OpenCode

Each model carries its context window and output limit, so OpenCode knows when to compact; whether it takes images; its reasoning levels; and its price. magpie keeps the list up to date as you add providers and accounts. If the file also has the provider under providers, where OpenCode 2 keeps it, magpie writes it there as well. OpenCode in a WSL distro on Windows is set up the same way, in the distro’s ~/.config/opencode.

Reasoning levels and cost

A shorter model list

By default OpenCode is shown every model you have in magpie. To show it only some providers or groups:

Terminal
magpie visible opencode deepseek,claude   # only these providers
magpie visible opencode all               # every model again

A model left out of the list still answers when OpenCode asks for it by name.

Switch back

On OpenCode’s row in magpie, the model picker lists OpenCode’s own providers too, the ones signed in in its auth.json. Pick one of them, or run:

Terminal
magpie opencode default

It puts back the model and small_model OpenCode had before magpie, and takes the magpie provider out of the file.

By provider: DeepSeek · Kimi and Kimi Code · GLM Coding Plan · Qwen · MiniMax

FAQ

How do I use DeepSeek in OpenCode?

Add DeepSeek with your API key in magpie, then pick a DeepSeek model on OpenCode’s row in the Agents tab, or run magpie opencode deepseek/deepseek-v4-pro. magpie adds a magpie provider to opencode.json and sets the model.

Can I use Kimi or GLM in OpenCode?

Yes. Add Kimi or Zhipu GLM in magpie and pick its model for OpenCode. For a GLM Coding Plan key, pick the Coding Plan when you add it, since it has its own endpoints.

Can I use my Claude Pro or Max subscription in OpenCode?

Yes. Sign in to Claude in magpie (magpie accounts add claude) and pick a claude/… model for OpenCode. Requests on a Claude subscription run through the Claude Code installed on your computer, so keep it installed.

Can I use my ChatGPT Plus or Pro subscription in OpenCode?

Yes. Sign in to ChatGPT in magpie (magpie accounts add codex) and pick a codex/… model, such as codex/gpt-5.5. Its reasoning levels show as the model’s variants in OpenCode.

Which file does magpie change?

OpenCode’s config in ~/.config/opencode (or $OPENCODE_CONFIG_DIR): the first of opencode.jsonc, opencode.json and config.json, or a new opencode.json. It sets model and small_model and adds provider.magpie; other settings stay.

How do I switch back to OpenCode’s own model?

Pick one of OpenCode’s own models on its row in magpie, or run magpie opencode default. It puts back the model and small_model you had and removes magpie’s provider.

Other agents: Models in Claude Code, Models in Codex, Models in Gemini CLI. Stuck? Ask on Discord.