Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: d981de1229ef899957bbe968bc8dcda02a21f477
25 lines
833 B
TypeScript
25 lines
833 B
TypeScript
import { anthropicMessagesApi } from "../api/anthropic-messages.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<"anthropic-messages"> {
|
|
return createProvider({
|
|
id: "kimi-coding",
|
|
name: "Kimi For Coding",
|
|
baseUrl: "https://api.kimi.com/coding",
|
|
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: anthropicMessagesApi(),
|
|
});
|
|
}
|