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

# Kilo Code

> Connect current-generation Kilo Code to RunInfra with a preview adapter.

Use RunInfra models in current-generation Kilo Code with its built-in `runinfra` provider.

Support level: `preview`.

<Note>
  Kilo Code needs live stream/tool, override, IDE activation and post-start restoration checks before promotion from preview.

  `on` requires `--preview`. Preview is not a dry run: it writes settings and sends a request using credits. It does not certify those remaining checks.
</Note>

## Connect Kilo Code

Have Kilo Code installed, a workspace API key, and available RunInfra credits. This adapter targets the shared CLI/current IDE configuration in Kilo Code 7.5.15, not legacy extension storage.

```bash theme={"dark"}
npx @runinfra/connect kilo-code --preview
```

The bare agent command is an alias for `on`. In an interactive terminal, Connect starts login if needed. Review and approve the proposed changes. Connect saves a snapshot, writes the provider settings and model selection, and makes a real Chat Completions request that uses credits.

To choose a model during setup:

```bash theme={"dark"}
npx @runinfra/connect kilo-code on --model deepseek-v4-flash --preview
```

See [Connect](/docs/tools-sdks/connect) for status, diagnostics, and key replacement.

## What Connect writes

| Platform        | Configuration                           |
| --------------- | --------------------------------------- |
| macOS and Linux | `~/.config/kilo/kilo.jsonc`             |
| Windows         | `%USERPROFILE%\.config\kilo\kilo.jsonc` |

An absolute `XDG_CONFIG_HOME` applies on all three platforms. Connect appends `kilo/kilo.jsonc`; it does not use `%APPDATA%` on Windows.

Connect merges catalog models and options into `provider.runinfra`, using `@ai-sdk/openai-compatible` and `https://api.runinfra.ai/v1`. It writes actual context/output limits, tool-calling and reasoning flags, and selects `runinfra/<slug>`. Other built-in or configured models can remain visible, so choose the explicit Connect catalog model.

The catalog supplies no modality list, so Connect does not invent modality capabilities. Existing RunInfra model entries absent from the current catalog, comments, and unrelated provider bytes are kept unchanged. Review retained models before selection.

Connect puts a missing `$schema` before other fields. It adds the first-start `permission.bash: "allow"` block only when none of Kilo's five global configuration files exists: `config.json`, `kilo.json`, `kilo.jsonc`, `opencode.json`, and `opencode.jsonc`. If any exists, Connect adds no permission block and keeps existing policy unchanged. A newly created `kilo.jsonc` alone does not establish a fresh installation. Connect discloses this permission change before approval when it applies.

### Key placement

Literal mode writes the key to `provider.runinfra.options.apiKey`. For an environment handoff:

```bash theme={"dark"}
npx @runinfra/connect kilo-code on --preview --key-source helper
```

Helper mode removes an owned `options.apiKey` and writes exactly one discovery variable in `provider.runinfra.env`. It does not write an empty `apiKey` placeholder, which would block credential fallback.

Helper mode writes `RUNINFRA_API_KEY` as the discovery variable. Connect does not switch automatically to `RUNINFRA_GATEWAY_KEY`; set `RUNINFRA_API_KEY` in the launching environment. Kilo's built-in provider also recognizes `RUNINFRA_GATEWAY_KEY`, but Connect keeps the configured helper variable. If the helper variable is unset, Kilo may use a stored `auth.json` key or fail authentication. Review stored credentials separately.

Restart GUI apps and background services with the required environment. On Windows, set `RUNINFRA_API_KEY` in the user environment and fully restart the app. GUI and Start menu launches do not inherit a terminal-only assignment.

## Verify

Kilo Code CLI 7.5.15 produced a verified response through RunInfra with `kilo run --model runinfra/deepseek-v4-flash`, using the Connect-written `kilo.jsonc`.

For that selected model, this manual verification template is docs-only. Connect does not execute it:

```bash theme={"dark"}
kilo run --model runinfra/deepseek-v4-flash --format json --agent ask "Reply exactly RUNINFRA_OK. Do not use tools."
```

This explicit-model check does not prove that Kilo loaded the saved model selection. Run it only in an authorized isolated environment and confirm the destination separately. The prompt is not a tool permission boundary. IDE activation needs its own new-chat check.

Existing sessions and auxiliary model choices may retain their previous provider.

Optional non-inference diagnostics, not executed by Connect:

```bash theme={"dark"}
kilo models runinfra
kilo config check
```

## Restart

Restart Kilo Code fully. In the IDE, open a new chat and confirm the selected RunInfra model.

## Troubleshooting

Connect inventories global files in this order: `config.json`, `kilo.json`, `kilo.jsonc`, `opencode.json`, and `opencode.jsonc`. It writes only `kilo.jsonc` and refuses competing global model or RunInfra provider definitions.

The wider configuration order starts with legacy `.kilocodemodes`, remote well-known settings, those global files, `KILO_CONFIG`, then the project `kilo.json`/`kilo.jsonc`/`opencode.json`/`opencode.jsonc` search. Also review `.kilo` and `.kilocode` directories, `KILO_CONFIG_DIR`, inline `KILO_CONFIG_CONTENT`, and organization settings. Project, inline, and organization settings can override the user file.

| Symptom                                           | What to check                                                                                                                                                                   |
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Connect refuses an override                       | Resolve active `KILO_CONFIG`, `KILO_CONFIG_DIR`, or `KILO_CONFIG_CONTENT` values before connecting.                                                                             |
| Connect refuses a global field or provider policy | Use `kilo config check`. Unknown global keys are fatal in Kilo, and Connect accepts only its verified subset. Do not remove unrelated settings to bypass the refusal.           |
| `off` reports a first-start modification          | Kilo can migrate its own permission block when needed. Connect adds that block only when all five global files are absent. Review native changes before choosing `off --force`. |
| Another file changes after startup                | Kilo can edit schema-less sibling globals and propagate deletion markers across recognized files. This one-file setup does not certify restoration of those other files.        |
| An existing session uses another provider         | Start a new chat and check auxiliary model choices as well as the main selection.                                                                                               |

## Revert

```bash theme={"dark"}
npx @runinfra/connect kilo-code off
```

With intact state and snapshots, `off` restores the original bytes from before the first `on` in the active connection. If `kilo.jsonc` did not exist then, Connect removes it. Later `on` calls and key rotations keep that restore point.

If Kilo or another editor changed the file, Connect refuses to overwrite it. Back up and review the edits before choosing to discard them:

```bash theme={"dark"}
npx @runinfra/connect kilo-code off --force
```

Connect saves the current contents in a recovery snapshot and prints its id before restoring the origin. Keep the snapshots. If the origin snapshot is missing, cleanup does not guarantee original-byte restoration; see [Connect recovery](/docs/tools-sdks/connect#what-off-restores).

File restoration does not revoke `RUNINFRA_GATEWAY_KEY` or a stored `auth.json` credential. Those credentials are not edited and can still authenticate Kilo's built-in provider. Restore manual environment changes separately.

## Related

<Columns cols={3}>
  <Card title="Connect" icon="plug" href="/docs/tools-sdks/connect">
    Set up, inspect, and restore your coding agent.
  </Card>

  <Card title="Chat completions" icon="braces" href="/docs/api-reference/chat-completions">
    Read the request contract.
  </Card>

  <Card title="Models" icon="list" href="/docs/api-reference/models">
    Find model ids and context windows.
  </Card>
</Columns>
