Kimi Code joins as an OAuth plan provider: RFC 8628 device flow, verified against the live endpoints

- New oauth/kimi-code-flow.ts mirrors the official kimi-cli: form-encoded device_authorization + token polling at auth.kimi.com with the required X-Msh-* device headers, pure poll interpreter, 15-minute tokens refreshed via refresh_token grant
- Agent loop runs chat completions at https://api.kimi.com/coding/v1 with the Bearer access token; default model kimi-for-coding (kimi-for-coding-highspeed for Allegretto+ plans)
- Live model listing via /coding/v1/models; credential refresh wired into the turn credential resolver
- Migration 057 seeds the provider (disabled) into existing organizations
- Wire protocol probed live: device code issued, authorization_pending poll observed, 401 envelope on the coding API confirmed
This commit is contained in:
ZacharyZhang-NY committed 2026-07-10 17:18:31 -04:00
1 parent 813276de71
commit 327de38e78
14 files changed
+281 -2

No files matched your search

+9
View File
@@ -119,6 +119,15 @@ const RAW_CATALOG: Omit<ProviderCatalogEntry, "models" | "supportsLiveModels">[]
signInUrl: "https://chatgpt.com/codex",
credentialHelp: "Sign in to ChatGPT Plus/Pro in the browser; AgentCompany finishes the handshake.",
},
{
key: "kimi-code",
label: "Kimi Code",
authType: PROVIDER_AUTH_TYPE.OAUTH_PKCE,
defaultModel: "kimi-for-coding",
capabilityTags: ["account", "coding"],
signInUrl: "https://www.kimi.com/code",
credentialHelp: "Sign in with your Kimi plan account in the browser; AgentCompany finishes the device-code handshake.",
},
{
key: "azure-openai",
label: "Azure OpenAI",
+4
View File
@@ -226,6 +226,10 @@ export const PROVIDER_MODELS: Record<string, ProviderModelEntry[]> = {
],
kimi: KIMI_MODELS,
"kimi-cn": KIMI_MODELS,
"kimi-code": [
{ id: "kimi-for-coding", name: "Kimi for Coding" },
{ id: "kimi-for-coding-highspeed", name: "Kimi for Coding Highspeed" },
],
openrouter: [
{ id: "anthropic/claude-sonnet-4.5", name: "Anthropic: Claude Sonnet 4.5" },
{ id: "anthropic/claude-opus-4.5", name: "Anthropic: Claude Opus 4.5" },