feat: Add Kilo Gateway provider (#20212)

* feat: Add Kilo Gateway provider

Add support for Kilo Gateway as a model provider, similar to OpenRouter.
Kilo Gateway provides a unified API that routes requests to many models
behind a single endpoint and API key.

Changes:
- Add kilocode provider option to auth-choice and onboarding flows
- Add KILOCODE_API_KEY environment variable support
- Add kilocode/ model prefix handling in model-auth and extra-params
- Add provider documentation in docs/providers/kilocode.md
- Update model-providers.md with Kilo Gateway section
- Add design doc for the integration

* kilocode: add provider tests and normalize onboard auth-choice registration

* kilocode: register in resolveImplicitProviders so models appear in provider filter

* kilocode: update base URL from /api/openrouter/ to /api/gateway/

* docs: fix formatting in kilocode docs

* fix: address PR review — remove kilocode from cacheRetention, fix stale model refs and CLI name in docs, fix TS2742

* docs: fix stale refs in design doc — Moltbot to OpenClaw, MoltbotConfig to OpenClawConfig, remove extra-params section, fix doc path

* fix: use resolveAgentModelPrimaryValue for AgentModelConfig union type

---------

Co-authored-by: Mark IJbema <mark@kilocode.ai>
This commit is contained in:
John Fawcett
2026-02-23 17:29:27 -06:00
committed by GitHub
parent ddb7ec99a8
commit 13f32e2f7d
23 changed files with 1020 additions and 1 deletions

View File

@@ -23,6 +23,8 @@ import {
applyAuthProfileConfig,
applyCloudflareAiGatewayConfig,
applyCloudflareAiGatewayProviderConfig,
applyKilocodeConfig,
applyKilocodeProviderConfig,
applyQianfanConfig,
applyQianfanProviderConfig,
applyKimiCodeConfig,
@@ -50,6 +52,7 @@ import {
applyZaiConfig,
applyZaiProviderConfig,
CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF,
KILOCODE_DEFAULT_MODEL_REF,
LITELLM_DEFAULT_MODEL_REF,
QIANFAN_DEFAULT_MODEL_REF,
KIMI_CODING_MODEL_REF,
@@ -63,6 +66,7 @@ import {
setCloudflareAiGatewayConfig,
setQianfanApiKey,
setGeminiApiKey,
setKilocodeApiKey,
setLitellmApiKey,
setKimiCodingApiKey,
setMistralApiKey,
@@ -97,6 +101,7 @@ const API_KEY_TOKEN_PROVIDER_AUTH_CHOICE: Record<string, AuthChoice> = {
huggingface: "huggingface-api-key",
mistral: "mistral-api-key",
opencode: "opencode-zen",
kilocode: "kilocode-api-key",
qianfan: "qianfan-api-key",
};
@@ -277,6 +282,18 @@ const SIMPLE_API_KEY_PROVIDER_FLOWS: Partial<Record<AuthChoice, SimpleApiKeyProv
].join("\n"),
noteTitle: "QIANFAN",
},
"kilocode-api-key": {
provider: "kilocode",
profileId: "kilocode:default",
expectedProviders: ["kilocode"],
envLabel: "KILOCODE_API_KEY",
promptMessage: "Enter Kilo Gateway API key",
setCredential: setKilocodeApiKey,
defaultModel: KILOCODE_DEFAULT_MODEL_REF,
applyDefaultConfig: applyKilocodeConfig,
applyProviderConfig: applyKilocodeProviderConfig,
noteDefault: KILOCODE_DEFAULT_MODEL_REF,
},
"synthetic-api-key": {
provider: "synthetic",
profileId: "synthetic:default",