{
  "hf_id": "moonshotai/Kimi-K2.7-Code",
  "meta": {
    "title": "Kimi-K2.7-Code",
    "slug": "kimi-k2.7-code",
    "provider": "Moonshot AI",
    "description": "Coding-focused agentic MoE built on Kimi-K2.6, tuned for long-horizon software-engineering tasks with thinking-only reasoning, tool calling, and vision-language input",
    "date_added": "2026-06-12",
    "date_updated": "2026-07-29",
    "tasks": [
      "multimodal",
      "text"
    ],
    "performance_headline": "1T MoE coding agent with ~30% fewer thinking tokens than Kimi-K2.6",
    "related_recipes": [
      "moonshotai/Kimi-K2.6",
      "moonshotai/Kimi-K2-Thinking"
    ],
    "hardware": {
      "h200": "verified",
      "mi300x": "verified",
      "mi325x": "verified",
      "mi355x": "verified"
    }
  },
  "recommended_command": {
    "hardware": "h200",
    "strategy": "single_node_tp",
    "variant": "default",
    "node_count": 1,
    "deploy_type": "single_node",
    "env": {},
    "docker_image": "vllm/vllm-openai:latest",
    "command": "vllm serve moonshotai/Kimi-K2.7-Code \\\n  --trust-remote-code \\\n  --tensor-parallel-size 8 \\\n  --tool-call-parser kimi_k2 \\\n  --enable-auto-tool-choice \\\n  --reasoning-parser kimi_k2 \\\n  --speculative-config '{\"model\":\"lightseekorg/kimi-k2.7-coder-eagle3.1-mla\",\"method\":\"eagle3\",\"num_speculative_tokens\":3}' \\\n  --mm-encoder-tp-mode data",
    "argv": [
      "vllm",
      "serve",
      "moonshotai/Kimi-K2.7-Code",
      "--trust-remote-code",
      "--tensor-parallel-size",
      "8",
      "--tool-call-parser",
      "kimi_k2",
      "--enable-auto-tool-choice",
      "--reasoning-parser",
      "kimi_k2",
      "--speculative-config",
      "{\"model\":\"lightseekorg/kimi-k2.7-coder-eagle3.1-mla\",\"method\":\"eagle3\",\"num_speculative_tokens\":3}",
      "--mm-encoder-tp-mode",
      "data"
    ],
    "docker_command": "docker run --gpus all \\\n  --privileged --ipc=host -p 8000:8000 \\\n  -v ~/.cache/huggingface:/root/.cache/huggingface \\\n  vllm/vllm-openai:latest moonshotai/Kimi-K2.7-Code \\\n  --trust-remote-code \\\n  --tensor-parallel-size 8 \\\n  --tool-call-parser kimi_k2 \\\n  --enable-auto-tool-choice \\\n  --reasoning-parser kimi_k2 \\\n  --speculative-config '{\"model\":\"lightseekorg/kimi-k2.7-coder-eagle3.1-mla\",\"method\":\"eagle3\",\"num_speculative_tokens\":3}' \\\n  --mm-encoder-tp-mode data",
    "docker_argv": [
      "docker",
      "run",
      "--gpus",
      "all",
      "--privileged",
      "--ipc=host",
      "-p",
      "8000:8000",
      "-v",
      "~/.cache/huggingface:/root/.cache/huggingface",
      "vllm/vllm-openai:latest",
      "moonshotai/Kimi-K2.7-Code",
      "--trust-remote-code",
      "--tensor-parallel-size",
      "8",
      "--tool-call-parser",
      "kimi_k2",
      "--enable-auto-tool-choice",
      "--reasoning-parser",
      "kimi_k2",
      "--speculative-config",
      "{\"model\":\"lightseekorg/kimi-k2.7-coder-eagle3.1-mla\",\"method\":\"eagle3\",\"num_speculative_tokens\":3}",
      "--mm-encoder-tp-mode",
      "data"
    ],
    "strategy_spec": {
      "name": "single_node_tp",
      "deploy_type": "single_node",
      "display_name": "Tensor Parallel",
      "short_label": "TP",
      "orientation": "latency",
      "description": "Single-node tensor parallel. Splits the model across all local GPUs. TP size is set to the GPU count at deploy time. The simplest multi-GPU strategy — works for all model architectures.\n",
      "hardware_match": {
        "min_gpus": 1,
        "max_gpus": 8,
        "multi_node": false
      },
      "vllm_args": [],
      "parallel_flag": "--tensor-parallel-size"
    },
    "hardware_profile": {
      "brand": "NVIDIA",
      "generation": "hopper",
      "compute_arch": "sm90",
      "display_name": "H200",
      "description": "NVIDIA H200 SXM 141 GB HBM3e · 8-GPU HGX node",
      "gpu_count": 8,
      "vram_gb": 1128,
      "multi_node": false
    },
    "alternatives": {
      "single_node_tep": "/moonshotai/Kimi-K2.7-Code/strategies/single_node_tep.json",
      "single_node_dep": "/moonshotai/Kimi-K2.7-Code/strategies/single_node_dep.json",
      "multi_node_tp": "/moonshotai/Kimi-K2.7-Code/strategies/multi_node_tp.json",
      "multi_node_tp_pp": "/moonshotai/Kimi-K2.7-Code/strategies/multi_node_tp_pp.json",
      "multi_node_dep": "/moonshotai/Kimi-K2.7-Code/strategies/multi_node_dep.json",
      "multi_node_tep": "/moonshotai/Kimi-K2.7-Code/strategies/multi_node_tep.json",
      "pd_cluster": "/moonshotai/Kimi-K2.7-Code/strategies/pd_cluster.json",
      "kv_store_centralized_mooncake": "/moonshotai/Kimi-K2.7-Code/strategies/kv_store_centralized_mooncake.json",
      "kv_store_distributed_mooncake": "/moonshotai/Kimi-K2.7-Code/strategies/kv_store_distributed_mooncake.json"
    },
    "by_hardware": {
      "h200": "/moonshotai/Kimi-K2.7-Code/hw/h200.json",
      "h100": "/moonshotai/Kimi-K2.7-Code/hw/h100.json",
      "b200": "/moonshotai/Kimi-K2.7-Code/hw/b200.json",
      "gb200": "/moonshotai/Kimi-K2.7-Code/hw/gb200.json",
      "b300": "/moonshotai/Kimi-K2.7-Code/hw/b300.json",
      "gb300": "/moonshotai/Kimi-K2.7-Code/hw/gb300.json",
      "mi300x": "/moonshotai/Kimi-K2.7-Code/hw/mi300x.json",
      "mi325x": "/moonshotai/Kimi-K2.7-Code/hw/mi325x.json",
      "mi350x": "/moonshotai/Kimi-K2.7-Code/hw/mi350x.json",
      "mi355x": "/moonshotai/Kimi-K2.7-Code/hw/mi355x.json"
    }
  },
  "model": {
    "model_id": "moonshotai/Kimi-K2.7-Code",
    "min_vllm_version": "0.19.1",
    "docker_image": {
      "nvidia": "vllm/vllm-openai:latest",
      "amd": "vllm/vllm-openai-rocm:nightly"
    },
    "architecture": "moe",
    "parameter_count": "1T",
    "active_parameters": "32B",
    "context_length": 262144,
    "supports_dcp": true,
    "base_args": [
      "--trust-remote-code"
    ],
    "base_env": {},
    "install": {
      "pip": {
        "command": "uv venv\nsource .venv/bin/activate\nuv pip install -U vllm --torch-backend auto"
      },
      "docker": {
        "command": "docker pull vllm/vllm-openai:latest"
      }
    }
  },
  "features": {
    "tool_calling": {
      "description": "Kimi K2 tool-call parser with automatic tool choice",
      "args": [
        "--tool-call-parser",
        "kimi_k2",
        "--enable-auto-tool-choice"
      ]
    },
    "reasoning": {
      "description": "Kimi K2 reasoning parser for extracting chain-of-thought content (Kimi-K2.7-Code is thinking-only — keep this enabled)",
      "args": [
        "--reasoning-parser",
        "kimi_k2"
      ]
    },
    "spec_decoding": {
      "description": "Eagle3 speculative decoding for accelerated inference",
      "args": [
        "--speculative-config",
        "{\"model\":\"lightseekorg/kimi-k2.7-coder-eagle3.1-mla\",\"method\":\"eagle3\",\"num_speculative_tokens\":3}"
      ]
    },
    "text_only": {
      "description": "Skip loading the vision encoder for text-only workloads — frees VRAM for KV cache. Mutually exclusive with encoder_parallel.",
      "args": [
        "--language-model-only"
      ]
    },
    "encoder_parallel": {
      "description": "Run the vision encoder in data-parallel mode — avoids TP comm overhead on the small encoder. Mutually exclusive with text_only.",
      "args": [
        "--mm-encoder-tp-mode",
        "data"
      ]
    }
  },
  "opt_in_features": [
    "text_only"
  ],
  "variants": {
    "default": {
      "precision": "int4",
      "vram_minimum_gb": 714,
      "description": "Native INT4 via compressed-tensors (~595 GB on disk); fits 8×H200"
    }
  },
  "hardware_overrides": {
    "amd": {
      "extra_env": {
        "VLLM_ROCM_USE_AITER": "1",
        "VLLM_ROCM_QUICK_REDUCE_QUANTIZATION": "INT4"
      }
    }
  },
  "guide": "## Overview\n\n[Kimi-K2.7-Code](https://huggingface.co/moonshotai/Kimi-K2.7-Code) is a coding-focused\nagentic model built on top of Kimi-K2.6. It substantially improves real-world\nlong-horizon coding performance — strengthening end-to-end task completion across complex\nsoftware-engineering workflows while improving token efficiency, reducing thinking-token\nusage by ~30% versus Kimi-K2.6.\n\nIt shares the same architecture as Kimi-K2.5 / Kimi-K2.6 (1T-parameter MoE, 32B activated,\nDeepSeek-V3 backbone with MLA attention and a MoonViT vision encoder), so the K2.6\ndeployment method can be reused directly. Kimi-K2.7-Code runs in **thinking mode only**\nwith `preserve_thinking` forced on; keep the reasoning parser enabled.\n\n## Prerequisites\n\n- **vLLM version:** >= 0.19.1 (manually verified). The model is also available in the\n  vLLM nightly wheel, but nightly builds are experimental.\n- **Hardware (INT4):** 8x H200 GPUs (verified), or equivalent aggregate VRAM (~640 GB)\n\n```bash\nuv venv\nsource .venv/bin/activate\nuv pip install -U vllm --torch-backend=auto\n```\n\n## Launch command\n\nServe on a single H200 node with TP8 (vision encoder in data-parallel mode):\n\n```bash\nvllm serve moonshotai/Kimi-K2.7-Code \\\n  --tensor-parallel-size 8 \\\n  --mm-encoder-tp-mode data \\\n  --trust-remote-code \\\n  --tool-call-parser kimi_k2 \\\n  --enable-auto-tool-choice \\\n  --reasoning-parser kimi_k2\n```\n\n**Key notes**\n\n- `--tool-call-parser kimi_k2` — required for enabling tool calling.\n- `--reasoning-parser kimi_k2` — Kimi-K2.7-Code supports thinking mode only; pass this for\n  correct reasoning processing.\n- `--mm-encoder-tp-mode data` — runs the small MoonViT encoder data-parallel to avoid TP\n  communication overhead.\n\n### AMD MI300X/MI325X\n\nOn 8x MI300X or MI325X (`gfx942`), use the standard W4A16 MoE path with AITER\nand INT4 QuickReduce.\n\n```bash\nexport VLLM_ROCM_USE_AITER=1\nexport VLLM_ROCM_QUICK_REDUCE_QUANTIZATION=INT4\n\nvllm serve moonshotai/Kimi-K2.7-Code \\\n  --host 0.0.0.0 \\\n  --port 8000 \\\n  --trust-remote-code \\\n  --tensor-parallel-size 8 \\\n  --tool-call-parser kimi_k2 \\\n  --enable-auto-tool-choice \\\n  --reasoning-parser kimi_k2 \\\n  --mm-encoder-tp-mode data\n```\n\n### AMD MI350X/MI355X\n\nOn 8x MI350X or MI355X (`gfx950`), add `--moe-backend flydsl` to use the\noptimized FlyDSL W4A16 MoE kernel. Keep LoRA disabled for this path.\n\n```bash\nexport VLLM_ROCM_USE_AITER=1\nexport VLLM_ROCM_QUICK_REDUCE_QUANTIZATION=INT4\n\nvllm serve moonshotai/Kimi-K2.7-Code \\\n  --tensor-parallel-size 8 \\\n  --trust-remote-code \\\n  --mm-encoder-tp-mode data \\\n  --moe-backend flydsl \\\n  --tool-call-parser kimi_k2 \\\n  --enable-auto-tool-choice \\\n  --reasoning-parser kimi_k2 \\\n  --compilation-config '{\"pass_config\": {\"fuse_allreduce_rms\": false}}'\n```\n\nNotes:\n- The FlyDSL INT4 MoE path does not support expert parallelism; do not add\n  `--enable-expert-parallel`.\n- Keep `--compilation-config '{\"pass_config\": {\"fuse_allreduce_rms\": false}}'`;\n  it is required for this FlyDSL path on MI350X / MI355X.\n- vLLM has tuned MI350X/MI355X FlyDSL configs for this Kimi shape at TP=8 and TP=4.\n- Keep vLLM's default block size unless you are tuning long-context\n  throughput; `--block-size 64` is safe to try.\n\n## Client Usage\n\nOnce the vLLM server is running, consume it via the OpenAI-compatible API. The recommended\nsampling for thinking mode is `temperature=1.0` and `top_p=0.95`.\n\n```python\nimport time\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=\"EMPTY\",\n    base_url=\"http://localhost:8000/v1\",\n    timeout=3600,\n)\n\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"image_url\",\n                \"image_url\": {\n                    \"url\": \"https://huggingface.co/moonshotai/Kimi-K2.7-Code/resolve/main/figures/kimi-logo.png\"\n                },\n            },\n            {\"type\": \"text\", \"text\": \"Describe this image in detail.\"},\n        ],\n    }\n]\n\nstart = time.time()\nresponse = client.chat.completions.create(\n    model=\"moonshotai/Kimi-K2.7-Code\",\n    messages=messages,\n    max_tokens=4096,\n    temperature=1.0,\n    top_p=0.95,\n)\nprint(f\"Response costs: {time.time() - start:.2f}s\")\nprint(f\"Reasoning: {response.choices[0].message.reasoning}\")\nprint(f\"Response: {response.choices[0].message.content}\")\n```\n\n## Troubleshooting\n\n- **OOM errors:** Lower `--gpu-memory-utilization` or adjust TP/EP to match your GPU count.\n- **Vision encoder performance:** Use `--mm-encoder-tp-mode data` to run the vision encoder\n  in data-parallel mode. The encoder is small, so TP adds communication overhead with little gain.\n- **Unique multimodal inputs:** Pass `--mm-processor-cache-gb 0` to avoid caching overhead.\n  For repeated inputs, `--mm-processor-cache-type shm` uses host shared memory for better\n  performance at high TP settings.\n- **Text-only workloads:** Pass `--language-model-only` to skip loading MoonViT and free\n  VRAM for KV cache.\n\n## References\n\n- [Kimi-K2.7-Code on Hugging Face](https://huggingface.co/moonshotai/Kimi-K2.7-Code)\n- [Kimi-K2.7-Code deployment guide](https://huggingface.co/moonshotai/Kimi-K2.7-Code/blob/main/docs/deploy_guidance.md)\n- [Kimi-K2.6 recipe](https://recipes.vllm.ai/moonshotai/Kimi-K2.6)\n- [vLLM multimodal inputs guide](https://docs.vllm.ai/en/latest/features/multimodal_inputs.html)\n",
  "source": {
    "source": "vllm",
    "repo": "vllm-project/vllm",
    "ref": "main",
    "sha": "564ac0de1b228568cafcbfbe8ccaccc82d6023eb",
    "path": "recipes/models/moonshotai/Kimi-K2.7-Code.yaml",
    "edit_url": "https://github.com/vllm-project/vllm/edit/main/recipes/models/moonshotai/Kimi-K2.7-Code.yaml",
    "overlays": []
  }
}