Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/puny-brooms-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": minor
---

Thanks @pranjaldatta! Added support for Inception as a provider
3 changes: 2 additions & 1 deletion packages/types/src/global-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ export const SECRET_STATE_KEYS = [
// kilocode_change start
"kilocodeToken",
"syntheticApiKey",
"ovhCloudAiEndpointsApiKey",
"inceptionLabsApiKey",
// kilocode_change end
"codebaseIndexOpenAiCompatibleApiKey",
"codebaseIndexGeminiApiKey",
Expand All @@ -234,7 +236,6 @@ export const SECRET_STATE_KEYS = [
"featherlessApiKey",
"ioIntelligenceApiKey",
"vercelAiGatewayApiKey",
"ovhCloudAiEndpointsApiKey", // kilocode_change
] as const

// Global secrets that are part of GlobalSettings (not ProviderSettings)
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/kilocode/native-function-calling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const nativeFunctionCallingProviders = [
"zai",
"synthetic",
"human-relay",
"inception",
] satisfies ProviderName[] as ProviderName[]

const modelsDefaultingToNativeFunctionCalls = ["anthropic/claude-haiku-4.5"]
Expand Down
17 changes: 15 additions & 2 deletions packages/types/src/provider-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const dynamicProviders = [
"ovhcloud",
"chutes",
"gemini",
"inception",
// kilocode_change end
"deepinfra",
"io-intelligence",
Expand Down Expand Up @@ -149,6 +150,7 @@ export const providerNames = [
"gemini-cli",
"virtual-quota-fallback",
"synthetic",
"inception",
// kilocode_change end
"sambanova",
"vertex",
Expand Down Expand Up @@ -412,6 +414,12 @@ const sambaNovaSchema = apiModelIdProviderModelSchema.extend({
})

// kilocode_change start
const inceptionSchema = apiModelIdProviderModelSchema.extend({
inceptionLabsBaseUrl: z.string().optional(),
inceptionLabsApiKey: z.string().optional(),
inceptionLabsModelId: z.string().optional(),
})

const ovhcloudSchema = baseProviderSettingsSchema.extend({
ovhCloudAiEndpointsApiKey: z.string().optional(),
ovhCloudAiEndpointsModelId: z.string().optional(),
Expand Down Expand Up @@ -523,6 +531,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
kilocodeSchema.merge(z.object({ apiProvider: z.literal("kilocode") })),
virtualQuotaFallbackSchema.merge(z.object({ apiProvider: z.literal("virtual-quota-fallback") })),
syntheticSchema.merge(z.object({ apiProvider: z.literal("synthetic") })),
inceptionSchema.merge(z.object({ apiProvider: z.literal("inception") })),
// kilocode_change end
groqSchema.merge(z.object({ apiProvider: z.literal("groq") })),
huggingFaceSchema.merge(z.object({ apiProvider: z.literal("huggingface") })),
Expand Down Expand Up @@ -558,6 +567,8 @@ export const providerSettingsSchema = z.object({
...kilocodeSchema.shape,
...virtualQuotaFallbackSchema.shape,
...syntheticSchema.shape,
...ovhcloudSchema.shape,
...inceptionSchema.shape,
// kilocode_change end
...openAiNativeSchema.shape,
...mistralSchema.shape,
Expand All @@ -584,7 +595,6 @@ export const providerSettingsSchema = z.object({
...rooSchema.shape,
...vercelAiGatewaySchema.shape,
...codebaseIndexProviderSchema.shape,
...ovhcloudSchema.shape, // kilocode_change
})

export type ProviderSettings = z.infer<typeof providerSettingsSchema>
Expand Down Expand Up @@ -620,6 +630,7 @@ export const modelIdKeys = [
"deepInfraModelId",
"kilocodeModel",
"ovhCloudAiEndpointsModelId", // kilocode_change
"inceptionLabsModelId", // kilocode_change
] as const satisfies readonly (keyof ProviderSettings)[]

export type ModelIdKey = (typeof modelIdKeys)[number]
Expand Down Expand Up @@ -676,6 +687,7 @@ export const modelIdKeysByProvider: Record<TypicalProvider, ModelIdKey> = {
kilocode: "kilocodeModel",
"virtual-quota-fallback": "apiModelId",
ovhcloud: "ovhCloudAiEndpointsModelId", // kilocode_change
inception: "inceptionLabsModelId", // kilocode_change
}

/**
Expand Down Expand Up @@ -807,9 +819,10 @@ export const MODELS_BY_PROVIDER: Record<
openrouter: { id: "openrouter", label: "OpenRouter", models: [] },
requesty: { id: "requesty", label: "Requesty", models: [] },
unbound: { id: "unbound", label: "Unbound", models: [] },
ovhcloud: { id: "ovhcloud", label: "OVHcloud AI Endpoints", models: [] }, // kilocode_change

// kilocode_change start
ovhcloud: { id: "ovhcloud", label: "OVHcloud AI Endpoints", models: [] },
inception: { id: "inception", label: "Inception", models: [] },
kilocode: { id: "kilocode", label: "Kilocode", models: [] },
"kilocode-openrouter": { id: "kilocode-openrouter", label: "Kilocode", models: [] }, // temporarily needed to satisfy because we're using 2 inconsistent names apparently
"virtual-quota-fallback": { id: "virtual-quota-fallback", label: "Virtual Quota Fallback", models: [] },
Expand Down
18 changes: 18 additions & 0 deletions packages/types/src/providers/inception.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// kilocode_change - file added

import type { ModelInfo } from "../model.js"

// Default fallback values for Inception when model metadata is not yet loaded.

export const inceptionDefaultModelId = "mercury-coder"

export const inceptionDefaultModelInfo: ModelInfo = {
maxTokens: 8192,
contextWindow: 128000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.00000025,
outputPrice: 0.000001,
cacheReadsPrice: 0,
cacheWritesPrice: 0,
}
1 change: 1 addition & 0 deletions packages/types/src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * from "./gemini.js"
export * from "./gemini-cli.js"
export * from "./ovhcloud.js"
export * from "./synthetic.js"
export * from "./inception.js"
// kilocode_change end
export * from "./glama.js"
export * from "./groq.js"
Expand Down
9 changes: 5 additions & 4 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
} from "./providers"
// kilocode_change start
import { KilocodeOpenrouterHandler } from "./providers/kilocode-openrouter"
import { InceptionLabsHandler } from "./providers/inception"
// kilocode_change end
import { NativeOllamaHandler } from "./providers/native-ollama"

Expand Down Expand Up @@ -191,6 +192,10 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
// kilocode_change start
case "synthetic":
return new SyntheticHandler(options)
case "inception":
return new InceptionLabsHandler(options)
case "ovhcloud":
return new OVHcloudAIEndpointsHandler(options)
// kilocode_change end
case "io-intelligence":
return new IOIntelligenceHandler(options)
Expand All @@ -202,10 +207,6 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
return new FeatherlessHandler(options)
case "vercel-ai-gateway":
return new VercelAiGatewayHandler(options)
// kilocode_change start
case "ovhcloud":
return new OVHcloudAIEndpointsHandler(options)
// kilocode_change end
default:
apiProvider satisfies "gemini-cli" | undefined
return new AnthropicHandler(options)
Expand Down
70 changes: 70 additions & 0 deletions src/api/providers/fetchers/inception.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// kilocode_change - file added

import axios from "axios"
import { object, z } from "zod"

import { type ModelInfo } from "@roo-code/types"

import { DEFAULT_HEADERS } from "../constants"

// Inception models endpoint follows OpenAI /models shape wiht an added metadata object

const InceptionModelPricingSchema = z.object({
prompt: z.number().describe("Pricing per 1 input token"),
completion: z.number().describe("Pricing per 1 output token"),
image: z.number().describe("Pricing per 1 image"),
request: z.number().describe("Pricing per 1 request"),
input_cache_reads: z.number().describe("Pricing per 1 token for cache reads"),
input_cache_writes: z.number().describe("Pricing per 1 token for cache writes"),
})

const InceptionModelSchema = z.object({
id: z.string(),
name: z.string(),
created: z.number(),
input_modalities: z.string().array(),
output_modalities: z.string().array(),
context_length: z.number().int(),
max_output_length: z.number().int(),
pricing: InceptionModelPricingSchema,
suported_sampling_parameters: z.string().array(),
supported_features: z.string().array(),
supports_prefix_caching: z.boolean().default(false),

description: z.string().optional(),
})

const InceptionModelsResponseSchema = z.object({ data: z.array(InceptionModelSchema) })

export async function getInceptionModels(
apiKey?: string,
baseUrl: string = "https://api.inceptionlabs.ai/v1/",
): Promise<Record<string, ModelInfo>> {
const models: Record<string, ModelInfo> = {}
const url = `${baseUrl.replace(/\/$/, "")}/models`
const headers: Record<string, string> = { ...DEFAULT_HEADERS }

if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`

const response = await axios.get(url, { headers })

const parsed = InceptionModelsResponseSchema.safeParse(response.data)
const data = parsed.success ? parsed.data.data : response.data?.data || []

for (const m of data as Array<z.infer<typeof InceptionModelSchema>>) {
const info: ModelInfo = {
contextWindow: m.context_length,
maxTokens: m.max_output_length,
inputPrice: m.pricing.prompt,
outputPrice: m.pricing.completion,
description: m.description,
supportsPromptCache: m.supports_prefix_caching,
supportsImages: false,
cacheReadsPrice: m.pricing.input_cache_reads,
cacheWritesPrice: m.pricing.input_cache_writes,
}
models[m.id] = info
}

return models
}
4 changes: 4 additions & 0 deletions src/api/providers/fetchers/modelCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { getIOIntelligenceModels } from "./io-intelligence"
import { getOvhCloudAiEndpointsModels } from "./ovhcloud"
import { getChutesModels } from "./chutes"
import { getGeminiModels } from "./gemini"
import { getInceptionModels } from "./inception"
// kilocode_change end

import { getDeepInfraModels } from "./deepinfra"
Expand Down Expand Up @@ -133,6 +134,9 @@ export const getModels = async (options: GetModelsOptions): Promise<ModelRecord>
models = await getHuggingFaceModels()
break
// kilocode_change start
case "inception":
models = await getInceptionModels()
break
case "ovhcloud":
models = await getOvhCloudAiEndpointsModels()
break
Expand Down
Loading
Loading