Kimi Integration (LLM Provider)
Integrate Kimi/Moonshot as LLM Provider
Related: technical-docs#170
Overview
Kimi (Moonshot AI, K2.5) offers long-context and visual-coding capabilities via API. This page describes how to add Kimi as an LLM provider in @bluefly/foundation-bridge so Drupal and other platform tools can call it (e.g. URL rebuilding, fully qualified Drupal sites with Canvas/React).
Architecture
- All tools MUST call through foundation-bridge or agent-router, not Kimi directly.
- Router selects provider (Ollama, Kimi, OpenAI, Anthropic) by config or task.
- Env: add
MOONSHOT_API_KEYorKIMI_API_KEYto platform secrets (.env.localorconfig/tokens/).
Implementation Checklist
-
foundation-bridge
- Add Moonshot/Kimi provider (same pattern as Ollama, OpenAI, Anthropic).
- Use Moonshot API base URL (e.g.
https://api.moonshot.cn/v1) and OpenAI-compatible client if supported. - Config:
provider: 'kimi',model,apiKeyfrom env.
-
agent-router
- Register Kimi as a routable provider; add cost/context rules if needed.
-
Secrets
- On Oracle (tunnel): add to
/root/.env.local. - On NAS/Mac: add to
/Volumes/AgentPlatform/.env.localorconfig/tokens/. - Variable:
MOONSHOT_API_KEYorKIMI_API_KEY.
- On Oracle (tunnel): add to
-
Documentation
- Wiki: how to enable Kimi for Drupal/Canvas flows (this page).
- Document in CLAUDE.md or AGENTS.md that Kimi is an optional provider.
Enabling Kimi for Drupal/Canvas
- Drupal or Canvas apps must NOT call Kimi directly. They call the platform LLM gateway (router or foundation-bridge) with an optional
provider: kimihint. - Configure the gateway to allow Kimi and set the API key in env so the gateway can authenticate to Moonshot.
References
- Kimi: https://www.kimi.com/en
- Moonshot API: https://platform.moonshot.cn/docs (API key and base URL)
- foundation-bridge: owns all LLM provider implementations (separation of duties)