Kilo Code integration
Configure Kilo Code with the nexos.ai API Gateway for multi-provider LLM access in VS Code and in the terminal. A guide for API keys, provider config, and model selection.
Connect Kilo Code to the nexos.ai API Gateway to use the models available in your nexos.ai platform directly inside Visual Studio Code or from the Kilo CLI.
Kilo Code supports any OpenAI-compatible endpoint through a Custom provider. By adding nexos.ai as a custom provider, every request Kilo Code makes (chat, tool calls, optional codebase indexing) is routed through nexos.ai using your nexos.ai API key, with the usual load balancing, cost tracking and observability.
One configuration for VS Code and CLI. The current Kilo Code extension is built on top of the Kilo CLI (a fork of OpenCode). Both share the same kilo.jsonc config file, so a nexos.ai provider added in one is available in the other.
What is Kilo Code?
Kilo Code is an open-source (MIT) AI coding agent available as a VS Code extension, a JetBrains plugin and a terminal CLI. It can read and edit files, run terminal commands, browse the web and use MCP servers to complete multi-step tasks.
Key features:
Agents (modes) – built-in Code, Plan, Ask and Debug agents, plus custom agents and subagents, keep the model focused on a specific kind of work. (The former Orchestrator agent is deprecated: Code, Plan and Debug launch subagents themselves.)
Provider agnostic – works with 30+ providers and any OpenAI-compatible endpoint, including the nexos.ai Gateway.
Separate model roles – main, small, subagent, compaction and memory models can each point at a different model.
MCP support – connect Model Context Protocol servers to extend the agent with external tools.
Codebase indexing – semantic search over your project using an embedding model and a LanceDB (built-in) or Qdrant vector store.
Kilo CLI – the same agent in your terminal, scriptable and usable over SSH.
Useful links:
Prerequisites
A nexos.ai API key (user key or team key). See How to generate a nexos.ai API key.
Visual Studio Code 1.105.1 or later (VSCodium, Windsurf and other Open VSX editors also work), and/or Node.js with npm for the Kilo CLI.
At least one model in your nexos.ai workspace that supports the Chat Completions endpoint and native tool calling. Kilo Code edits files and runs commands through tool calls, so a model without tool calling cannot do agentic work.
How to connect Kilo Code (VS Code) with nexos.ai
1. Generate your nexos.ai API key
In your nexos.ai workspace open the API Keys tab, select Generate API Key, enter a name for the key and click Generate. Copy the key immediately: it is shown only once and cannot be retrieved after the dialog is closed.
The key inherits the settings configured by your organization owner (enabled models, fallbacks, limits). API usage requires purchased API credits.
2. Install the Kilo Code extension
Kilo Code is published on the VS Code Marketplace by kilocode (kilocode.Kilo-Code). This guide requires version 7.x or later, which is the regular release.
VS Code Extensions tab (recommended) – open the Extensions view (
Ctrl+Shift+X/Cmd+Shift+X), search for "Kilo Code", select Kilo Code: AI Coding Agent, Copilot, and Autocomplete by kilocode and click Install.Command line:
On macOS, if you get command not found: code, open VS Code, press Cmd+Shift+P and run Shell Command: Install 'code' command in PATH, then open a new terminal. Alternatively, call it by its full path: "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code".
Open VSX (VSCodium, Windsurf and other editors without Marketplace access) – search for "Kilo Code" in the editor's Extensions view, or use open-vsx.org/extension/kilocode/Kilo-Code.
Manual VSIX – download the
.vsixfrom GitHub Releases and use Extensions → ... → Install from VSIX....
After installation a Kilo Code icon appears in the VS Code Activity Bar. On first launch Kilo Code asks you to sign in to a Kilo account. A Kilo account is not needed for the nexos.ai setup. See Keep all traffic on nexos.ai for why you may prefer not to sign in.
3. Add nexos.ai as a custom provider
Open the Kilo Code panel, click the gear icon to open Settings and go to the Providers tab. Scroll to the bottom and click Custom provider.
Fill in the custom provider dialog as follows:
Setting
Value
Provider ID
nexos (lowercase letters, numbers, hyphens or underscores; used as the prefix in nexos/<model-id>)
Display name
nexos.ai
Provider API
OpenAI Compatible
Base URL
https://api.nexos.ai/v1
API key
The nexos.ai key generated in step 1
Models
Click Fetch models and select the chat models you want, or click Add model and enter the ID exactly as returned by GET /v1/models, e.g. Claude Sonnet 5.5 (see step 4). The fetched list contains every model in your workspace, including embedding, image, speech and rerank models: add only chat models. Each model row has a Reasoning toggle (sets reasoning: true; turn it on for reasoning models) and an Image toggle (lets you send screenshots to models with vision).
Headers
Leave empty


Click Submit to save. The nexos.ai models now appear in the model picker. To change the provider later, click Edit provider next to it in the connected providers section.
Behind the scenes Kilo writes the provider (without the key) to your global config ~/.config/kilo/kilo.jsonc and stores the key in ~/.local/share/kilo/auth.json. The Kilo CLI on the same machine picks up both automatically.
4. Choose a model and set its limits
Once the Base URL and API key are filled in, Kilo Code queries the Gateway's /v1/models endpoint and shows a searchable model picker. Click Fetch models to retry if the list did not load. To double-check a model's capabilities, query the nexos.ai Models endpoint directly:
Each entry in data contains the id to use in Kilo Code (usually a readable name such as Claude Sonnet 5.5 or GPT 5.5; spaces are fine, and some models also have slug aliases such as claude-sonnet-5), together with context_length, max_tokens, pricing and the supported endpoints. Matching of the model ID is case-insensitive but otherwise exact; the nexos_model_id UUID is accepted as well.
When picking a model for Kilo Code make sure that:
its
endpointsincludechat_completion, andit supports native tool calling:
"supports_tools": true. Do not rely onfunction_callingininput_capabilities: several current models (e.g. Claude Sonnet 5.5, GPT 5.4 mini) support tools without listing it there. Frontier coding models such as the current Claude Sonnet/Opus, GPT-5 family or Gemini Pro models do; small or older models often do not.
Set the context and output limits. The custom provider dialog does not ask for token limits, and models added through it get a context window and output limit of 0. A context window of 0 disables automatic context compaction: the conversation grows until the Gateway rejects the request. An output limit of 0 also breaks the thinking budgets Kilo derives from it. Use Edit advanced settings in the JSON config file in the Edit provider dialog (or open ~/.config/kilo/kilo.jsonc directly) and add the limits to each model:
Mapping between /v1/models and Kilo model fields:
Kilo field
Source in /v1/models
Why it matters
limit.context
context_length
Kilo uses it to compact the conversation before the limit is reached. When limit is present, both context and output are required; otherwise the model is dropped with a Skipped invalid model configuration warning
limit.output
max_tokens
Upper bound for a single response. Kilo caps it at 32,000 regardless of a higher max_tokens (and uses 32,000 when unset), so 32000 is the practical value
tool_call
supports_tools
Must be true for the agent to edit files and run commands
modalities + attachment
input_capabilities (image, vision)
Enables sending screenshots/images, e.g. {"input": ["text", "image"], "output": ["text"]} plus "attachment": true
cost
pricing
Only used for Kilo's cost estimate. Kilo expects USD per million tokens, while pricing is per token (as a string): multiply by 1,000,000 (e.g. input_cost_per_token "0.0000022" → "input": 2.2). Both input and output are required when cost is present. The nexos.ai usage dashboard remains the source of truth
5. Send your first message
Open a project folder, select a nexos.ai model in the model picker, pick the Code agent and send a simple request, for example "Explain what this repository does". The response should stream in and any file reads should appear as tool calls in the task timeline. The request is visible in your nexos.ai usage dashboard, which confirms that traffic is flowing through the Gateway.


Kilo Code now routes all requests through the nexos.ai API Gateway, giving you access to multiple LLM providers through a single endpoint with centralized cost tracking, limits and observability.
Using the Kilo CLI with nexos.ai
The Kilo CLI reads the same configuration as the extension. If you have already completed the VS Code setup on this machine, just run kilo and pick a nexos/… model with /models. Otherwise:
Install the CLI:
Export your nexos.ai API key, e.g. in
~/.zshrcor~/.bashrc:
Create or edit the global config file
~/.config/kilo/kilo.jsonc:
Replace the model IDs and limits with models enabled in your workspace (see step 4 above). For Claude models, consider the Anthropic Messages provider from Choosing the Provider API instead.
Check that the config is valid and the nexos.ai models are listed, then start Kilo in your project directory:
Optionally, run a one-off task without the interactive UI:
Configuration breakdown:
npm–@ai-sdk/openai-compatibletells Kilo to talk to the Gateway via the Chat Completions API.options.baseURL– the nexos.ai Gateway URL, including/v1.options.apiKey–{env:NEXOS_API_KEY}reads the key from the environment, so it is not stored in the file.models– an object (not an array) keyed by nexos.ai model ID. IDs with spaces work as keys (nexos/Claude Sonnet 5.5). If you prefer a shorter name, use your own key and put the real ID in theidfield, e.g."sonnet": { "id": "Claude Sonnet 5.5", ... }→nexos/sonnet.model/small_model– the default main and small model, in theprovider-id/model-idformat.
Choosing the Provider API
The nexos.ai Gateway exposes three APIs that Kilo Code can use. A Kilo custom provider talks to exactly one of them, so if you want more than one, add several custom providers that point to the same Base URL and API key (e.g. nexos, nexos-anthropic, nexos-openai). Their models all appear in the model picker.
Provider API in Kilo
nexos.ai endpoint
Models
Recommended for
OpenAI Compatible (@ai-sdk/openai-compatible)
/v1/chat/completions
All chat models (chat_completion in endpoints)
Default for everything; Gemini, Mistral, DeepSeek, GLM and other models
Anthropic Messages (@ai-sdk/anthropic)
/v1/messages
Models with messages in endpoints (all Claude models)
Claude models: enables prompt caching
OpenAI Responses (@ai-sdk/openai)
/v1/responses
Models with responses in endpoints (GPT, Grok and some others)
Optional for GPT models: OpenAI's native API for reasoning models
How each option behaves with Kilo Code:
Model / API
Tool calls and file edits
Prompt caching
Reasoning / thinking variants
Claude via OpenAI Compatible
Works
None with the readable nexos.ai IDs (e.g. Claude Sonnet 5.5): every step is billed as full-price input
Works when the model's Reasoning toggle is on (reasoning: true): Kilo sends reasoning_effort, which the Gateway maps to Claude's adaptive thinking
Claude via Anthropic Messages
Works
Works: the repeated context is read from cache on every step
Works after defining variants (see below)
GPT via OpenAI Compatible
Works
Works (automatic)
Works
GPT via OpenAI Responses
Works
Works (automatic)
Works
Claude models via Anthropic Messages (recommended for Claude)
Claude models only cache prompts when the client marks the reusable part of the conversation. Kilo adds these markers on the Anthropic Messages API (see the nexos.ai Messages endpoint); on OpenAI Compatible it does so only for model IDs containing lowercase claude, which the readable nexos.ai IDs do not. With caching, the repeated part of the context (system prompt, tool definitions, earlier turns) costs about a tenth of the normal input price after the first write. Even in a short five-step agent task, input cost is about 40% lower than through OpenAI Compatible, and the saving grows with every further step of a session.
In VS Code: add a second custom provider (Settings → Providers → Custom provider):
Setting
Value
Provider ID
nexos-anthropic
Display name
nexos.ai (Claude)
Provider API
Anthropic Messages
Base URL
https://api.nexos.ai/v1
API key
Your nexos.ai key
Models
Click Add model and enter Claude model IDs from /v1/models, e.g. Claude Sonnet 5.5, Claude Haiku 5.5, and turn on the Reasoning toggle for models you want thinking variants for. Models are not fetched automatically for this Provider API.
Then add the token limits and thinking variants in kilo.jsonc as shown below, and pick the nexos.ai (Claude) models in the model picker.
In kilo.jsonc (VS Code and CLI), next to the nexos provider:
If you entered the key in the VS Code dialog, leave out apiKey: the key is already stored in auth.json.
GPT models via OpenAI Responses (optional)
GPT models work well through OpenAI Compatible, including automatic prompt caching and reasoning levels. Use OpenAI Responses if you want OpenAI's native API for reasoning models; it behaves the same for tool calls and caching. Add a provider with Provider API OpenAI Responses, or in kilo.jsonc:
Only add models whose endpoints in /v1/models include responses.
Keep all traffic on nexos.ai
Kilo Code ships with its own hosted gateway (Kilo Gateway). Even without a Kilo account, the model picker also lists Kilo's free models (kilo-auto/free and others), and some background tasks can fall back to Kilo Gateway when you are signed in. To make sure every LLM request goes through nexos.ai:
Pick a nexos.ai model (shown under your nexos.ai provider) in the model picker, and set it as the default with
modelinkilo.jsonc(or Settings → Models).Do not sign in to Kilo, or sign out in the extension or CLI. Kilo documents logging out of Kilo Gateway as the way to guarantee that no inference goes through it.
Set the Small model explicitly to a nexos.ai model (Settings → Models → Small Model, or
small_modelinkilo.jsonc). It is used for session titles, commit messages, branch names and prompt enhancement. If unset while signed in, Kilo useskilo-auto/smallon Kilo Gateway.Subagent, compaction and memory models inherit the current session's model when left unset, so they stay on nexos.ai. You can also point each of them at a cheaper nexos.ai model under Settings → Models (
subagent_model,agent.compaction.modelandmemory_modelinkilo.jsonc).Autocomplete (inline code suggestions) is a separate feature that always runs through Kilo Gateway, also when you bring your own Mistral or Inception key on app.kilo.ai. It cannot be routed through nexos.ai, so disable it if you need all traffic on nexos.ai.
Kilo still downloads its public model catalog from models.dev on startup and refreshes it hourly. This is model metadata only; no prompts or code are sent. Set KILO_DISABLE_MODELS_FETCH=1 to turn it off.
Troubleshooting
"Model not found" (HTTP 404, code
100110) – the model ID must be exactly as returned byGET /v1/modelsfor your key (case does not matter). If the model is missing from the list, ask your workspace administrator to enable it.Connection errors, or
Not Found: {"error":{"message":"Not Found"}}on every request – check that the Base URL is exactlyhttps://api.nexos.ai/v1, including/v1, and that the Provider API matches the models (see Choosing the Provider API).The model list does not load – check the API key and click Fetch models. You can always add model IDs manually. For Anthropic Messages, models are never fetched automatically.
The agent answers in plain text but never edits files, or errors mention
tools– the selected model does not support native tool calling. Switch to a model that does and set"tool_call": true.Long sessions fail with a context-length error –
limit.contextis not set, so Kilo never compacts the conversation. See step 4.A model disappears from the picker after editing
kilo.jsonc, with aSkipped invalid model configurationwarning –limitneeds bothcontextandoutput, andcostneeds bothinputandoutput. Config warnings are listed in View → Output → Kilo Config Warnings.Long Claude sessions are expensive – Claude through OpenAI Compatible gets no prompt caching. Use a provider with Anthropic Messages for Claude models.
"thinking.type.enabled" is not supported for this modelwhen choosing a reasoning level for a Claude model – define adaptive thinkingvariantsfor the model. See Choosing the Provider API.Claude answers but no thinking is shown – add
"display": "summarized"to thethinkingobject of each variant, and check Settings → Display → Reasoning Blocks.Model not found: nexos/…although the model is in your config – the config file was rejected. Runkilo config checkin the project directory to see why. A common cause isenvironment references are not allowed in project config: the provider is defined in a project-levelkilo.jsonusing{env:…}. Move it to~/.config/kilo/kilo.jsonc.Config error
provider.nexos.models: Expected object | undefined, got [...]–modelsmust be an object keyed by model ID, not an array.Requests do not show up in the nexos.ai usage dashboard – you are signed in to Kilo and a Kilo Gateway model is selected. See Keep all traffic on nexos.ai.
For request-level debugging in VS Code run Developer: Open Webview Developer Tools from the Command Palette and check the Console and Network tabs; config problems are listed under View → Output → Kilo Config Warnings. CLI logs are under ~/.local/share/kilo/log. Community help: Kilo Code Discord, GitHub Issues.
Last updated

