Use Kilo Code with a private API

Connect Kilo Code to the private Morse API: set it up, pick a model, and check it works.

Kilo Code is an open-source coding agent that runs in VS Code and in your terminal, and reads, edits, and runs the code in your folder. It speaks the OpenAI API, so it works with Morse: give it the base URL https://inference.trymorse.ai/v1 and a Morse API key, and its requests run on Morse's private inference, where Morse keeps nothing and no provider learns who you are.

Before you start

In the console, open API keys and make a key for Kilo Code alone, with a spend limit, so a runaway session can't spend all your credits. See Limit a key. Then keep the key in your environment, where Kilo Code reads it.

Terminal
export MORSE_API_KEY="sk_morse_..."

Set up Kilo Code

  1. Add Morse as a provider

    Save this as kilo.json in your project, or as ~/.config/kilo/kilo.json for every project. Kilo's extension and its CLI both read it. It names Morse's base URL, the variable your key is in, and the model's limits.

    kilo.json
    {
      "$schema": "https://app.kilo.ai/config.json",
      "model": "morse/moonshotai/kimi-k2.7-code",
      "provider": {
        "morse": {
          "name": "Morse",
          "npm": "@ai-sdk/openai-compatible",
          "env": ["MORSE_API_KEY"],
          "options": { "baseURL": "https://inference.trymorse.ai/v1" },
          "models": {
            "moonshotai/kimi-k2.7-code": {
              "name": "Kimi K2.7 Code",
              "tool_call": true,
              "attachment": true,
              "limit": { "context": 262144, "output": 32768 }
            }
          }
        }
      }
    }

    A model's reference is the provider, a slash, and Morse's id, so the id keeps its own slash: morse/moonshotai/kimi-k2.7-code. To add another model from the table below, add it under models the same way.

  2. Start Kilo Code

    In VS Code, open Kilo Code and pick the model under Morse in its model menu. In a terminal, install the CLI and run it in your project's folder:

    Terminal
    npm install -g @kilocode/cli
    kilo

    To add Morse without a file, open Kilo Code's settings, choose Providers, then Custom provider, and set Provider API to OpenAI Compatible and Base URL to https://inference.trymorse.ai/v1. The file is where Kilo Code takes a model's limits.

Which model to pick

ModelContextInput / outputWhy
moonshotai/kimi-k2.7-code262.1K$0.95 / $4Kimi's coding model. It doesn't reason, so it starts writing sooner.
moonshotai/kimi-k3.1-pro1M$2 / $10Reasons, and reads images.
z-ai/glm-5.31M$1.40 / $4.40Reasons, and takes tools at TEE too.
deepseek/deepseek-v4-pro-08131M$1.32 / $3.96Reasons, at a lower price.
z-ai/glm-5.3-flash1M$0.15 / $0.50Cheap and fast for small edits, and takes tools at TEE too.

Prices are in dollars per million tokens, on each model's default endpoint. Every model is on the models page.

Check it works

Ask Kilo Code to change a line in one of your files. It edits files with its tools, so a finished edit shows that Morse took the request and its tool calls. In a terminal, one command does the same:

Terminal
kilo run --auto -m morse/moonshotai/kimi-k2.7-code "In README.md, fix the first typo you find."

Keep it private

A request runs on its model's default privacy tier. To hold Kilo Code to a tier, such as one where only attested hardware reads your prompts, set a privacy floor on its key. See Privacy tiers and Provider routing.

If something goes wrong

What you seeWhat to do
401The key is missing or wrong. Check that MORSE_API_KEY is set where Kilo Code starts, and that the key isn't revoked.
402Add credits, or raise the key's limit. Morse holds credit for a request's output limit before it starts. See Holds.
404Use a model's id exactly as the table above writes it, lab and all.

Every code is in Errors. For other tools, see Coding agents and editors.