Merge pull request #92 from Kilo-Org/add-auto-model
This commit is contained in:
@@ -10,6 +10,7 @@ import * as fuzzysort from "fuzzysort"
|
||||
|
||||
// kilocode_change start - Recommended models for Kilo Gateway (order determines display priority)
|
||||
const KILO_RECOMMENDED_MODELS = [
|
||||
"kilo/auto",
|
||||
"anthropic/claude-sonnet-4.5",
|
||||
"anthropic/claude-opus-4.5",
|
||||
"anthropic/claude-haiku-4.5",
|
||||
|
||||
@@ -135,7 +135,27 @@ export namespace ModelsDev {
|
||||
: "https://api.kilo.ai/api/openrouter"
|
||||
const providerBaseURL = normalizedBaseURL ?? defaultBaseURL
|
||||
const ensureTrailingSlash = (value: string): string => (value.endsWith("/") ? value : `${value}/`)
|
||||
const kiloModels = await ModelCache.fetch("kilo", kiloFetchOptions).catch(() => ({}))
|
||||
const kiloModels: Record<string, any> = await ModelCache.fetch("kilo", kiloFetchOptions).catch(() => ({}))
|
||||
|
||||
// Virtual model that resolves to Kilo's default model at runtime.
|
||||
// Appears as `kilo/auto` in model selectors.
|
||||
kiloModels["kilo/auto"] = {
|
||||
id: "kilo/auto",
|
||||
name: "Auto",
|
||||
family: "kilo",
|
||||
release_date: "2020-01-01",
|
||||
attachment: false,
|
||||
reasoning: true,
|
||||
temperature: true,
|
||||
tool_call: true,
|
||||
limit: {
|
||||
context: 200000,
|
||||
output: 64000,
|
||||
},
|
||||
options: {
|
||||
description: "Automatically selects an optimal model",
|
||||
},
|
||||
}
|
||||
providers["kilo"] = {
|
||||
id: "kilo",
|
||||
name: "Kilo Gateway",
|
||||
|
||||
@@ -1190,6 +1190,8 @@ export namespace Provider {
|
||||
export function sort(models: Model[]) {
|
||||
return sortBy(
|
||||
models,
|
||||
// kilocode_change - keep `kilo/auto` at the top for Kilo Gateway
|
||||
[(model) => (model.providerID === "kilo" && model.id === "kilo/auto" ? 1 : 0), "desc"],
|
||||
[(model) => priority.findIndex((filter) => model.id.includes(filter)), "desc"],
|
||||
[(model) => (model.id.includes("latest") ? 0 : 1), "asc"],
|
||||
[(model) => model.id, "desc"],
|
||||
|
||||
@@ -229,6 +229,9 @@ export namespace LLM {
|
||||
: input.model.providerID !== "anthropic"
|
||||
? DEFAULT_HEADERS // kilocode_change
|
||||
: undefined),
|
||||
...(input.model.api.npm === "@kilocode/kilo-gateway" && input.agent.name
|
||||
? { "x-kilocode-mode": input.agent.name.toLowerCase() }
|
||||
: {}),
|
||||
...input.model.headers,
|
||||
...headers,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user