Skip to main content

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_KEY or KIMI_API_KEY to platform secrets (.env.local or config/tokens/).

Implementation Checklist

  1. 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, apiKey from env.
  2. agent-router

    • Register Kimi as a routable provider; add cost/context rules if needed.
  3. Secrets

    • On Oracle (tunnel): add to /root/.env.local.
    • On NAS/Mac: add to /Volumes/AgentPlatform/.env.local or config/tokens/.
    • Variable: MOONSHOT_API_KEY or KIMI_API_KEY.
  4. 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: kimi hint.
  • Configure the gateway to allow Kimi and set the API key in env so the gateway can authenticate to Moonshot.

References