mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-29 03:44:06 +08:00
Merge pull request #10881 from Kilo-Org/christiaan/mistral
Add Mistral Kilo gateway provider
This commit is contained in:
@@ -137,8 +137,9 @@
|
||||
"dependencies": {
|
||||
"@ai-sdk/alibaba": "1.0.17",
|
||||
"@ai-sdk/anthropic": "3.0.71",
|
||||
"@ai-sdk/mistral": "3.0.27",
|
||||
"@ai-sdk/openai": "3.0.53",
|
||||
"@ai-sdk/openai-compatible": "2.0.37",
|
||||
"@ai-sdk/openai-compatible": "2.0.41",
|
||||
"@clack/prompts": "1.0.0-alpha.1",
|
||||
"@kilocode/plugin": "workspace:*",
|
||||
"@kilocode/sdk": "workspace:*",
|
||||
@@ -4598,8 +4599,6 @@
|
||||
|
||||
"@kilocode/kilo-docs/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
||||
|
||||
"@kilocode/kilo-gateway/@ai-sdk/openai-compatible": ["@ai-sdk/openai-compatible@2.0.37", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.21" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-+POSFVcgiu47BK64dhsI6OpcDC0/VAE2ZSaXdXGNNhpC/ava++uSRJYks0k2bpfY0wwCTgpAWZsXn/dG2Yppiw=="],
|
||||
|
||||
"@kilocode/kilo-indexing/glob": ["glob@13.0.6", "", { "dependencies": { "minimatch": "^10.2.2", "minipass": "^7.1.3", "path-scurry": "^2.0.2" } }, "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw=="],
|
||||
|
||||
"@manypkg/find-root/@types/node": ["@types/node@24.12.2", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g=="],
|
||||
@@ -5210,8 +5209,6 @@
|
||||
|
||||
"@hey-api/openapi-ts/open/wsl-utils": ["wsl-utils@0.3.1", "", { "dependencies": { "is-wsl": "^3.1.0", "powershell-utils": "^0.1.0" } }, "sha512-g/eziiSUNBSsdDJtCLB8bdYEUMj4jR7AGeUo96p/3dTafgjHhpF4RiCFPiRILwjQoDXx5MqkBr4fwWtR3Ky4Wg=="],
|
||||
|
||||
"@kilocode/kilo-gateway/@ai-sdk/openai-compatible/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.21", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-MtFUYI1/8mgDvRmaBDjbLJPFFrMG777AvSgyIFQtZHIMzm88R/12vYBBpnk7pfiWLFE1DSZzY4WDYzGbKAcmiw=="],
|
||||
|
||||
"@manypkg/find-root/find-up/locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],
|
||||
|
||||
"@morphllm/morphsdk/ai/@ai-sdk/gateway": ["@ai-sdk/gateway@3.0.95", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.23", "@vercel/oidc": "3.1.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ZmUNNbZl3V42xwQzPaNUi+s8eqR2lnrxf0bvB6YbLXpLjHYv0k2Y78t12cNOfY0bxGeuVVTLyk856uLuQIuXEQ=="],
|
||||
@@ -5622,8 +5619,6 @@
|
||||
|
||||
"@eslint/eslintrc/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
|
||||
|
||||
"@kilocode/kilo-gateway/@ai-sdk/openai-compatible/@ai-sdk/provider-utils/@standard-schema/spec": ["@standard-schema/spec@1.1.0", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
|
||||
|
||||
"@manypkg/find-root/find-up/locate-path/p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="],
|
||||
|
||||
"@morphllm/morphsdk/ai/@ai-sdk/gateway/@vercel/oidc": ["@vercel/oidc@3.1.0", "", {}, "sha512-Fw28YZpRnA3cAHHDlkt7xQHiJ0fcL+NRcIqsocZQUSmbzeIKRpwttJjik5ZGanXP+vlA4SbTg+AbA3bP363l+w=="],
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
"@ai-sdk/alibaba": "1.0.17",
|
||||
"@ai-sdk/anthropic": "3.0.71",
|
||||
"@ai-sdk/openai": "3.0.53",
|
||||
"@ai-sdk/openai-compatible": "2.0.37",
|
||||
"@ai-sdk/openai-compatible": "2.0.41",
|
||||
"@ai-sdk/mistral": "3.0.27",
|
||||
"@openrouter/ai-sdk-provider": "2.8.1",
|
||||
"@clack/prompts": "1.0.0-alpha.1",
|
||||
"ai": "catalog:",
|
||||
|
||||
@@ -100,4 +100,11 @@ export const PROMPTS = [
|
||||
"gpt55",
|
||||
] as const
|
||||
|
||||
export const AI_SDK_PROVIDERS = ["alibaba", "anthropic", "openai", "openai-compatible", "openrouter"] as const
|
||||
export const AI_SDK_PROVIDERS = [
|
||||
"alibaba",
|
||||
"anthropic",
|
||||
"mistral",
|
||||
"openai",
|
||||
"openai-compatible",
|
||||
"openrouter",
|
||||
] as const
|
||||
|
||||
@@ -3,6 +3,7 @@ import { createAlibaba } from "@ai-sdk/alibaba"
|
||||
import { createAnthropic } from "@ai-sdk/anthropic"
|
||||
import { createOpenAI } from "@ai-sdk/openai"
|
||||
import { createOpenAICompatible } from "@ai-sdk/openai-compatible"
|
||||
import { createMistral } from "@ai-sdk/mistral"
|
||||
import type { KiloProvider, KiloProviderOptions } from "./types.js"
|
||||
import { getApiKey } from "./auth/token.js"
|
||||
import { buildKiloHeaders, getDefaultHeaders } from "./headers.js"
|
||||
@@ -80,6 +81,7 @@ export function createKilo(options: KiloProviderOptions = {}): KiloProvider {
|
||||
const anthropic = createAnthropic(sdkOptions)
|
||||
const openai = createOpenAI(sdkOptions)
|
||||
const openaiCompatible = createOpenAICompatible({ ...sdkOptions, name: "openaiCompatible" })
|
||||
const mistral = createMistral(sdkOptions)
|
||||
|
||||
return {
|
||||
languageModel(modelId) {
|
||||
@@ -100,6 +102,9 @@ export function createKilo(options: KiloProviderOptions = {}): KiloProvider {
|
||||
anthropic(modelId) {
|
||||
return anthropic(modelId)
|
||||
},
|
||||
mistral(modelId) {
|
||||
return mistral(modelId)
|
||||
},
|
||||
openai(modelId) {
|
||||
return openai(modelId)
|
||||
},
|
||||
|
||||
@@ -162,6 +162,7 @@ export interface ProviderInfo {
|
||||
export type KiloProvider = Provider & {
|
||||
alibaba(modelId: string): LanguageModel
|
||||
anthropic(modelId: string): LanguageModel
|
||||
mistral(modelId: string): LanguageModel
|
||||
openai(modelId: string): LanguageModel
|
||||
openaiCompatible(modelId: string): LanguageModel
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { AlibabaProviderOptions } from "@ai-sdk/alibaba"
|
||||
import type { AnthropicProviderOptions } from "@ai-sdk/anthropic"
|
||||
import type { MistralLanguageModelOptions } from "@ai-sdk/mistral"
|
||||
import type { OpenAIResponsesProviderOptions } from "@ai-sdk/openai"
|
||||
import type { OpenAICompatibleProviderOptions } from "@ai-sdk/openai-compatible"
|
||||
import type { OpenRouterProviderOptions } from "@openrouter/ai-sdk-provider"
|
||||
@@ -29,5 +30,8 @@ export function kiloProviderOptions(options: { [x: string]: any }) {
|
||||
result.alibaba = {
|
||||
enableThinking: openrouter.reasoning?.enabled,
|
||||
} satisfies AlibabaProviderOptions
|
||||
result.mistral = {
|
||||
reasoningEffort: openrouter.reasoning?.enabled ? "high" : undefined,
|
||||
} satisfies MistralLanguageModelOptions
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -141,6 +141,7 @@ export function kiloCustomLoaders(dep: CustomDep): Record<string, CustomLoader>
|
||||
const provider = input.models[modelID]?.ai_sdk_provider
|
||||
if (provider === "alibaba") return sdk.alibaba(modelID)
|
||||
if (provider === "anthropic") return sdk.anthropic(modelID)
|
||||
if (provider === "mistral") return sdk.mistral(modelID)
|
||||
if (provider === "openai") return sdk.openai(modelID)
|
||||
if (provider === "openai-compatible") return sdk.openaiCompatible(modelID)
|
||||
return sdk.languageModel(modelID)
|
||||
|
||||
@@ -1213,7 +1213,7 @@ export type ProviderConfig = {
|
||||
family?: string
|
||||
prompt?: "codex" | "gemini" | "beast" | "anthropic" | "trinity" | "anthropic_without_todo" | "ling" | "gpt55"
|
||||
isFree?: boolean
|
||||
ai_sdk_provider?: "alibaba" | "anthropic" | "openai" | "openai-compatible" | "openrouter"
|
||||
ai_sdk_provider?: "alibaba" | "anthropic" | "mistral" | "openai" | "openai-compatible" | "openrouter"
|
||||
release_date?: string
|
||||
attachment?: boolean
|
||||
reasoning?: boolean
|
||||
@@ -1543,7 +1543,7 @@ export type Model = {
|
||||
recommendedIndex?: number
|
||||
prompt?: "codex" | "gemini" | "beast" | "anthropic" | "trinity" | "anthropic_without_todo" | "ling" | "gpt55"
|
||||
isFree?: boolean
|
||||
ai_sdk_provider?: "alibaba" | "anthropic" | "openai" | "openai-compatible" | "openrouter"
|
||||
ai_sdk_provider?: "alibaba" | "anthropic" | "mistral" | "openai" | "openai-compatible" | "openrouter"
|
||||
}
|
||||
|
||||
export type Provider = {
|
||||
|
||||
@@ -17574,7 +17574,7 @@
|
||||
},
|
||||
"ai_sdk_provider": {
|
||||
"type": "string",
|
||||
"enum": ["alibaba", "anthropic", "openai", "openai-compatible", "openrouter"]
|
||||
"enum": ["alibaba", "anthropic", "mistral", "openai", "openai-compatible", "openrouter"]
|
||||
},
|
||||
"release_date": {
|
||||
"type": "string"
|
||||
@@ -18529,7 +18529,7 @@
|
||||
},
|
||||
"ai_sdk_provider": {
|
||||
"type": "string",
|
||||
"enum": ["alibaba", "anthropic", "openai", "openai-compatible", "openrouter"]
|
||||
"enum": ["alibaba", "anthropic", "mistral", "openai", "openai-compatible", "openrouter"]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
Reference in New Issue
Block a user