# Kilo Code (https://inference.net/docs/integrations/kilo-code)

Connect Kilo Code to Inference.net by choosing the **OpenAI Compatible** API provider, setting **Base URL** to `https://api.inference.net/v1`, pasting your Inference.net API key, and entering a verified tool-calling model ID such as `deepseek-v4.1-flash-1017`, `glm-5.3`, or `moonshotai/kimi-k3`.

## Quick configuration

If you do not have a key yet, [create a free account](/register/?model=deepseek-v4.1-flash-1017) and generate a project key in [API keys](/dashboard/api-keys/). Enter these values in Kilo Code's provider settings:

| Setting | Value |
| --- | --- |
| API Provider | `OpenAI Compatible` |
| Base URL | `https://api.inference.net/v1` |
| US-only Base URL (optional) | `https://us.api.inference.net/v1` |
| API Key | Your Inference.net API key (`inf_sk_...`) |
| Model ID | `deepseek-v4.1-flash-1017` (or any verified tool model below) |
| Custom Header (optional) | `x-inference-task-id: kilo-code` |

## Set up Kilo Code in VS Code or JetBrains

<Steps>
<Step title="Open Kilo Code provider settings">

Open the Kilo Code panel in VS Code or JetBrains and click the **Settings** (gear) icon to manage your API configuration profiles.

</Step>
<Step title="Create an OpenAI Compatible profile">

Create a new profile (for example, `inference-deepseek`) and set **API Provider** to **OpenAI Compatible**.

</Step>
<Step title="Set Base URL and API key">

Set **Base URL** to:

```text
https://api.inference.net/v1
```

Use `https://us.api.inference.net/v1` if you want requests pinned to US-hosted GPU clusters for US-served models (marked with the `US` badge in the [model catalog](/models/)). Paste your key from [API keys](/dashboard/api-keys/) into **API Key**.

</Step>
<Step title="Enter Model ID and model limits">

Enter `deepseek-v4.1-flash-1017` in **Model ID**, then expand **Model Configuration** and set:

- **Context Window Size:** `1040000`
- **Max Output Tokens:** `393216`
- **Supports Images:** Enabled (for `deepseek-v4.1-flash-1017`, `glm-5.3-flash`, `moonshotai/kimi-k3`, and `moonshotai/kimi-k3.1-pro`)
- **Supports Prompt Cache:** Enabled

</Step>
<Step title="Optional: tag requests for usage reporting">

Under **Custom Headers**, add `x-inference-task-id` set to `kilo-code` so you can filter Kilo Code spend and cache hits on the [Usage](/dashboard/usage/) page.

</Step>
<Step title="Save and run a verification task">

Save the profile, start a new Kilo Code task, and ask it to inspect a file in your repository. Confirm tool calls succeed and check token counts under [Usage](/dashboard/usage/).

</Step>
</Steps>

## Copy-paste JSON profile for Kilo Code

Kilo Code supports importing and exporting JSON provider profiles (the same OpenAI-compatible schema used by Roo Code). Save the snippet below as a local file, replace `inf_sk_...` with your real key, and import it from Kilo Code Settings. Never commit API keys to git.

```json
{
  "providerProfiles": {
    "currentApiConfigName": "inference-deepseek",
    "apiConfigs": {
      "inference-deepseek": {
        "apiProvider": "openai",
        "openAiBaseUrl": "https://api.inference.net/v1",
        "openAiApiKey": "inf_sk_...",
        "openAiModelId": "deepseek-v4.1-flash-1017",
        "openAiHeaders": {
          "x-inference-task-id": "kilo-code"
        },
        "openAiCustomModelInfo": {
          "contextWindow": 1040000,
          "maxTokens": 393216,
          "supportsImages": true,
          "supportsPromptCache": true,
          "inputPrice": 0.08,
          "outputPrice": 0.635,
          "cacheReadsPrice": 0.007
        }
      },
      "inference-glm": {
        "apiProvider": "openai",
        "openAiBaseUrl": "https://api.inference.net/v1",
        "openAiApiKey": "inf_sk_...",
        "openAiModelId": "glm-5.3",
        "openAiHeaders": {
          "x-inference-task-id": "kilo-code"
        },
        "openAiCustomModelInfo": {
          "contextWindow": 1048576,
          "maxTokens": 943718,
          "supportsImages": false,
          "supportsPromptCache": true,
          "inputPrice": 0.084,
          "outputPrice": 3.0,
          "cacheReadsPrice": 0.079
        }
      },
      "inference-kimi": {
        "apiProvider": "openai",
        "openAiBaseUrl": "https://api.inference.net/v1",
        "openAiApiKey": "inf_sk_...",
        "openAiModelId": "moonshotai/kimi-k3",
        "openAiHeaders": {
          "x-inference-task-id": "kilo-code"
        },
        "openAiCustomModelInfo": {
          "contextWindow": 1048576,
          "maxTokens": 1048576,
          "supportsImages": true,
          "supportsPromptCache": true,
          "inputPrice": 0.245,
          "outputPrice": 15.0,
          "cacheReadsPrice": 0.224
        }
      }
    }
  }
}
```

You can bind different profiles to Kilo Code modes (for example, `inference-glm` or `moonshotai/kimi-k3.1-pro` for **Architect** mode and `inference-deepseek` for **Code** and **Debug** modes).

## Verified flagship models for Kilo Code

Kilo Code relies on tool calls to read files, apply diffs, and run terminal commands. All models below expose `supports_tools: true` in `GET https://api.inference.net/v1/models` (verified 2026-12-06):

| Model ID | Context window | Max output | Input / Cached / Output ($/1M) | Image input | Model page |
| --- | ---: | ---: | --- | --- | --- |
| `deepseek-v4.1-flash-1017` | 1,040,000 | 393,216 | `$0.08` / `$0.007` / `$0.635` | Yes | [DeepSeek V4.1 Flash](/models/deepseek-v4-1-flash-1017/) |
| `glm-5.3` | 1,048,576 | 943,718 | `$0.084` / `$0.079` / `$3.00` | No | [GLM 5.3](/models/glm-5-3/) |
| `glm-5.3-flash` | 1,048,576 | 262,144 | `$0.10` / `$0.03` / `$0.35` | Yes | [GLM 5.3 Flash](/models/glm-5-3-flash/) |
| `moonshotai/kimi-k3` | 1,048,576 | 1,048,576 | `$0.245` / `$0.224` / `$15.00` | Yes | [Kimi K3](/models/kimi-k3/) |
| `moonshotai/kimi-k3.1-pro` | 1,048,576 | 1,048,576 | `$1.80` / `$0.198` / `$9.00` | Yes | [Kimi K3.1 Pro](/models/kimi-k3-1-pro/) |

<Callout title="Avoid non-tool models in Kilo Code" tone="warning">

Models with `supports_tools: false` (such as `inference-net/schematron-v2-turbo` or `glm-5`) cannot drive Kilo Code's file-editing and command loop. Always verify `supports_tools: true` in `GET https://api.inference.net/v1/models` or browse the [model catalog](/models/).

</Callout>

## Prompt caching tips for Kilo Code

Multi-turn Kilo Code sessions replay your system instructions, workspace rules, and tool schemas on every step. Follow these practices to capture automatic `$0.007/1M` cached input reads on `deepseek-v4.1-flash-1017` (a 91.3% reduction vs. `$0.08/1M` fresh input):

- **Keep workspace rules and custom instructions stable:** Avoid editing `.kilocode/rules` or toggling MCP servers mid-task. Any change to the leading system prompt or tool list invalidates the cached prefix.
- **Stay in one mode across multi-step edits:** Switching modes mid-session changes the system prompt and starts a fresh cache prefix. Use Architect mode to write a plan, then start a clean Code task when implementing.
- **Enable `Supports Prompt Cache` in Model Configuration:** Adding `cacheReadsPrice` in your custom model info lets Kilo Code display accurate cached-token cost estimates in the task header.
- **Estimate your savings:** Model your repository size and turn count in the [Prompt Cache Calculator](/tools/prompt-cache-calculator/) or [LLM Pricing Calculator](/tools/llm-pricing-calculator/?preset=coding-agent).

## Verify connectivity with cURL

If requests fail inside your editor, verify your key and model ID directly from a terminal:

```bash
export INFERENCE_API_KEY="inf_sk_..."
curl https://api.inference.net/v1/chat/completions \
  -H "Authorization: Bearer $INFERENCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash-1017",
    "messages": [{"role": "user", "content": "Reply with OK."}]
  }'
```

## Troubleshooting

- **`401 Unauthorized`:** Re-paste your API key without whitespace and confirm it is active on [API keys](/dashboard/api-keys/).
- **`404` or HTML response:** Confirm **Base URL** is `https://api.inference.net/v1` (with `/v1`), not `https://inference.net/v1`.
- **Model not found:** Keep exact owner prefixes from `GET https://api.inference.net/v1/models` (for example, `moonshotai/kimi-k3` rather than `kimi-k3`).
- **Context limit errors:** Ensure **Context Window Size** and **Max Output Tokens** do not exceed the model's `context_length` and `max_completion_tokens` in `GET /v1/models`.
- **Inference Pass plan keys:** Plan keys work directly in Kilo Code for models included in your plan. Check [API keys](/docs/api-keys/#plan-keys) for plan rules.

Ready to start? [Create an API key for DeepSeek V4.1 Flash](/register/?model=deepseek-v4.1-flash-1017), explore the [model catalog](/models/), or browse all guides in the [Integrations hub](/docs/integrations/).