From 9f02148688e81c2cc3f222728cda6e35cc0cde4c Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Jul 2026 04:04:01 +0000 Subject: [PATCH] Add Kimi (Moonshot AI) provider to Agent Network catalog Adds a first-class kimi_api catalog entry so operators can govern Kimi K3 and K2 Thinking traffic through the Agent Network proxy instead of riding the generic custom/vllm entry. ParserID is left empty so the proxy's URL sniffer dispatches both body shapes Moonshot serves on the same host and key: the OpenAI-compatible /v1/chat/completions endpoint and the Anthropic-compatible /anthropic/v1/messages endpoint that Moonshot's official Claude Code setup uses (same pattern as the Bifrost gateway entry). Pricing defaults cover both parser surfaces, including the kimi-k3[1m] model id some Claude Code guides use for the 1M-context alias, so cost metering doesn't silently skip those requests. The dashboard's PROVIDER_CATALOG needs a matching entry (separate repo). --- .../modules/agentnetwork/catalog/catalog.go | 39 +++++++++++++++++++ .../llm/pricing/defaults_pricing.yaml | 30 ++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/management/internals/modules/agentnetwork/catalog/catalog.go b/management/internals/modules/agentnetwork/catalog/catalog.go index f82cffae6..3c57ce5b7 100644 --- a/management/internals/modules/agentnetwork/catalog/catalog.go +++ b/management/internals/modules/agentnetwork/catalog/catalog.go @@ -420,6 +420,45 @@ var providers = []Provider{ {ID: "mistral-embed", Label: "Mistral Embed", InputPer1k: 0.0001, OutputPer1k: 0, ContextWindow: 8192}, }, }, + { + ID: "kimi_api", + Kind: KindProvider, + Name: "Kimi (Moonshot AI) API", + Description: "Kimi K3 / K2 models via the Moonshot AI platform", + DefaultHost: "api.moonshot.ai", + AuthHeaderName: "Authorization", + AuthHeaderTemplate: "Bearer ${API_KEY}", + DefaultContentType: "application/json", + BrandColor: "#1A1A2E", + // ParserID empty on purpose: Moonshot serves two body shapes on + // the same host and key, and the proxy's URL sniffer dispatches + // both (same pattern as Bifrost). /v1/chat/completions matches + // OpenAIParser; the Anthropic-compatible endpoint the official + // Claude Code guide uses (/anthropic/v1/messages) contains + // "/v1/messages" and matches AnthropicParser. Pinning "openai" + // here would misparse the Claude Code path — the primary way + // teams consume Kimi for coding today. Both endpoints accept the + // same Moonshot key via Authorization: Bearer (Claude Code's + // ANTHROPIC_AUTH_TOKEN rides that header too). + // + // api.moonshot.ai is the international platform; mainland-China + // accounts live on api.moonshot.cn with separate billing — + // operators there override the host on the provider record. The + // kimi.com subscription coding endpoint (api.kimi.com/coding, + // model id "k3") is account-bound seat licensing rather than a + // meterable platform key, so it's deliberately not the default. + ParserID: "", + // Pricing per Moonshot's platform rates at K3 launch (July 2026): + // K3 $3/$15 per MTok with $0.30 cached input, flat across the + // 1M-token window; K2 Thinking $0.60/$2.50 with $0.15 cache hits. + // Kimi K3 has a single always-on-reasoning SKU — no mini/turbo + // variants at launch. The consumer app's "K3 Swarm Max" mode is + // not an API SKU, so it doesn't appear here. + Models: []Model{ + {ID: "kimi-k3", Label: "Kimi K3", InputPer1k: 0.003, OutputPer1k: 0.015, ContextWindow: 1000000}, + {ID: "kimi-k2-thinking", Label: "Kimi K2 Thinking", InputPer1k: 0.0006, OutputPer1k: 0.0025, ContextWindow: 262144}, + }, + }, { ID: "litellm_proxy", Kind: KindGateway, diff --git a/proxy/internal/llm/pricing/defaults_pricing.yaml b/proxy/internal/llm/pricing/defaults_pricing.yaml index cd5c64fbf..9f9f4ae78 100644 --- a/proxy/internal/llm/pricing/defaults_pricing.yaml +++ b/proxy/internal/llm/pricing/defaults_pricing.yaml @@ -161,6 +161,18 @@ openai: input_per_1k: 0.0001 output_per_1k: 0 + # Kimi / Moonshot AI (kimi_api) — OpenAI-compatible /v1 endpoint. Moonshot + # reports cache hits OpenAI-style when present; cached input is 10% of + # input for K3 ($0.30 vs $3.00 per MTok) and $0.15/MTok for K2 Thinking. + kimi-k3: + input_per_1k: 0.003 + output_per_1k: 0.015 + cached_input_per_1k: 0.0003 + kimi-k2-thinking: + input_per_1k: 0.0006 + output_per_1k: 0.0025 + cached_input_per_1k: 0.00015 + anthropic: # Claude 4.x family — cache reads ≈10% of input, cache writes ≈125% of input. # Pricing source: Anthropic's current published rates per million tokens, @@ -206,6 +218,24 @@ anthropic: cache_read_per_1k: 0.0001 cache_creation_per_1k: 0.00125 + # Kimi / Moonshot AI (kimi_api) via the Anthropic-compatible endpoint + # (/anthropic/v1/messages — the official Claude Code setup). Same rates + # as the OpenAI-shape entries above. "kimi-k3[1m]" is the model id some + # Claude Code guides set for the 1M-context alias; priced identically so + # cost metering doesn't silently skip those requests. + kimi-k3: + input_per_1k: 0.003 + output_per_1k: 0.015 + cache_read_per_1k: 0.0003 + "kimi-k3[1m]": + input_per_1k: 0.003 + output_per_1k: 0.015 + cache_read_per_1k: 0.0003 + kimi-k2-thinking: + input_per_1k: 0.0006 + output_per_1k: 0.0025 + cache_read_per_1k: 0.00015 + bedrock: # AWS Bedrock model ids, normalised by the request parser (cross-region # inference-profile prefix + version/throughput suffix stripped), e.g.