---
title: "Run Kimi Code CLI on a remote server"
description: "Kimi Code CLI with an exe.dev VM: use the VM as an SSH remote environment from your laptop, or run kimi web on it with Kimi K3.1 Pro and no API key."
url: https://exe.dev/deploy/kimi-code
category: "AI agents"
updated: 2026-11-07
---

# Run Kimi Code CLI on a remote server

Moonshot's coding agent, with a Linux box that never sleeps.

- **Software:** Kimi Code (https://www.kimi.com/code)
- **Source:** https://github.com/MoonshotAI/kimi-code
- **License:** MIT
- **Time:** 5 minutes
- **Example VM name:** `my-kimi-code` (yours will differ; on the VM, `hostname` prints it)
- **Machine-readable:** https://exe.dev/deploy/kimi-code/manifest.json

## What you get

- Kimi Code CLI 2.5.2 on a VM with Kimi K3.1 Pro and Kimi K3 through exe.dev's LLM integration, with no API key or Kimi account.
- Kimi's web workbench at `https://<vm>.exe.xyz:8627/`, behind your exe.dev login and Kimi's own server token, running when you close the tab.
- The VM as a remote environment for Kimi Code on your laptop, so commands and builds run on the VM while your login stays local.
- A project folder at `~/project` on persistent disk.

Running on the VM:

- **Kimi Code CLI**: `kimi` 2.5.2, with `kimi web` managed by systemd, port 8627, data in `~/.kimi-code`
- **Your project**, data in `~/project`
- **Kimi K3.1 Pro**: Connected through exe.dev's LLM integration

How it is reached:

- https://my-kimi-code.exe.xyz:8627/ (private): Kimi Code's web workbench, behind your exe.dev login and Kimi's server token
- ssh my-kimi-code.exe.xyz (private): your terminal, and Kimi on your laptop as a remote environment

## Deploy with Shelley

Open https://exe.dev/new?prompt=Set%20up%20Kimi%20Code%20on%20this%20VM%20by%20following%20the%20exe.dev%20recipe%20at%20https%3A%2F%2Fexe.dev%2Fdeploy%2Fkimi-code.md%20from%20top%20to%20bottom.%0A%0AThe%20recipe%27s%20example%20VM%20name%20is%20my-kimi-code.%20This%20VM%27s%20name%20is%20the%20output%20of%20%60hostname%60%3A%20use%20it%20wherever%20the%20recipe%20writes%20my-kimi-code.%20Skip%20the%20step%20that%20creates%20the%20VM%3B%20you%20are%20on%20it.%0A%0AYou%20are%20done%20when%20all%20of%20these%20are%20true.%20Check%20each%20one%20yourself%3A%0A-%20Kimi%20Code%20CLI%202.5.2%20on%20a%20VM%20with%20Kimi%20K3.1%20Pro%20and%20Kimi%20K3%20through%20exe.dev%27s%20LLM%20integration%2C%20with%20no%20API%20key%20or%20Kimi%20account.%0A-%20Kimi%27s%20web%20workbench%20at%20%60https%3A%2F%2F%3Cvm%3E.exe.xyz%3A8627%2F%60%2C%20behind%20your%20exe.dev%20login%20and%20Kimi%27s%20own%20server%20token%2C%20running%20when%20you%20close%20the%20tab.%0A-%20The%20VM%20as%20a%20remote%20environment%20for%20Kimi%20Code%20on%20your%20laptop%2C%20so%20commands%20and%20builds%20run%20on%20the%20VM%20while%20your%20login%20stays%20local.%0A-%20A%20project%20folder%20at%20%60~%2Fproject%60%20on%20persistent%20disk.%0A%0ARun%20the%20VM-side%20commands%20in%20%22Create%20the%20VM%22%20and%20%22Open%20the%20web%0Aworkbench%22.%20If%20~%2F.kimi-code%2Fconfig.toml%20already%20exists%2C%20merge%20the%0Aprovider%20and%20model%20tables%20into%20it%20instead%20of%20replacing%20it.%20Keep%0A%60kimi%20web%60%20on%20its%20default%20127.0.0.1%20address%2C%20never%20pass%0A--dangerous-bypass-auth%2C%20and%20never%20run%20share%20set-public.%20Verify%20with%20the%0A%60kimi%20-p%60%20command%20and%20check%20that%20%60systemctl%20is-active%20kimi-web%60%20prints%0Aactive.%20Finish%20with%20the%20workbench%20URL%20including%20its%20%23token%3D%20part%2C%20from%0Athe%20command%20in%20%22Open%20the%20web%20workbench%22%3B%20this%20conversation%20is%20private%20to%0Athe%20owner.%20Mention%20that%20%22Use%20the%20VM%20from%20Kimi%20on%20your%20laptop%22%20is%20set%20up%0Aon%20the%20owner%27s%20own%20computer%2C%20not%20here.%0A%0AFinish%20with%20the%20URLs%20I%20should%20open.%0A to create a VM whose agent, Shelley, follows this recipe. From a terminal:

```sh
curl -fsSL https://exe.dev/deploy/kimi-code/prompt.txt | ssh exe.dev new --prompt=/dev/stdin
```

Or follow the steps below by hand.

[Kimi Code CLI](https://github.com/MoonshotAI/kimi-code) is Moonshot AI's
open-source coding agent: a terminal UI, a headless `kimi -p` mode, and a web
workbench (`kimi web`), built around Moonshot's Kimi models. An exe.dev VM
gives it a Linux machine that stays on, with your code on persistent disk
and Kimi K3.1 Pro through exe.dev's [LLM integration](/docs/integrations-llm):
no Kimi account or API key needed, with usage billed to your exe.dev account.

There are two ways to use it:

- **Everything on the VM.** Kimi runs on the VM, as a terminal UI in tmux or
  as the web workbench, which exe.dev's [HTTPS proxy](/docs/proxy) keeps
  private to you. Start a task, close the laptop, check on it from a phone.
- **The VM as a remote environment.** Since
  [version 2.5.0](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html)
  (November 4, 2026), Kimi on your laptop can run its file and shell tools
  on another machine over SSH, while the model requests, your Kimi login and
  your session history stay on the laptop. Point it at the VM and your
  builds, tests and Docker run there.

Both start with the same VM.

## Create the VM

On your computer, create a VM and connect. Pick any free name; if you've
already clicked Deploy or have a VM, skip the first command and use its name:

```bash
ssh exe.dev new --name=my-kimi-code
ssh my-kimi-code.exe.xyz
```

<details class="dp-details" id="create-the-vm" data-manual-setup>
<summary>Install Kimi Code by hand</summary>

### Install Kimi Code

On the VM, install Kimi Code with Moonshot's install script. It downloads
the Linux build of the `kimi` binary from the GitHub release, checks its
checksum, puts it in `~/.kimi-code/bin`, and adds that folder to your `PATH`
in `~/.bashrc`:

```bash
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash -s -- --version 2.5.2
exec bash -l
kimi --version
```

Expect `2.5.2`. This binary is also the executor that Kimi on your laptop
looks for when it uses the VM as a remote environment.

### Point Kimi at Kimi K3.1 Pro

exe.dev's LLM integration serves Kimi K3.1 Pro and Kimi K3 through
Fireworks, with a one-million-token context window. The VM needs no key:
exe.dev adds credentials on the way out, so `api_key` is a placeholder.
Write Kimi's config:

```bash
mkdir -p ~/.kimi-code ~/project
cat > ~/.kimi-code/config.toml <<'EOF'
# Kimi models through exe.dev's LLM integration: no API key on the VM.
default_model = "exe/kimi-k3.1-pro"

[providers.exe]
type = "openai"
base_url = "https://llm.int.exe.xyz/fireworks/inference/v1"
api_key = "not-a-secret"

[models."exe/kimi-k3.1-pro"]
provider = "exe"
model = "accounts/fireworks/models/kimi-k3p1-pro"
max_context_size = 1048576
capabilities = ["thinking", "image_in", "tool_use"]
display_name = "Kimi K3.1 Pro (exe.dev)"

[models."exe/kimi-k3"]
provider = "exe"
model = "accounts/fireworks/models/kimi-k3"
max_context_size = 1048576
capabilities = ["thinking", "image_in", "tool_use"]
display_name = "Kimi K3 (exe.dev)"
EOF
```

Check that the setup is sound and a model answers:

```bash
cd ~/project
kimi doctor
kimi -p "Create hello.py that prints hello from $(hostname), then run it."
```

Kimi prints its thinking, writes the file, runs it, and ends with the
command to resume the session.

</details>

## Code in the terminal

On the VM, start Kimi's terminal UI inside tmux, so it keeps working when
you disconnect. Kimi asks for tmux's extended keys, so turn them on first:

```bash
echo 'set -g extended-keys on' >> ~/.tmux.conf
tmux new -A -s kimi -c ~/project ~/.kimi-code/bin/kimi
```

Kimi asks once whether to trust the folder; then give it a task, such as
"Write index.html for a one-page website for a bakery that only sells
sourdough." Kimi asks before it writes files or runs commands; `/model`
switches between K3.1 Pro and K3. To leave it running, press `Ctrl-b` then
`d`. Next time, this puts you back where you were, from your computer:

```bash
ssh -t my-kimi-code.exe.xyz 'tmux new -A -s kimi -c ~/project ~/.kimi-code/bin/kimi'
```

## Open the web workbench

`kimi web` serves the same agent as a web app: projects, sessions,
approvals, a file browser and a diff of each change. Run it as a service,
so it keeps going when you close the tab and starts again after a reboot.
It stays on 127.0.0.1, and exe.dev's proxy brings port 8627 to
`https://my-kimi-code.exe.xyz:8627/`, behind your exe.dev login.
`--allowed-host` lets that address through Kimi's own host check. On the VM:

```bash
sudo tee /etc/systemd/system/kimi-web.service >/dev/null <<EOF
[Unit]
Description=Kimi Code web workbench
After=network-online.target
Wants=network-online.target

[Service]
User=exedev
WorkingDirectory=/home/exedev/project
ExecStart=/home/exedev/.kimi-code/bin/kimi web --port 8627 --no-open --allowed-host $(hostname).exe.xyz
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now kimi-web
```

Kimi also protects the workbench with a server token, which it keeps in
`~/.kimi-code/server.token` across restarts. Wait for the first start to
write it, then print the address with the token in it:

```bash
until [ -s ~/.kimi-code/server.token ]; do sleep 1; done
echo "https://$(hostname).exe.xyz:8627/#token=$(cat ~/.kimi-code/server.token)"
```

Open it and sign in to exe.dev if asked. If Kimi then shows **Server token
required**, paste the token (the part after `#token=`); each browser asks
once. Skip the model sign-in screen, since Kimi K3.1 Pro is already set up.
Click **New project**, add the `project` folder, trust it, and give Kimi a
task. Each file write and command waits for your **Approve** unless you
choose **Approve for session**.

<figure>
<img src="https://exe.dev/deploy/kimi-code/web.png" alt="Kimi Code's web workbench: a finished task that wrote index.html for a sourdough bakery and checked it with Python's HTML parser, using Kimi K3.1 Pro (exe.dev)" width="1280" height="800" loading="lazy">
<figcaption>The web workbench on the VM, after a task with Kimi K3.1 Pro through exe.dev.</figcaption>
</figure>

Close the tab whenever you like; running tasks keep going on the VM.

> [!WARNING]
> Anyone who gets past both exe.dev's login and Kimi's token can run
> commands on the VM. Keep port 8627 private: don't run `share set-public`
> for it, and don't pass `--dangerous-bypass-auth`, which turns Kimi's token
> off. If the token leaks, run `kimi web rotate-token` and
> `sudo systemctl restart kimi-web`.

To step through a session as it unfolds, run Kimi's session visualizer on
the VM with `kimi vis --port 8123 --no-open` and open
`https://my-kimi-code.exe.xyz:8123/`. On 127.0.0.1, its default, it has no
login of its own and relies on exe.dev's; Kimi's docs show `--host 0.0.0.0`,
but exe.dev's proxy doesn't need it, and 2.5.2 refuses it without a
`VIS_AUTH_TOKEN`.

## Use the VM from Kimi on your laptop

If you already run Kimi Code on your laptop, keep doing that, and let the
VM do the work. Kimi connects with your system `ssh`, so the key you use for
`ssh my-kimi-code.exe.xyz` is all it needs. The VM needs the `kimi` binary
from "Create the VM" (Kimi doesn't install it for you), at the same version
as your laptop's; the model config there doesn't matter in this mode.

On your computer, add the VM to `~/.kimi-code/config.toml`:

```toml
[environments.my-kimi-code]
type = "ssh"
host = "my-kimi-code.exe.xyz"
defaultCwd = "/home/exedev/project"
```

Then start a session in it:

```bash
kimi --environment my-kimi-code
```

The footer shows `my-kimi-code` with the remote folder and its git branch,
and approvals name the target ("Run this command? ssh:my-kimi-code").
Reads, edits and shell commands, including subagents', run on the VM;
the model calls and your Kimi login stay on the laptop. `kimi -p` works the
same way for scripted runs. `--environment-cwd /home/exedev/other` picks
another folder for one session, and `kimi -r` resumes a session in the
environment it was created in. To make the VM the default for new
sessions, add `[environments]` with `default = "my-kimi-code"`.

A few things stay on the laptop, per the
[remote environment guide](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/remote-environment.html):
web search and fetch, hooks, and stdio MCP servers. Kimi doesn't load
project agent files from the remote folder by itself; it reads `AGENTS.md`
when a session starts or resumes, or on `/reload`. If the connection drops,
tools fail rather than quietly running on your laptop.

Kimi runs `ssh` non-interactively (`BatchMode`) and accepts a new host's key
on first use. Every `*.exe.xyz` VM answers with exe.dev's own
[host key](/docs/faq/host-key), so a VM you delete and recreate under the
same name connects without a key-mismatch error.

To give a laptop access to only this VM, not your whole exe.dev account,
use a [VM-scoped SSH key](/docs/vm-scoped-ssh-keys). On that laptop:

```bash
ssh-keygen -t ed25519 -f ~/.ssh/kimi-vm -N ''
cat ~/.ssh/kimi-vm.pub | ssh exe.dev ssh-key add --vm=my-kimi-code
```

Run the second command from a computer already signed in to exe.dev, then
add `IdentityFile ~/.ssh/kimi-vm` for `Host my-kimi-code.exe.xyz` in the
laptop's `~/.ssh/config`.

## Frequently asked questions

### Which Kimi Code is this?

The TypeScript [Kimi Code CLI](https://github.com/MoonshotAI/kimi-code), version 2.x, installed with Moonshot's install script or the npm package `@moonshot-ai/kimi-code`. The older Python `kimi-cli` is archived, and the PyPI package called `kimi-code` is a leftover of it, not the new CLI. If you used the old one, the new CLI offers to bring its settings and sessions across (`kimi migrate`).

### Can I use my Kimi membership or a Kimi Platform API key instead?

Yes. With the VM as a remote environment, Kimi on your laptop uses whatever it's signed in to, and nothing goes on the VM. On the VM itself, `kimi login --region global` (or `--region mainland-cn`) signs in with a device code you approve in any browser, which keeps a token in `~/.kimi-code` on the VM. To keep a Kimi Platform key off the VM, put it in an [HTTP proxy integration](/docs/integrations-http-proxy) for `https://api.moonshot.ai` and point a `type = "kimi"` provider's `base_url` at the integration. We tested exe.dev's LLM integration, and saw the device-code login start, but haven't used a Kimi account or Platform key on the VM.

### What about Kimi's own Remote Control?

`kimi rc` lets you drive a machine from Kimi's website and needs a paid Kimi membership. This page doesn't need one: exe.dev's proxy and Kimi's server token protect the workbench instead. You could run `kimi rc` on the VM too; we haven't tried it.

### What does it cost?

Your [VM plan](https://exe.dev/pricing) plus model usage, billed through the [LLM integration](/docs/integrations-llm). Kimi Code itself is free and MIT-licensed. With a Kimi account or key, Moonshot bills you for its models instead.

### How do I update Kimi Code?

Run `kimi upgrade -y` on the VM, then `sudo systemctl restart kimi-web`. If you use the VM as a remote environment, keep the VM's `kimi` on the same version as your laptop's: the docs say a missing or incompatible executor has to be installed or updated by hand.

### Something's not working. Where do I look?

`kimi doctor` on the VM checks the installation and config, and `journalctl -u kimi-web -e` shows the web workbench's log. Kimi writes its own log to `~/.kimi-code/logs/kimi-code.log`. If the browser asks for a server token, paste the contents of `~/.kimi-code/server.token`.

### How do I back up my work?

Commit and push your code. Sessions and settings live in `~/.kimi-code` on the VM. For a copy of the whole VM, run `ssh exe.dev cp my-kimi-code my-kimi-code-backup` on your computer.


## Related

- [Run OpenCode on a remote server](https://exe.dev/deploy/opencode.md): Every model, one VM, and an agent that works while your laptop sleeps.
- [Run ZCode on a remote server](https://exe.dev/deploy/zcode.md): Z.ai's coding agent on a Linux VM that stays on, with GLM-5.3 and no key.
- [Run Qwen Code on a remote server](https://exe.dev/deploy/qwen-code.md): Qwen Code in your browser, working on a VM while your laptop sleeps.
- [Run DeepSeek Harness on a remote server](https://exe.dev/deploy/deepseek-harness.md): DeepSeek's agent in a browser tab, on a computer that never sleeps.
- [Run Claude Code on a remote server](https://exe.dev/deploy/claude-code.md): A computer for Claude. A breather for your laptop.
- [Host OpenClaw](https://exe.dev/deploy/openclaw.md): An AI sidekick with its own computer. Your laptop can take a nap.
