SSOTA
← Blog

June 19, 2026

How to Run Kimi K2.7 Code in VS Code with the opencode Extension (via Sota)

Kimi K2.7 Code is Moonshot's coding model: fast, long-context, and built for agents that run long. opencode is exactly that kind of agent, and its VS Code extension brings it into your editor instead of a separate terminal window. The extension opens in a split pane, sees the file and selection you have open, and lets you reference other files with a keystroke. None of that changes the model or the setup — the extension reads the same opencode.json and stored credentials as the CLI. This guide installs the extension and connects it to Kimi K2.7 Code through Sota, so inference runs on Cloudflare instead of Moonshot's China endpoint and you pay a flat rate instead of per token.

A note on setup: the extension has no provider screen of its own. You authenticate once through opencode's CLI prompt, add a few lines to opencode.json, and the editor picks it up. If you'd rather skip the config file, the desktop app does provider setup through a form, and the CLI guide covers the pure-terminal path. This is the VS Code path.

What you need

  • VS Code (or a fork like Cursor, Windsurf, or VSCodium)
  • opencode installed (curl -fsSL https://opencode.ai/install | bash, or Homebrew or npm)
  • A Sota account (free, no card)
  • A Sota API key

Step 1: Install the extension

The easiest route is to let opencode install it. Open VS Code, open the integrated terminal (Ctrl+ `), and run:

opencode

The extension detects your editor and installs itself. If it doesn't, open the Extensions Marketplace, search OpenCode, and click Install. Auto-install relies on your editor's CLI command being on your PATH (code for VS Code, cursor, windsurf, or codium for the forks); if it's missing, run "Shell Command: Install 'code' command in PATH" from the command palette and try again.

Step 2: Create a Sota API key

In the Sota dashboard, open API Keys and create one. Name it opencode-kimi so you can tell it apart from other keys later. Copy it; keys start with sk-sota- and aren't shown again after you close the dialog.

Step 3: Store the key in opencode

In the same integrated terminal, run:

opencode auth login

Work through the prompts:

  • Select provider: choose Other at the bottom of the list.
  • Enter provider id: type sota. Step 4 has to use this same id.
  • Enter your API key: paste your sk-sota-… key.

opencode saves the credential and tells you to finish setup in config, which is the next step. The same flow is available inside opencode as the /connect command.

Step 4: Point opencode at Sota

The prompt took your key but not an endpoint, so opencode still needs Sota's URL and the model list. Add them to opencode.json. The global file is at ~/.config/opencode/opencode.json, or use a project-level opencode.json in your repo root that takes precedence. Create or open it and add:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "sota": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Sota",
      "options": {
        "baseURL": "https://trysota.xyspace.dev/v1"
      },
      "models": {
        "kimi-k2.7-code": { "name": "Kimi K2.7 Code" }
      }
    }
  },
  "model": "sota/kimi-k2.7-code"
}

The short version of what matters:

  • The provider key sota must match the id from Step 3. That's how opencode finds your stored key.
  • @ai-sdk/openai-compatible is the adapter for an OpenAI-shaped API like Sota's.
  • baseURL keeps the /v1, since opencode appends /chat/completions. No apiKey line is needed, because opencode has it from Step 3.
  • model makes sota/kimi-k2.7-code the default.

Because the extension shares this file with the CLI, you write it once and both surfaces use it.

Step 5: Drive it from the editor

Open a project folder, then bring up opencode with Cmd+Esc (Mac) or Ctrl+Esc (Windows/Linux). It opens in a split terminal pane next to your code. Type /models to confirm Kimi K2.7 Code is listed under Sota and selected.

Two things make the extension worth using over a bare terminal:

  • Context awareness. opencode automatically sees your active selection and the file you have open, so a prompt like "trace how this request is handled" works on whatever's in front of you without pasting anything.
  • File references. Press Cmd+Option+K (Mac) or Alt+Ctrl+K (Windows/Linux) to insert a reference to a file into your prompt, so you can point the agent at code in other tabs by name.

Need a clean slate? Cmd+Shift+Esc / Ctrl+Shift+Esc starts a new session. To put Kimi through its paces, point it at a feature that spans several files and ask it to trace how a request flows through them — Kimi holds long context well, so a multi-file question tests it better than a one-liner, and the file-reference shortcut makes pulling those files in quick.

Kimi K2.7 Code vs GLM-5.2 on Sota

Both models on Sota are long-context coders, so they both hold up across opencode's longer runs. The difference is pace versus capability.

Kimi K2.7 Code is the faster of the two. Its quicker responses make the back-and-forth of interactive coding feel snappier, and for most day-to-day work that speed is worth more than the last increment of model quality. It's a strong default.

GLM-5.2 is the more capable model when you want to push harder. It ranks above Kimi on coding leaderboards like Design Arena and costs more to run, and it's the one to reach for on the tasks where you want the strongest possible output and can spare a little speed to get it. To offer both, add GLM-5.2 to the block:

"models": {
  "kimi-k2.7-code": { "name": "Kimi K2.7 Code" },
  "glm-5.2": { "name": "GLM-5.2" }
}

Then /models inside the opencode pane switches between them. The comparison post goes deeper on the trade-off.

The extension vs the CLI and desktop app

The model and the routing are identical across all three: same Kimi K2.7 Code, same Sota endpoint, same Cloudflare inference. What changes is where the agent lives. The VS Code extension keeps it next to your code, with the editor's current selection and open file fed in automatically and file references a keystroke away. The desktop app gives you a standalone window with a diff viewer. The CLI is the leanest, best for scripting and a pure-terminal workflow. Since they all read the same opencode.json, you can move between them without reconfiguring.

Troubleshooting

The extension didn't install. Auto-install needs your editor's CLI command on PATH. Install it from the command palette ("Shell Command: Install 'code' command in PATH"), or install OpenCode from the Extensions Marketplace by hand.

Model not found. The provider key sota has to match both the id from Step 3 and the prefix in your model line (sota/kimi-k2.7-code). Check all three.

Auth errors. Re-run opencode auth login in the integrated terminal, confirm the full sk-sota-… key went in under provider id sota, and use opencode auth list to see what's stored.

404s or no response. Almost always the baseURL. It needs to be exactly https://trysota.xyspace.dev/v1, no trailing slash.

Long runs cut off. opencode and Kimi both handle large context, but check you're on a current opencode version. Sota normalizes Kimi's output to the standard response shape, and an old client can mishandle it.

Why Sota instead of Moonshot directly

Moonshot's native Kimi API runs inference in China. If your code can't leave Western infrastructure, that rules out the direct route no matter how good the model is. Sota serves Kimi K2.7 Code from Cloudflare's network (US, UK, Germany, Japan, Australia), so what the extension sends stays where your policy allows. And because opencode's agent loops are token-heavy, Sota's flat pricing ($25 Starter, $125 Pro, with per-user ceilings) keeps the cost predictable no matter how long the session runs.

Get started with Sota and put Kimi K2.7 Code to work in VS Code in a few minutes.