Skip to content

feat: Support Kimi Code API (Moonshot) and fix protocol compatibility for Claude Code / Agentic LLM routing #949

@lucasllin

Description

@lucasllin

Description

Plano is a fantastic LLM gateway for agentic apps! I would like to request native provider support (or an elegant configuration mapping) for the Kimi Code API (Moonshot AI).

Currently, developers trying to use Kimi's specialized coding endpoint inside advanced CLI agents like Claude Code run into protocol compatibility/hanging issues that Plano is perfectly positioned to solve.

The Problem / Context

Kimi recently released a dedicated coding API with the following specifications:

  • Base URL: https://api.kimi.com/coding/v1
  • Model ID: kimi-for-coding

Current Behavior:

  • Testing via curl works perfectly, proving the endpoint and API Key are valid.
  • Testing via Claude Code (using CLAUDE_BASE_URL) hangs or gets no response. This is likely because Claude Code strictly enforces certain OpenAI/Anthropic spec fields (e.g., streaming chunk structures, usage tokens, or rigid trailing slash append behavior like /v1/chat/completions) that the Kimi endpoint doesn't strictly match.

Proposed Feature / Solution

We need Plano to act as the robust translation layer between strict agentic clients (like Claude Code) and the Kimi Code API.

Ideally, we should be able to define Kimi as an upstream provider in plano_config.yaml like this:

version: v0.4.0

llm_providers:
  - model: moonshotai/kimi-for-coding
    access_key: $MOONSHOTAI_API_KEY
    base_url: https://api.kimi.com/coding/v1
    headers:
      User-Agent: "KimiCLI/1.3"

  - model: deepseek/deepseek-v4-pro
    access_key: $DEEPSEEK_API_KEY

  - model: deepseek/deepseek-v4-flash
    access_key: $DEEPSEEK_API_KEY
    default: true

routing_preferences:
  - name: complex_reasoning
    description: deep analysis, mathematical problem solving, and logical reasoning
    models:
      - moonshotai/kimi-for-coding
      - deepseek/deepseek-v4-pro
  - name: code_review
    description: reviewing and analyzing existing code for bugs and improvements
    models:
      - deepseek-v4-pro
  - name: creative_writing
    description: creative content generation, storytelling, and writing assistance
    models:
      - deepseek-v4-flash

model_aliases:
  arch.claude.code.small.fast:
    target: deepseek-v4-flash

listeners:
  - type: model
    name: auto_router_gateway
    address: 0.0.0.0
    port: 12000

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions