|
| 1 | +# Kilo Code |
| 2 | + |
| 3 | +## About |
| 4 | + |
| 5 | +[Kilo Code](https://kilocode.ai/) is an open-source AI coding assistant and VS Code extension that enables natural-language code generation, debugging, and refactoring through customizable modes (Architect, Code, Debug, etc.). It supports multiple model providers, integrates with the Model Context Protocol (MCP), and allows developers to extend functionality with custom tools and workflows. |
| 6 | + |
| 7 | +This guide shows how to connect **AI/ML API** as a **custom provider** in **Kilo Code** for VS Code, using the **OpenAI-compatible** path.\ |
| 8 | +Follow the steps and screenshots below. |
| 9 | + |
| 10 | +*** |
| 11 | + |
| 12 | +## Summary |
| 13 | + |
| 14 | +* **Provider:** OpenAI Compatible (inside Kilo Code) |
| 15 | +* **Base URL:** `https://api.aimlapi.com/v1` |
| 16 | +* **API Key:** from your AI/ML API dashboard |
| 17 | +* **Recommended Model IDs:** [openai/gpt-5-chat-latest](../api-references/text-models-llm/openai/gpt-5-chat.md), [openai/o4-mini](../api-references/text-models-llm/openai/o4-mini.md), [openai/gpt-4.1](../api-references/text-models-llm/openai/gpt-4.1.md) ( or any other supported model) |
| 18 | + |
| 19 | +*** |
| 20 | + |
| 21 | +## 0) Install Kilo Code Extension |
| 22 | + |
| 23 | +If you haven’t installed Kilo Code yet: |
| 24 | + |
| 25 | +1. Open VS Code. |
| 26 | +2. Go to Extensions (Ctrl+Shift+X or Cmd+Shift+X). |
| 27 | +3. Search for “Kilo Code”. |
| 28 | +4. Install the extension by Kilo Code. |
| 29 | +5. Reload VS Code if prompted. |
| 30 | + |
| 31 | +After installation, you’ll see the Kilo Code icon in the sidebar. |
| 32 | + |
| 33 | +Or you can install it from the official site: [**kilocode.ai**](https://kilocode.ai/) |
| 34 | + |
| 35 | +*** |
| 36 | + |
| 37 | +## 1) Open Kilo Code → “Use your own API key” |
| 38 | + |
| 39 | +From the Kilo Code welcome screen, click **Use your own API key**. |
| 40 | + |
| 41 | +<div align="left" data-with-frame="true"><figure><img src="../.gitbook/assets/01-welcome.png" alt=""><figcaption></figcaption></figure></div> |
| 42 | + |
| 43 | +*** |
| 44 | + |
| 45 | +## 2) Choose Provider: **OpenAI Compatible** |
| 46 | + |
| 47 | +Open the provider dropdown and select **OpenAI Compatible**. |
| 48 | + |
| 49 | +<div align="left" data-with-frame="true"><figure><img src="../.gitbook/assets/02-provider-dropdown.png" alt=""><figcaption></figcaption></figure></div> |
| 50 | + |
| 51 | +{% hint style="info" %} |
| 52 | +Tip: Kilo Code also lists many other providers. For AI/ML API use the **OpenAI Compatible** option. |
| 53 | +{% endhint %} |
| 54 | + |
| 55 | +*** |
| 56 | + |
| 57 | +## 3) Configure AI/ML API Settings |
| 58 | + |
| 59 | +Fill the form as follows: |
| 60 | + |
| 61 | +* **Base URL** |
| 62 | + |
| 63 | + ``` |
| 64 | + https://api.aimlapi.com/v1 |
| 65 | + ``` |
| 66 | +* **API Key**\ |
| 67 | + Paste your key from [**https://aimlapi.com/app/keys**](https://aimlapi.com/app/keys) |
| 68 | +* **Model** (examples) |
| 69 | + * [openai/gpt-5-chat-latest](../api-references/text-models-llm/openai/gpt-5-chat.md) ← recommended universal chat |
| 70 | + * [openai/gpt-5-2025-08-07](../api-references/text-models-llm/openai/gpt-5.md) ← pinned dated release |
| 71 | + * [openai/o4-mini](../api-references/text-models-llm/openai/o4-mini.md) ← fast, low-cost |
| 72 | + * [openai/gpt-4.1](../api-references/text-models-llm/openai/gpt-4.1.md) ← stable classic |
| 73 | + * _any other supported model by your account_ |
| 74 | +* **Use Azure**: `OFF` |
| 75 | +* **Set Azure API version**: leave disabled |
| 76 | +* **Image Support**: `ON` if you plan to send images (e.g., 4o / o4-mini) |
| 77 | +* **Max Output Tokens**: `-1` (let server decide) |
| 78 | +* **Context Window Size**: up to `128000` (adjust as needed) |
| 79 | +
|
| 80 | +<div align="left" data-with-frame="true"><figure><img src="../.gitbook/assets/03-openai-compatible-config.png" alt=""><figcaption></figcaption></figure></div> |
| 81 | +
|
| 82 | +{% hint style="info" %} |
| 83 | +**Note**: If you have custom headers (e.g., for proxies), add them in the **Custom Headers** field. |
| 84 | +{% endhint %} |
| 85 | +
|
| 86 | +*** |
| 87 | +
|
| 88 | +## 4) Run Your First Task |
| 89 | +
|
| 90 | +Open the Kilo Code panel, start a task (Ask/Code/Debug), and send a short test message, for example: |
| 91 | +
|
| 92 | +``` |
| 93 | +Hi from AI/ML API! |
| 94 | +``` |
| 95 | +
|
| 96 | +<div align="left" data-with-frame="true"><figure><img src="../.gitbook/assets/04-first-task-success.png" alt=""><figcaption></figcaption></figure></div> |
| 97 | +
|
| 98 | +You should see a successful response with tokens/usage bars as in the screenshot. |
| 99 | +
|
| 100 | +*** |
| 101 | +
|
| 102 | +## 🔬 Quick API Sanity Check (optional) |
| 103 | +
|
| 104 | +You can also sanity-check your key via `curl`: |
| 105 | +
|
| 106 | +{% code overflow="wrap" %} |
| 107 | +```bash |
| 108 | +curl -X POST https://api.aimlapi.com/v1/chat/completions -H "Authorization: Bearer $AIMLAPI_KEY" -H "Content-Type: application/json" -d '{ |
| 109 | + "model": "openai/gpt-5-chat-latest", |
| 110 | + "messages": [ |
| 111 | + {"role":"system","content":"You are a concise assistant."}, |
| 112 | + {"role":"user","content":"Say hello in one sentence."} |
| 113 | + ] |
| 114 | + }' |
| 115 | +``` |
| 116 | +{% endcode %} |
| 117 | + |
| 118 | +If the request succeeds, you’re ready to use the same model inside Kilo Code. |
| 119 | + |
| 120 | +*** |
| 121 | + |
| 122 | +## 💡 Tips |
| 123 | + |
| 124 | +* **Profiles**: Create multiple _API Configuration Profiles_ (e.g., default = `openai/gpt-5-chat-latest`, heavy = `openai/gpt-5-2025-08-07`, budget = `openai/o4-mini`). Switch per task. |
| 125 | +* **Images**: For vision tasks, keep **Image Support** enabled and use a vision-capable model. |
| 126 | +* **Token Limits**: Large responses may require raising _Max Output Tokens_ or splitting the task. |
| 127 | +* **Headers**: If you need custom headers, add them in **Custom Headers**. |
| 128 | + |
| 129 | +*** |
| 130 | + |
| 131 | +## 🧰 Troubleshooting |
| 132 | + |
| 133 | +* **401 / Unauthorized**: Re-check your API key and that it’s pasted without spaces. Regenerate if needed. |
| 134 | +* **404 / Model not found**: Verify the **exact Model ID** you selected is available to your account. |
| 135 | +* **No response / Network issues**: Corporate VPN/Proxy may block `api.aimlapi.com`. Whitelist the domain. |
| 136 | +* **Azure mode confusion**: Leave **Use Azure** toggled **off** unless you specifically need Azure routes. |
| 137 | + |
| 138 | +*** |
| 139 | + |
| 140 | +## 📚 Helpful Links |
| 141 | + |
| 142 | +* **AI/ML API Keys**: [https://aimlapi.com/app/keys](https://aimlapi.com/app/keys) |
| 143 | +* **AI/ML API Dashboard**: [https://aimlapi.com/app](https://aimlapi.com/app) |
| 144 | +* **Kilo Code Docs**: [https://kilocode.ai/docs](https://kilocode.ai/docs) |
| 145 | + |
| 146 | +*** |
| 147 | + |
| 148 | +Enjoy coding with **Kilo Code + AI/ML API**! 🚀 |
0 commit comments