Set up Kimi

Capture Kimi Code CLI, and other tools that use Moonshot's API, in your terminal.

Worsley captures Kimi Code CLI, Moonshot AI's agent in your terminal, and any other tool that calls Moonshot's API, through a relay on your computer.

Kimi's web chat isn't captured yet.

Sign in to the Worsley CLI

Do this once on each computer where you run Kimi Code CLI.

  1. 1Install the Worsley CLI. It runs on macOS, Windows and Linux and needs Node.js 22.23.4 or later (on a Mac, brew install node works too). On macOS or Linux, run:
curl -fsSL https://www.worsley.ai/install.sh | sh

On Windows, in PowerShell:

irm https://www.worsley.ai/install.ps1 | iex

The installer checks the download against its published checksum, puts the CLI in your home folder (~/.worsley, or %LOCALAPPDATA%\Worsley on Windows) and adds it to your PATH. Open a new terminal window afterward so the worsley command is found. Run the same command again any time to update.

  1. 1Sign in. The command below prints a link and a short code, then waits.
worsley login
  1. 1Open the link. Log in to Worsley if asked, check that the code on the page matches the one in your terminal and that it names this computer, then select Connect. If you last logged in more than 10 minutes ago, Worsley asks you to log in again first. Opened the page without the code? Type it in.
  2. 2Back in the terminal, Worsley confirms Signed in as your email. The sign-in is kept in your system's credential store (macOS Keychain, Windows Credential Manager or Secret Service on Linux), never in a plain file. The code expires after 10 minutes; run worsley login again if it does.

Start the Worsley relay

Kimi Code CLI talks to its model over an API, so instead of reading files, Worsley sits between the two as a small relay on your own computer. Requests and replies pass through unchanged, streaming included, and Worsley keeps a copy of each exchange.

  1. 1Start the relay, and leave it running in its own terminal window while you work. Press Ctrl+C to stop it.
worsley proxy --upstream kimi

It listens on 127.0.0.1:11435, on this computer only. Port taken? Add --port <number>, and use that port in the next step.

Point Kimi Code CLI at the relay

Your API key from platform.moonshot.cn (mainland China)? Start the relay with --upstream kimi-cn instead. Keys from platform.moonshot.ai use kimi.

  1. 1Open Kimi Code's settings file, ~/.kimi-code/config.toml. In the kimi provider's settings, set base_url to the relay's address, then save and restart Kimi Code.
base_url = "http://127.0.0.1:11435/v1"

Another tool using Moonshot's API? Set its base URL to http://127.0.0.1:11435/v1 instead.

  1. 1Use Kimi Code CLI as you normally do. Each exchange is uploaded a few seconds after it finishes and appears in Worsley shortly after.

Your API key goes straight through the relay to the provider over HTTPS. Worsley never records or logs it.

This works with a Kimi Platform API key. If you signed in to Kimi Code with its one-click login, its managed service sets its own address and doesn't go through the relay, so those sessions aren't captured yet.

Check that it's working

  • Open History in Worsley. Your session shows up there with the tool's name, usually within a minute of a finished turn.
  • In the terminal, run worsley status. It shows the account this computer is signed in to and anything still waiting to upload.

What's captured

  • Your prompts, Kimi's replies and the earlier turns of the conversation, with the model's name.
  • Not captured: system prompts, tool calls and their results, images, and thinking.
  • Moonshot's Anthropic-compatible endpoint (Claude Code pointed at Kimi) passes through the relay but isn't recorded.

If a session doesn't appear

  • Browser: check that the Worsley icon isn't showing Not Connected, Reconnect or No Site Access, and reload the tool's tab. More in Extension isn't capturing.
  • Terminal: check that worsley watch or worsley proxy was running while you worked, and run worsley status. If it says the sign-in was revoked or expired, run worsley login again.
  • Still missing after a few minutes? Contact support and tell us which tool and which browser or terminal you used.

Still need help?

Our team will get back to you.

Contact support