mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
Switch kimi-coding to OpenAI Chat Completions at api.kimi.com/coding/v1, the protocol the official Kimi Code client uses. K3, K3-256K, and Kimi For Coding accept tools declared in later system messages, so tools loaded mid-conversation (e.g. by tool_search) keep the prompt cache. Highspeed rejects tool-bearing system messages and keeps added tools top-level. closes #10720
24 lines
836 B
TypeScript
24 lines
836 B
TypeScript
import { openAICompletionsApi } from "../api/openai-completions.lazy.ts";
|
|
import { envApiKeyAuth, lazyOAuth } from "../auth/helpers.ts";
|
|
import { loadKimiCodingOAuth } from "../auth/oauth/load.ts";
|
|
import { createProvider, type Provider } from "../models.ts";
|
|
import { KIMI_CODING_MODELS } from "./kimi-coding.models.ts";
|
|
|
|
export function kimiCodingProvider(): Provider<"openai-completions"> {
|
|
return createProvider({
|
|
id: "kimi-coding",
|
|
name: "Kimi For Coding",
|
|
baseUrl: "https://api.kimi.com/coding/v1",
|
|
auth: {
|
|
apiKey: envApiKeyAuth("Kimi API key", ["KIMI_API_KEY"]),
|
|
oauth: lazyOAuth({
|
|
name: "Kimi Code (subscription)",
|
|
isSubscription: true,
|
|
loginLabel: "Sign in with Kimi Code",
|
|
load: loadKimiCodingOAuth,
|
|
}),
|
|
},
|
|
models: Object.values(KIMI_CODING_MODELS),
|
|
api: openAICompletionsApi(),
|
|
});
|
|
}
|