a5afc3f171
Add a device authorization grant flow (RFC 8628) for the kimi-coding provider, mirroring the official Kimi Code CLI: device authorization and token polling against https://auth.kimi.com, refresh-token rotation with retry/backoff, and Bearer auth via toAuth headers. The provider now offers 'Sign in with Kimi Code' alongside the existing KIMI_API_KEY auth. Host is overridable via KIMI_CODE_OAUTH_HOST / KIMI_OAUTH_HOST. Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
20 lines
812 B
TypeScript
20 lines
812 B
TypeScript
import { anthropicOAuth } from "./auth/oauth/anthropic.ts";
|
|
import { githubCopilotOAuth } from "./auth/oauth/github-copilot.ts";
|
|
import { kimiCodingOAuth } from "./auth/oauth/kimi-coding.ts";
|
|
import { registerBundledOAuthFlowLoaders } from "./auth/oauth/load.ts";
|
|
import { openaiCodexOAuth } from "./auth/oauth/openai-codex.ts";
|
|
import { createRadiusOAuth } from "./auth/oauth/radius.ts";
|
|
import { xaiOAuth } from "./auth/oauth/xai.ts";
|
|
|
|
/** Register OAuth flows statically embedded in the standalone Bun binary. */
|
|
export function registerBunOAuthFlows(): void {
|
|
registerBundledOAuthFlowLoaders({
|
|
anthropic: () => anthropicOAuth,
|
|
openaiCodex: () => openaiCodexOAuth,
|
|
githubCopilot: () => githubCopilotOAuth,
|
|
kimiCoding: () => kimiCodingOAuth,
|
|
xai: () => xaiOAuth,
|
|
radius: createRadiusOAuth,
|
|
});
|
|
}
|