> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lithosai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Use LithosAI with Kilo Code

> Connect Kilo Code directly to LithosAI with an OpenAI-compatible custom provider.

Kilo Code connects directly to LithosAI through its OpenAI Compatible provider. You do not
need a local proxy or protocol adapter.

<Note>
  These steps use the Kilo Code custom-provider interface in VS Code. Kilo uses the same
  provider configuration across its editor and CLI surfaces.
</Note>

## Before you begin

Install the Kilo Code extension, create a key on the
[API Keys](https://console.lithosai.cloud/keys) page, and confirm the model ID you want to use
on the [Models](https://console.lithosai.cloud/models) page.

<Steps>
  <Step title="Open the provider settings">
    Open Kilo Code in VS Code, select the gear icon, and go to **Providers**. Scroll to the
    bottom of the provider list and select **Custom provider**.
  </Step>

  <Step title="Configure LithosAI">
    Enter the following values:

    | Field        | Value                           |
    | ------------ | ------------------------------- |
    | Provider ID  | `lithosai`                      |
    | Display name | `LithosAI`                      |
    | Provider API | `OpenAI Compatible`             |
    | Base URL     | `https://api.lithosai.cloud/v1` |
    | API key      | Your LithosAI API key           |

    After you enter the base URL and key, select `moonshotai/Kimi-K3` from the fetched model
    list. If it does not appear, add the model ID manually.

    <Tip>
      If Kilo does not recognize the model, set its context and output limits
      (`limit.context` and `limit.output` in `kilo.jsonc`) from the
      [Models](https://console.lithosai.cloud/models) page. Without them, automatic context
      compaction may be disabled.
    </Tip>
  </Step>

  <Step title="Save and select the model">
    Select **Submit**, then choose `lithosai/moonshotai/Kimi-K3` in the model picker. Replace
    the model ID if you selected a different model in the LithosAI console.

    <Note>
      `{env:...}` references resolve only from the trusted global `kilo.jsonc` or a managed
      configuration, not from a project-level file.
    </Note>
  </Step>
</Steps>

## Configure Kilo CLI

If you use the Kilo CLI, install it and add an OpenAI-compatible provider to your trusted
global configuration.

```bash theme={null}
npm install -g @kilocode/cli
export LITHOSAI_API_KEY="your-key"
```

```jsonc ~/.config/kilo/kilo.jsonc theme={null}
{
  "$schema": "https://app.kilo.ai/config.json",
  "model": "lithosai/moonshotai/Kimi-K3",
  "provider": {
    "lithosai": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LithosAI",
      "options": {
        "apiKey": "{env:LITHOSAI_API_KEY}",
        "baseURL": "https://api.lithosai.cloud/v1"
      },
      "models": {
        "moonshotai/Kimi-K3": {
          "name": "Kimi K3 on LithosAI",
          "tool_call": true
        }
      }
    }
  }
}
```

<Warning>
  Keep this configuration in `~/.config/kilo`. Kilo does not resolve `{env:...}` credentials
  from an untrusted project-level `kilo.jsonc` file.
</Warning>

Start Kilo from the project you want it to inspect.

```bash theme={null}
kilo
```

## Verify the connection

Open a project that contains a `README.md`, then ask Kilo Code:

```text theme={null}
Read README.md and reply with only its first Markdown heading.
```

Kilo Code should read the local file and return its heading. This verifies both the model
response and a basic local tool call.

## Troubleshooting

| Symptom                              | Cause                                                                                                  |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| Authentication fails in Kilo CLI     | The configuration is in an untrusted project-level file, so `{env:LITHOSAI_API_KEY}` does not resolve. |
| Kilo cannot edit files or call tools | Confirm the model entry has `tool_call: true`.                                                         |
| Conversations do not compact         | Add `limit.context` and `limit.output` from the LithosAI console.                                      |

Issues common to every agent are listed under [Common issues](/coding-agents#common-issues).

## Resources

* [Kilo Code custom models](https://kilo.ai/docs/code-with-ai/agents/custom-models)
* [Kilo Code installation](https://kilo.ai/docs/getting-started/installing)
* [Kilo Code CLI](https://kilo.ai/docs/code-with-ai/platforms/cli)
* [LithosAI models](https://console.lithosai.cloud/models)
