Skip to contentNewKimi K3.1 Pro is now availableTry it now
Docs / Kilo Code

Kilo Code

Connect Kilo Code in VS Code or JetBrains to Inference.net with the OpenAI Compatible provider, verified 1M-context models, and prompt caching.

Last updated

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 and generate a project key in API keys. Enter these values in Kilo Code's provider settings:

SettingValue
API ProviderOpenAI Compatible
Base URLhttps://api.inference.net/v1
US-only Base URL (optional)https://us.api.inference.net/v1
API KeyYour Inference.net API key (inf_sk_...)
Model IDdeepseek-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

  1. 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.

  2. Create an OpenAI Compatible profile

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

  3. 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). Paste your key from API keys into API Key.

  4. 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
  5. 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 page.

  6. 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.

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 IDContext windowMax outputInput / Cached / Output ($/1M)Image inputModel page
deepseek-v4.1-flash-10171,040,000393,216$0.08 / $0.007 / $0.635YesDeepSeek V4.1 Flash
glm-5.31,048,576943,718$0.084 / $0.079 / $3.00NoGLM 5.3
glm-5.3-flash1,048,576262,144$0.10 / $0.03 / $0.35YesGLM 5.3 Flash
moonshotai/kimi-k31,048,5761,048,576$0.245 / $0.224 / $15.00YesKimi K3
moonshotai/kimi-k3.1-pro1,048,5761,048,576$1.80 / $0.198 / $9.00YesKimi K3.1 Pro

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 or LLM Pricing Calculator.

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.
  • 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 for plan rules.

Ready to start? Create an API key for DeepSeek V4.1 Flash, explore the model catalog, or browse all guides in the Integrations hub.