Skip to content

Feature request: add Kimi (Moonshot AI) as a first-class LLM provider (direct MOONSHOT_API_KEY) #33

Description

@Broccolito

Please explain the motivation behind the feature request.

Add Kimi (Moonshot AI) as a first-class LLM provider, connecting directly to the Moonshot API. Kimi K2 is a strong long-context (256k) agentic/coding model family that several users want to use directly with their own Moonshot API key, without routing through a third party.

Today Kimi is only reachable indirectly via OpenRoutercrates/biorouter/src/providers/openrouter.rs lists moonshotai/kimi-k2.7-code and moonshotai/kimi-k2.6. There is no direct Moonshot provider: no MOONSHOT_API_KEY provider entry, so a user with a native Moonshot account can't point Biorouter at api.moonshot.ai and pay Moonshot directly.

What's already in place — this is a small addition, not a from-scratch integration:

  • The Kimi models and their context windows are already in the model registry (crates/biorouter/src/model.rs): moonshotai/kimi-k2.6, moonshotai/kimi-k2.7-code (262k) around L188–190, and kimi-k2.7 / kimi-k2.5 / kimi-k2.6 (262k) + kimi-k2 (131k) around L342–346, under a ── Moonshot Kimi ── comment.
  • The Moonshot API is OpenAI-compatible (/v1/chat/completions), so it fits Biorouter's existing OpenAI-engine plumbing directly.

Describe the solution you'd like

Add a direct Moonshot (Kimi) provider keyed by MOONSHOT_API_KEY, pointed at https://api.moonshot.ai/v1 (international) — with https://api.moonshot.cn/v1 as the China endpoint, ideally overridable like other providers' hosts.

Two clean implementation paths already exist in the tree:

  1. Declarative provider (lowest effort). Drop a crates/biorouter/src/providers/declarative/moonshot.json next to the existing deepseek.json / groq.json / mistral.json / inception.json. It's auto-registered by register_declarative_providers (crates/biorouter/src/config/declarative_providers.rs). Shape mirrors deepseek.json:

    {
      "name": "moonshot",
      "engine": "openai",
      "display_name": "Moonshot (Kimi)",
      "description": "Kimi K2 models from Moonshot AI",
      "api_key_env": "MOONSHOT_API_KEY",
      "base_url": "https://api.moonshot.ai/v1",
      "models": [ { "name": "kimi-k2.7", "context_limit": 262144, ... }, ... ],
      "supports_streaming": true
    }
  2. Native provider (like crates/biorouter/src/providers/zai.rs / xai.rs / venice.rs) if a curated known-models list, pricing, or a host override is wanted: MOONSHOT_API_HOST default https://api.moonshot.ai/v1, secret MOONSHOT_API_KEY, default model kimi-k2.7, then register it in crates/biorouter/src/providers/factory.rs alongside ZaiProvider / XaiProvider.

Either way, wire it into provider ordering / the onboarding + settings provider grid (Institutional/Commercial section) so it's discoverable, and align the exposed model IDs with the Moonshot platform's actual names (e.g. the kimi-k2* families) and the entries already in model.rs.

Describe alternatives you've considered

  • Use Kimi via OpenRouter (works today) — but it forces OpenRouter billing/keys and an extra hop, instead of a direct Moonshot account; latency and cost differ, and some users specifically have Moonshot credits.
  • The generic "custom OpenAI-compatible provider" path — a user can hand-configure a base URL + key, but that's undiscoverable, easy to misconfigure (endpoint, model IDs, context windows), and doesn't give Kimi a named, first-class entry with correct context limits (which are already known).

Additional context

  • Model registry entries to reuse: crates/biorouter/src/model.rs (~L188–190, ~L342–346).

  • Current indirect access: crates/biorouter/src/providers/openrouter.rs (~L42–43).

  • Declarative format + loader: crates/biorouter/src/providers/declarative/deepseek.json, crates/biorouter/src/config/declarative_providers.rs.

  • Native-provider reference: crates/biorouter/src/providers/zai.rs; registration in crates/biorouter/src/providers/factory.rs.

  • I have verified this does not duplicate an existing feature request

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions