diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index 91735c36..6fff07ba 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +- Fixed built-in `kimi-coding` model generation to attach `User-Agent: KimiCLI/1.5` to all generated Kimi models, overriding the Anthropic SDK default UA so direct Kimi Coding requests use the provider's expected client identity ([#3586](https://github.com/badlogic/pi-mono/issues/3586)) + ## [0.69.0] - 2026-04-22 ### Breaking Changes diff --git a/packages/ai/scripts/generate-models.ts b/packages/ai/scripts/generate-models.ts index 29ea138d..990f8254 100644 --- a/packages/ai/scripts/generate-models.ts +++ b/packages/ai/scripts/generate-models.ts @@ -53,6 +53,10 @@ const COPILOT_STATIC_HEADERS = { "Copilot-Integration-Id": "vscode-chat", } as const; +const KIMI_STATIC_HEADERS = { + "User-Agent": "KimiCLI/1.5", +} as const; + const AI_GATEWAY_MODELS_URL = "https://ai-gateway.vercel.sh/v1"; const AI_GATEWAY_BASE_URL = "https://ai-gateway.vercel.sh"; const ZAI_TOOL_STREAM_UNSUPPORTED_MODELS = new Set(["glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v"]); @@ -665,6 +669,7 @@ async function loadModelsDevData(): Promise[]> { provider: "kimi-coding", // Kimi For Coding's Anthropic-compatible API - SDK appends /v1/messages baseUrl: "https://api.kimi.com/coding", + headers: { ...KIMI_STATIC_HEADERS }, reasoning: m.reasoning === true, input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"], cost: { diff --git a/packages/ai/src/models.generated.ts b/packages/ai/src/models.generated.ts index 196e73eb..aa790498 100644 --- a/packages/ai/src/models.generated.ts +++ b/packages/ai/src/models.generated.ts @@ -5120,6 +5120,7 @@ export const MODELS = { api: "anthropic-messages", provider: "kimi-coding", baseUrl: "https://api.kimi.com/coding", + headers: {"User-Agent":"KimiCLI/1.5"}, reasoning: true, input: ["text", "image"], cost: { @@ -5137,6 +5138,7 @@ export const MODELS = { api: "anthropic-messages", provider: "kimi-coding", baseUrl: "https://api.kimi.com/coding", + headers: {"User-Agent":"KimiCLI/1.5"}, reasoning: true, input: ["text", "image"], cost: { @@ -5154,6 +5156,7 @@ export const MODELS = { api: "anthropic-messages", provider: "kimi-coding", baseUrl: "https://api.kimi.com/coding", + headers: {"User-Agent":"KimiCLI/1.5"}, reasoning: true, input: ["text"], cost: {