<img alt="" src="https://secure.insightful-enterprise-intelligence.com/783141.png" style="display:none;">

publish-dateApril 21, 2026

5 min read

Updated-dateUpdated on 21 Apr 2026

How to Run Cost-Efficient Inference Workloads: A Guide

Written by

Fareed Khan

Fareed Khan

Share this post

Table of contents

 Cost-efficient LLM inference on Hyperstack or any GPU cloud means maximising tokens per dollar by optimising every layer of the stack, from model and runtime to VM selection and orchestration.

In practice, this means choosing the right GPU size, applying quantisation, optimising KV cache usage, using modern runtimes like TensorRT-LLM, vLLM, and TGI, batching effectively, autoscaling dynamically, and tracking the right metrics. Together, these can deliver 2× to 10× cost savings in real deployments.

The table below shows the highest-impact techniques you can apply to run cost-effective inference workloads.

Strategy

Impact (efficiency gain)

Effort / Complexity

Quantisation (INT8/4)

2–4× throughput increase

Low–Medium (many libs available)

Distillation / Pruning

2–10× model size reduction

High (requires retraining/tuning)

Dynamic Batching

2–5× throughput (vs per-request)

Medium (configurable in Triton / vLLM)

Token-Level Scheduling

Up to ~9× throughput (Alibaba Aegaeon)

High (complex custom schedulers)

Speculative Decoding

2–3× generation speedup

Medium (needs auxiliary models)

KV-Cache Offloading

≈20% cost cut for long contexts

Medium (runtime support needed)

vLLM (PagedAttention)

2–4× throughput vs TorchServe

Low (use open-source vLLM)

TensorRT-LLM (FP8)

~3–4.6× speedup on H100 vs A100

High (NVIDIA-specific setup)

Right-Sizing GPUs (H100/H200)

Up to 35× cost improvement

Low (benchmark + selection)

MIG / GPU Sharing

~25–80% better utilisation (varies)

Medium (infrastructure support)

Autoscaling / Scale-to-Zero

~50–70% cost reduction vs static

Medium (infra/config needed)

1. Right-Size GPU & Virtual Machine Selection

Don't overprovision. Identify the smallest GPU/VM that meets your latency and throughput SLA. Benchmarks and profiling are key: measure your model's VRAM footprint, maximum batch size, and tokens/sec on candidate VMs before choosing. If your model fits with headroom on an NVIDIA A100 or NVIDIA H100, there is no need to jump to a larger, much pricier card. Analyses show that picking the wrong GPU can waste 10× your budget.

  • Memory headroom: Make sure your VM has enough free VRAM for KV-cache and batching. If your context window or batch pushes one GPU to the limit, you will need more GPUs — or to upgrade from an H100 to an H200 — just to fit the model, and pay for that extra hardware. If an H100 handles your workload easily, using an H200 or multiple GPUs raises the cost per token significantly.

  • Compute vs bandwidth: Many LLM tasks are memory-bandwidth-limited, especially decoding. If your workload is near memory capacity on an NVIDIA H100, a larger NVIDIA H200 (141 GB) may be worth it. For smaller models, a cheaper A100 or L40S can have a lower cost per token - Spheron found an NVIDIA A100 beat an NVIDIA H100 on cost per token for a 17B MoE model.

  • VM pricing: Always factor actual VM pricing - on-demand versus reserved versus Spot - into the decision. A 2× cheaper VM that delivers 1.5× the throughput is often the best buy. You can use Hyperstack's live pricing APIs to compare tokens per dollar across VM types. Hyperstack owns its hardware in key locations while maintaining global availability, which is what enables this pricing transparency and flexibility — and avoids the margin stacking typical of reseller clouds.

  • Benchmark your workload: The only way to know is to test your model on real traffic. Measure tokens/sec at target latencies on each candidate GPU, then compute $/token = (GPU $/hr) / (tokens/sec × 3600). Vendor FLOPS claims are meaningless in isolation - actual tokens output per dollar is what counts.

2. Aggressive Model Compression

Shrinking your model directly cuts inference cost. Modern techniques allow drastic compression with minimal accuracy loss:

  • Quantisation (INT8/4, FP4): Convert weights and activations to lower precision. Moving from FP16 to INT8 or INT4 (AWQ/GPTQ methods) typically yields 2–4× throughput on the same GPU. NVIDIA H100 and NVIDIA H200 support FP8/FP4 natively. NVIDIA reports H100 (FP8) achieving 3–4.6× the throughput of NVIDIA A100 (FP16) on a 6B LLM. State-of-the-art 4-bit methods keep accuracy within ~1% of full precision.

  • Pruning: Remove unneeded weights or neurons. Structured pruning can cut a model's size by 30-60% while preserving 98-99% of accuracy, directly lowering compute and memory needs.

  • Distillation: Train a smaller student model to mimic a large teacher. The result can be 5-10× smaller while retaining ~95% of the original's performance. Distilled models are particularly well-suited for ultra-low latency or on-device inference.

Implementation & Tooling

Quantisation tools are widely accessible through industry-standard libraries like Hugging Face Transformers, bitsandbytes, and the Intel Neural Compressor.

For immediate results, you can source off-the-shelf 4-bit models directly from Hugging Face for instant deployment. While more advanced techniques like pruning and distillation require higher engineering effort, they provide significant long-term throughput benefits.

💡 Key Requirement: Always validate each optimisation on a held-out test set to ensure model accuracy remains within production tolerances.

3. KV-Cache and Memory Strategies

Long-context inference is often memory-bound. Every decoded token adds keys and values to the cache, and each step re-reads that KV cache from GPU memory. If your workload involves long contexts, unoptimised caches can waste gigabytes of VRAM - limiting your batch size and forcing extra GPUs. Here are the key tactics:

  • KV-Cache Offloading: Move part of the KV cache to CPU RAM or fast SSD during decoding. vLLM, TensorRT-LLM, and HF TGI all support this. One study found enabling KV offloading saved ~20% of cost in offline batch workloads; for online workloads, it enabled the use of cheaper VMs, which in some cases reduced costs by up to ~74%. Hyperstack VMs have ample host RAM to ensure the serving runtime is configured to spill cache when needed.

  • PagedAttention / vLLM: The vLLM engine virtualises KV-cache usage so no memory is wasted on fragmentation, achieving near-zero KV duplication and flexible sharing between requests. In practice, vLLM boosts throughput 2–4× over naive servers while supporting much longer sequences.

  • Sequence Chunking / Key Sharing: For multi-turn scenarios, reuse KV cache where possible or encode common prompt prefixes once. Some frameworks support prefix caching to reuse work across requests.

  • Disaggregated Memory: Cutting-edge research (e.g. NVIDIA Dynamo) explores splitting prefill and decoding across nodes. Hyperstack's SXM-based GPUs (H100/H200 SXM) have NVLink (600 GB/s), which benefits multi-GPU caching compared to PCIe.

💡

Insight: If your LLM's context often exceeds ~8K tokens or your GPU VRAM is fully consumed by KV cache at runtime, prioritise KV optimisation. Without it, you will require significantly more GPUs just to fit the working set—causing infrastructure costs to scale rapidly.

4. Optimised Inference Runtimes

The serving framework you choose can drastically affect your cost. Modern LLM servers include batching and kernel optimisations out of the box and picking the wrong one means leaving money on the table:

  • TensorRT-LLM (with Triton): NVIDIA's open-source engine, tuned for NVIDIA H100/H200. Supports FP8, in-flight batching, prefix caching, and kernel fusions. H100 FP8 achieves ~3–4.6× the throughput of NVIDIA A100 FP16 on the same model. Use it when ultra-low latency on NVIDIA hardware is required - setup is more complex but yields maximum performance.

  • Hugging Face Text Generation Inference (TGI): A robust, HF-maintained server with easy Docker deployment. TGI v3 adds multi-token caching and is 13× faster on long prompts. A solid default if you value ease of deployment and multi-model support.

  • vLLM: Focused on continuous token-level batching and advanced memory paging. Delivers 2–4× throughput improvements for large models, integrates easily with Hugging Face models, and is particularly effective for high-concurrency or long-context workloads.

  • TorchServe / Custom REST: For simpler use cases or vision models, Triton or TorchServe work. They support dynamic batching and containerisation but may not include the latest LLM optimisations. If using Triton, enable dynamic_batching in the config (e.g. max delay ~5 ms).

Key Point: A poorly chosen runtime wastes money. On NVIDIA, TensorRT-LLM generally wins for raw efficiency, while vLLM and TGI excel for flexibility and ease of deployment. Testing multiple engines and measuring performance is the only way to guarantee the best ROI.

5. Dynamic Batching & Token-Level Scheduling

Naive one-request-at-a-time serving leaves your GPUs mostly idle. Effective request batching and scheduling is one of the most overlooked levers for cutting cost.

  • Dynamic Batching (Request-level): Hold incoming requests up to a short timeout (a few ms) and batch them. This often moves GPU utilisation from ~20–30% to ~70–85%. Triton has built-in support - in config.pbtxt set dynamic_batching { preferred_batch_size: [4, 8] max_queue_delay_microseconds: 5000 }. Tune the max delay to match your SLA.

  • Continuous (Token-Level) Batching: For autoregressive models, vLLM's continuous batching lets new requests join a running batch between decoding steps. NVIDIA's TensorRT-LLM uses in-flight batching to similar effect. Alibaba's Aegaeon used token-level scheduling across multiple LLMs and cut GPU usage by 82% while boosting throughput ~9×. Even at a smaller scale, token batching can improve throughput by 2–5×.

  • Queue Management: Implement a queue or proxy in front of your GPUs to shape arrival rates and improve batch fill. Pick a strategy per workload: micro-batches (2–8) for chatbots, full batches (dozens) for async tasks.

  • CUDA Streams and Overlap: Overlap data transfers with compute and enable TensorRT's CUDA Graphs (--useCudaGraph) to reduce kernel launch overhead. These performance gains come at no additional infrastructure cost.

6. Multi-GPU & Multi-Tenancy

Use these techniques when you need to scale beyond one card or share GPUs across workloads:

  • Data Parallel (Multi-GPU): Run N copies of the model on N GPUs, each handling ~1/N of requests. In Triton, set instance_group { count: 2, kind: KIND_GPU, gpus: [0, 1] } to spin up two instances on two GPUs. Near-linear throughput scaling applies until another bottleneck appears.

  • Tensor Parallel / Pipeline Parallel: If a model is too large for one GPU, shard it. vLLM and DeepSpeed/Megatron handle tensor parallelism across cards. NVLink (SXM GPUs) is very beneficial here; PCIe-only GPUs may bottleneck on all-reduce bandwidth.

  • NVIDIA MIG (Multi-Instance GPU): For multiple smaller models or tenants, MIG slices a single NVIDIA A100/H100 into 2–7 independent GPUs, each with guaranteed compute and memory - ideal for isolating workloads and enforcing SLAs.

  • Fractional or Time-Sliced GPUs: Advanced schedulers time-share GPU threads across models. Alibaba's research suggests dynamic pooling outperforms static MIG slices for highly variable, multi-model traffic.

7. Auto-Scaling & Scale-to-Zero

Static, always-on GPUs waste your money when idle. Use cloud autoscaling to match your capacity to actual demand:

  • Queue-Driven Scaling: Monitor request queue length or in-flight load, and spin GPU VMs up or down accordingly. Kubernetes tools (KEDA, Karpenter) autoscale pods or nodes on these metrics. Hyperstack supports fast VM provisioning (under one minute) and suspend/hibernate - idle VMs can be paused completely.

  • Spot VMs: For non-critical batch workloads, Spot VMs on Hyperstack offer a 20% discount compared to on-demand pricing. Run nightly analytics or batch jobs on Spot VMs, then shut them down. Reserve on-demand VMs for the latency-critical hot path.

  • Scale-to-Zero: For very intermittent traffic, consider a serverless model - wake GPU VMs only when queries arrive. Pre-warmed standby or hibernation can approximate scale-to-zero and avoid cold-start penalties.

  • Elastic Workload Mix: Separate real-time from batch traffic. Keep a few GPUs hot for low-latency APIs, and use auto-scaled burst clusters for heavy off-peak inference. GMI Cloud handles ~10× peak spikes via elastic scaling.

Don't pay for idle GPUs. Moving from static to elastic GPU pools can cut costs ~50–70%. Invest effort in proper autoscaling policies and capacity-buffer thresholds.

8. Cost Metrics & Observability

Use tokens per dollar (or cost per million tokens) as your master metric. Instrument your system to expose GPU utilisation, tokens/sec, latencies (p50/p95/p99), and cost per 1K inferences or per million tokens.

  • Monitoring Tools: Export metrics to Prometheus and Grafana - vLLM has Prometheus endpoints, Triton exposes Stats, and Hyperstack VM metrics are available. Key dashboards: GPU utilisation, queue depth, batch size, tokens/sec.

  • Alerts & Dashboards: Set alerts on low utilisation (wasted resources) or rising cost per token. Track trends: is an optimisation actually lowering $/token?

  • Token vs Hour: Cost per hour is misleading. NVIDIA showed that H200 GPUs were 2× the cost per hour of H100 but delivered ~35× more tokens per watt - yielding 17.5× lower cost per token. Plot cost per token, not rental rates. Hourly rates also hide billing extras — hyperscaler bills typically include ingress and egress charges that don't appear in the GPU rate, while Hyperstack charges none.

  • Capacity Planning: Continuously benchmark new models and GPUs using MLPerf Inference or custom load tests (e.g. Triton Perf Analyser) to quantify throughput at scale.

  • Cloud Billing Integration: In Hyperstack, enable detailed billing and cost management to attribute spend to inference jobs. This helps identify idle VMs or runaway jobs before costs compound.

Good observability closes the loop. Without it, you risk spending on optimisations that do not pay off. Cache hit-rate monitoring, for example, tells you whether a result cache is effective - or whether batching is actually happening as expected.

Techniques vs. Impact / Cost 

Technique

When to Use

Impact

Complexity (Dev/Ops)

Quantisation (INT8/4)

Large LLMs where model fits GPU after compressing.

2–4× throughput; ~50–80% cost drop

Low: tools available; test accuracy

Pruning / Distillation

When accuracy trade-off is acceptable.

2–10× smaller models

High: requires training data/effort

Dynamic Batching

Online services with moderate latency SLAs.

2–5× throughput (GPU util ↑)

Medium: config Triton/vLLM

Token-Level Scheduling

Mixed or bursty multi-model inference.

Up to ~9× throughput

High: custom scheduler needed

Speculative Decoding

Generation-heavy workloads (long responses).

2–3× speedup

Medium: need secondary model

KV Cache Offloading

Long contexts that exceed single-GPU memory.

~20% cost savings (batch case)

Medium: runtime support

vLLM / PagedAttention

Long-context LLMs with high concurrency.

2–4× throughput

Low: use library & set up

TensorRT-LLM (FP8)

NVIDIA GPUs, ultra-low latency needs.

~4× throughput (H100 vs A100)

High: NVIDIA toolchain

Right-sized GPU

Always (match model to GPU).

Up to 35× tokens/sec gain

Low: measure & pick

MIG / GPU Sharing

Many small models or tenants.

≈+20–50% utilisation

Medium: infrastructure support

Auto-Scaling

Variable traffic workloads.

~50–70% cost reduction vs static

Medium: infra setup

Cache Frequent Queries

Apps with repeated inputs (search, FAQ).

Large latency & cost win if >10% hit rate.

Low: add caching layer

A Quick Checklist

Here's a quick checklist that you can use to cut inference costs:

  • Benchmark & Profile: Measure tokens/sec, VRAM use, and latency on candidate VMs. Compute cost per million tokens.

  • Optimise Model: Try INT8/4 quantisation (e.g. AWQ) and measure accuracy. Prune or distil if latency is still too high.

  • Tune Runtime: Deploy on Triton, vLLM, or TGI with dynamic batching enabled. Test batch sizes until latency degrades.

  • Manage KV Cache: Monitor GPU memory during inference. Enable KV offload or use vLLM's PagedAttention for long prompts.

  • Scale Smart: Hook up an autoscaler (KEDA/Karpenter) on queue length or GPU utilisation. Define scale-to-zero if feasible.

  • Choose GPU Wisely: Use multi-GPU or MIG only if needed. Avoid oversized VMs that sit idle.

  • Monitor & Iterate: Track GPU utilisation, latency (p99), and cost per token over time. Continually adjust batching, model, or scale rules.

  • Document & Automate: Containerise the stack, script benchmarking, and encode best practices in CI pipelines.

By systematically applying these strategies - and measuring every step - you can minimise inference cost on Hyperstack GPUs while meeting SLA requirements. Teams regularly see 40–70% reductions in compute spend and 2–5× improvements in throughput by combining these techniques.

Start Running Cost-Efficient Inference on Hyperstack

Hyperstack provides your team with instant access to NVIDIA H100 and H200 GPU VMs. With ultra-fast provisioning, seamless autoscaling, and Spot VM discounts, our platform is engineered to drive your cost per token to the absolute minimum. Stop overpaying for idle GPU hours and start optimising.

Ready to optimise your infrastructure?
Run your inference workloads on Hyperstack today.

FAQs

What is the most important metric for measuring LLM inference cost?

Cost per million tokens (or tokens per dollar) is the master metric. GPU cost per hour is misleading in isolation - a more expensive VM can deliver a lower cost per token if it has higher throughput. Always benchmark your actual workload and compute $/token = (GPU $/hr) / (tokens/sec × 3600).

Which GPU should I choose for inference workloads on Hyperstack?

It depends on your model size and latency requirements. H100 and H200 VMs are best for large models (70B+) or latency-critical production workloads. For smaller models (7B–13B), an A100 or L40S can deliver lower cost per token. Always benchmark on real traffic before committing to a VM type.

How much can quantisation reduce my inference costs?

Quantisation (INT8 or INT4) typically delivers 2–4× throughput improvement on the same GPU, which translates directly to lower cost per token. State-of-the-art 4-bit methods like AWQ and GPTQ keep accuracy within approximately 1% of full precision. For many production workloads, this is the single highest-impact, lowest-effort optimisation available.

What is dynamic batching and why does it matter?

Dynamic batching groups multiple incoming requests together before sending them to the GPU, rather than processing each one individually. This can move GPU utilisation from 20–30% up to 70–85%, delivering 2–5× throughput improvement at the same hardware cost. Both Triton Inference Server and vLLM support dynamic batching out of the box.

What are Spot VMs on Hyperstack and when should I use them?

Spot VMs on Hyperstack offer a 20% discount compared to on-demand pricing. They are best suited for non-critical or interruptible workloads - such as batch inference jobs, nightly analytics, or model-validation runs - where brief interruptions are acceptable. Reserve on-demand VMs for latency-critical, real-time inference paths.

How does vLLM's PagedAttention reduce inference costs?

PagedAttention virtualises the KV cache similarly to how an operating system pages memory, eliminating fragmentation and minimising wasted VRAM. This allows vLLM to pack more concurrent requests into the same GPU memory, increasing throughput by 2–4× compared to naive serving approaches like TorchServe - with no additional hardware cost.

When should I use TensorRT-LLM instead of vLLM?

TensorRT-LLM is the better choice when raw throughput and minimal latency on NVIDIA hardware are the priority and you can invest in the more complex setup (model conversion to TRT engines, NVIDIA-specific toolchain). It achieves approximately 3–4.6× the throughput of A100 FP16 on an H100 using FP8 precision. vLLM is a better default if you prioritise deployment flexibility, faster setup, or multi-model support.

How does autoscaling reduce GPU costs in practice?

Static GPU VMs left running when idle are pure wasted spend. Autoscaling tools like KEDA or Karpenter monitor queue depth or GPU utilisation and spin VMs up or down accordingly. Moving from a static GPU pool to an elastic one typically cuts compute costs 50–70%. Hyperstack supports fast VM provisioning (under one minute), making autoscaling practical for most workloads.

Subscribe to Hyperstack!

Enter your email to get updates to your inbox every week

Related content

Stay updated with our latest articles.

tutorials Tutorials link

Claude Fable 5.2 Tested: Effort, Cost and How Mythos 5.2 Differs

Anthropic has released Claude Fable 5.2 and Claude Mythos ...

Anthropic has released Claude Fable 5.2 and Claude Mythos 5.2, one underlying model offered two ways. Fable 5.2 is available to every customer, with cyber and biology safeguards, and Mythos 5.2 is for organisations Anthropic approves for security or life-sciences work.

Launch benchmarks show which model scores highest, but do not make it clear which Claude model is worth paying for on your workload.

We gave Fable 5.2 small tasks with built-in traps (a GPU job schedule, a SQL query over a messy database and a dense line chart), ran the schedule five times at each effort level and measured accuracy, cost and speed. We tested Fable 5.2 on the Claude API against Fable 5.1, Opus 5.5, Sonnet 5.5 and Haiku 5.5.

Tests ran in November 2026. We have included Anthropic’s own scores, how to choose an effort level and where cheaper Claude models are enough. We also cover speed, fast mode and the code changes that break older integrations.

One Model, Two Ways In

Who can use which model

 
 ONE UNDERLYING MODELsame capabilities, specs and priceClaude Fable 5.2claude-fable-5-2Every customerCyber and biology safeguardsCyber fallback: Claude Opus 4.8Biology fallback: Claude Opus 5Claude Mythos 5.2claude-mythos-5-2Approved organisationsCyber Verification ProgramLife Sciences Verification ProgramInside Claude Security for Enterprise$8 / $40per million tokens$16 / $80fast mode1Mtoken context128Koutput tokens

Prices fall from $10 and $50 on Fable 5.1, and Anthropic reports output up to 30% faster; its developer notes list the API changes.

Claude Fable 5.2 Benchmarks

In Anthropic’s scores, the largest gains over Fable 5.1 come in robotics, chart reading and knowledge work. The biggest jump is in simulated robotics, where RoboDojo Sim rises from 27.6% to 64.9%. Chart reading (Chartography) goes from 44.8% to 73.4%, and the Remote Labor Index from 17.9% to 41.3%. In the chart’s Coding and agents view, the biggest rise is Terminal-Bench-Science, from 52.6% to 74.6%. Fable 5.2 is also ahead of Opus 5.5 on all ten benchmarks shown:

Fable 5.2 vs Fable 5.1 vs Opus 5.5

Scores reported by Anthropic.

 
Anthropic reports Claude Fable 5.2 ahead of Claude Fable 5.1 and Claude Opus 5.5 on all ten benchmarks shown, including FrontierSWE v2 at 69.9, the Remote Labor Index at 41.3 and RoboDojo Sim at 64.9.

What Fable 5.2 and Mythos 5.2 Built

Anthropic’s launch videos show the range:

Fable 5.2 coordinated over 1,000 subagents for eight days to build an operating system that boots on a laptop.

An operating system built by Claude Fable 5.2, running on a laptopOperating system
Voice-assistant hub circuit board designed by Claude Fable 5.2Electronics
Robot arms controlled by Claude Fable 5.2 with a puzzle cubeRobotics
Gene-therapy capsid structure predicted by Claude Mythos 5.2Mythos capsid

Videos: Anthropic.

Choosing an Effort Level

Thinking is always on, so effort (an API setting from low to max that controls how much the model reasons) sets depth, time and cost. To test it, we set a trap: 12 jobs to schedule on three GPU nodes, where job C needs all three nodes at once. Starting whatever is ready whenever nodes are free keeps job C waiting until hour 12, and the plan runs to hour 30. The best plan finishes at hour 21 by deliberately leaving nodes idle so job C can start at hour 2.

Two schedules for the same 12 jobs

 
Start whatever is readydone at hour 30N1N2N3ABFIHCDEKGJLPlan by Claude Fable 5.2done at hour 21N1N2N3BCADFEGHIJKL036912151821242730hoursjob C needs all three nodesidle on purpose
solver.pyPYTHON
with client.messages.stream(
    model=model,
    max_tokens=max_tokens,
    thinking={"type": "adaptive", "display": "summarized"},
    output_config={"effort": effort, "format": {"type": "json_schema", "schema": puzzle.SCHEMA}},
    messages=[{"role": "user", "content": puzzle.prompt_text()}],
) as stream:
Output: run 1OUTPUT
low     correct=True   finish=21h  output= 1,445 tokens    22.4s  $0.065
medium  correct=False  finish=22h  output= 1,470 tokens    21.9s  $0.066
high    correct=True   finish=21h  output= 1,724 tokens    23.8s  $0.076
xhigh   correct=True   finish=21h  output= 2,400 tokens    32.6s  $0.103
max     correct=True   finish=21h  output= 3,770 tokens    48.2s  $0.158

Over five runs per effort level, xHigh and max found the 21-hour schedule every time, and every miss was 22 hours. Low and high found it in four runs out of five, but medium found it only once, so more effort did not always mean a better answer. With five runs per level, treat that dip as a warning rather than a rule.

Five runs per effort level

Runs that found the 21-hour schedule, out of five per level; the other views show the average cost and output tokens per run.

 
Claude Fable 5.2 found the 21-hour optimum in 4 of 5 runs at low, 1 of 5 at medium, 4 of 5 at high and 5 of 5 at xhigh and max, at an average of $0.068 to $0.176 a run.

Cost rises with every level, from $0.068 a run at Low to $0.176 at max, 81% more than xHigh for the same result. XHigh is the cheapest level that never missed; low suits jobs where you can check the answer and retry.

Claude Fable 5.2 vs Cheaper Claude Models

On short, well-defined work, cheaper models kept pace: Opus 5.5, Sonnet 5.5 and Haiku 5.5 solved the trap in all three runs at high effort, and all five models found the exact revenue in a trap-laden SQL database. Haiku 5.5 did both at about 1/26 to 1/80 of Fable 5.2’s cost.

Same tasks, five Claude models

One SQL agent run per model; the other views show its time and the average cost of a scheduling run.

 
In the SQL agent test all five models returned the exact figure, at $0.224 for Claude Fable 5.2 against $0.003 for Claude Haiku 5.5.

We also asked Fable 5.2, Fable 5.1 and Opus 5.5 to read every value from a dense line chart with 48 closely spaced points, in one run each. Fable 5.2 read all 48 exactly, against 47 for Opus 5.5 and 5 for Fable 5.1, though none of Fable 5.1’s readings was more than 3 GPU hours out.

Claude Fable 5.2 Speed and Fast Mode

On one prompt at low effort, Fable 5.2 averaged 78 output tokens per second against 57 for Fable 5.1, 36% faster, above Anthropic’s figure of up to 30%. Opus 5.5 generated tokens faster still, at 86 per second, and cost about half as much per answer: $0.026 against $0.052. Fast mode takes one parameter and reaches 220 tokens per second, finishing in about a third of the time (5.4 seconds against 16.5 in standard mode) for 1.8 times the cost per answer:

speed.pyPYTHON
extra = {"speed": "fast"} if speed == "fast" else {}  # fast mode needs no beta header on Claude Fable 5.2
# ...
with client.messages.stream(
    model=model,
    max_tokens=4000,
    output_config={"effort": "low"},
    messages=[{"role": "user", "content": PROMPT}],
    **extra,
) as stream:
Output: run 1OUTPUT
claude-fable-5-2  standard  1119 tokens  first text  1.72s  total  14.74s    75.9 tokens/s  $0.0452
claude-fable-5-2  fast      1191 tokens  first text  0.84s  total   5.39s   220.9 tokens/s  $0.0962
claude-fable-5-1  standard  1127 tokens  first text  0.62s  total  19.41s    58.1 tokens/s  $0.0569
claude-opus-5-5   standard  1301 tokens  first text  1.56s  total  15.11s    86.1 tokens/s  $0.0262

Three runs per setup

 
 
Output tokens per second: 57 for Claude Fable 5.1, 78 for Claude Fable 5.2, 86 for Claude Opus 5.5 and 220 for Claude Fable 5.2 in fast mode.

Claude Fable 5.2 API: Getting Started

The Models API shows which models a key can call:

models_check.pyPYTHON
import anthropic

client = anthropic.Anthropic()  # reads ANTHROPIC_API_KEY

available = {m.id: m for m in client.models.list()}
for model_id in ["claude-fable-5-2", "claude-mythos-5-2", "claude-fable-5-1", "claude-opus-5-5"]:
    print(f"{model_id:20} {'available' if model_id in available else 'not available to this key'}")

fable = client.models.retrieve("claude-fable-5-2")
caps = fable.capabilities
print("\n" + fable.display_name)
print("context window   :", f"{fable.max_input_tokens:,} tokens")
print("max output       :", f"{fable.max_tokens:,} tokens")
# ...
print("thinking types   :", [t for t, v in caps.thinking.types.to_dict().items() if v["supported"]])
print("effort levels    :", [e for e in ("low", "medium", "high", "xhigh", "max") if getattr(caps.effort, e).supported])
OutputOUTPUT
claude-fable-5-2     available
claude-mythos-5-2    not available to this key
claude-fable-5-1     available
claude-opus-5-5      available

Claude Fable 5.2
context window   : 1,000,000 tokens
max output       : 128,000 tokens
thinking types   : ['adaptive']
effort levels    : ['low', 'medium', 'high', 'xhigh', 'max']

Mythos 5.2 accepts the same requests with the model ID claude-mythos-5-2; access runs through the Cyber Verification Program and the Life Sciences Verification Program.

What Changes in Your Code

Code written for earlier Claude models can break on four rules from Anthropic’s migration and prompting guides:

tool_choice: any or tool
Returns a 400 error. Keep auto with a strict tool, or use JSON outputs.
<thinking> tags
Can be declined as reasoning_extraction, which has no fallback; set display to "summarized" instead.
Edited history
Fails the prefix check on every account: keep system and tools fixed, and only append.
stop_reason: refusal
Turn on server-side fallback to rerun cyber and biology refusals on Claude Opus 4.8 or Opus 5.
safeguards.pyPYTHON
response = client.beta.messages.create(
    model="claude-fable-5-2",
    max_tokens=8000,
    output_config={"effort": effort},
    # ...
    fallbacks="default",  # retry a declined request on the model Anthropic recommends for its category
    betas=["server-side-fallback-2026-07-01"],
    messages=[{"role": "user", "content": prompt}],
)
# ...
if response.stop_reason == "refusal":  # check this before reading content
    print(f"declined: category={response.stop_details.category} | {response.stop_details.explanation}")

Running the Capsid Folding Models on Hyperstack

Anthropic’s gene-therapy capsid example (the Mythos capsid clip) shows how the work splits. Mythos 5.2 wrote the method, and for the AAV2 capsid a single NVIDIA H200 GPU ran the open protein-folding models OpenFold3-preview2 and ESMFold2:

How Mythos 5.2 modelled the capsid

 
 1Claude Mythos 5.2 writes the methodCode that runs open-source folding models on the capsid2Groups of five neighbouring chainsThe folding runs on overlapping groups of chains3One NVIDIA H200 GPU runs the foldingAAV2: about 58 min with OpenFold3-preview2, 7 with ESMFold24Symmetry stitches all 60 chainsAAV2: 1.2 Å RMSD with OpenFold3-preview2, 1.4 Å with ESMFold2icosahedral symmetry

Direct access to Mythos 5.2 is limited to approved organisations, but those folding models are open, so anyone can run them. NVIDIA H200 SXM is available on demand on Hyperstack in eight-GPU virtual machines, billed per minute. AI Studio also serves open models.

Claude Mythos 5.2 predicts the structure of a gene-therapy capsid

Film: Anthropic.

Hyperstack GPU Cloud

Run the GPU Side on Hyperstack

Run folding pipelines and open models on NVIDIA H200 and NVIDIA H100 GPUs.

NVIDIA H200 SXMAI StudioPer-minute billing

Get started with Hyperstack in minutes.

FAQs

How do Claude Fable 5.2 and Claude Mythos 5.2 differ?

One model, one price: Fable 5.2 is open to everyone, with safeguards, and direct access to Mythos 5.2 goes to approved organisations.

How much does Claude Fable 5.2 cost?

$8 per million input tokens and $40 per million output tokens; batch requests cost half, and fast mode $16 and $80.

How do I access Claude Mythos 5.2?

Apply to Anthropic’s Cyber or Life Sciences Verification Program; approved organisations use the model ID claude-mythos-5-2. Claude Enterprise customers can also use it inside Claude Security.

Is Claude Fable 5.2 better than Claude Opus 5.5?

Anthropic’s scores put it ahead on all ten charted benchmarks; in our tests, Opus 5.5 matched it on scheduling and SQL for less and generated output faster.

Fareed Khan

Fareed Khan

calendar 12 Nov 2026

•

Read More
tutorials Tutorials link

Can Qwen 4 Compete With Claude Opus 5.5? We Put It to the Test

New models launch with their makers’ own benchmark scores, ...

New models launch with their makers’ own benchmark scores, but public benchmark questions can leak into training data, so those scores may not show how a model handles work it has not seen. That is why we test new models on the same sealed tasks, built on Kestrelmoor Freight, a synthetic company.

Our latest blog puts Alibaba’s Qwen 4 through those tests, covering the results first, then what they mean for your workloads, then the code to reproduce the test yourself.

How the Qwen 4 Benchmark Works

We built Kestrelmoor Freight for this test: a fictional logistics company whose invoices, dashboards, app screens, screen recordings and case files are all generated by code. The generator knows every answer, so each task is graded exactly, and none of it can appear in a model’s training data.

One synthetic company, nine jobs, three stages

 
 KestrelmoorFreightsynthetic firmPaperwork8 scriptsDashboardsIncident chartsDense screens1440 by 900 UIRecordingsUp to 10 minStacked rulesUp to 20 rulesPolicy casesCargo claimsCase filesUp to 256K tokens8 languagesOne answerLogic puzzlesOne solutionNINE JOBSTHREE STAGESSTAGE 1 · MAP6 modelsevery model on every jobSTAGE 2 · DUEL400 sealed4 jobs × 100 new tasksSTAGE 3 · SCALE1,250 docseach read twiceSame bytes for every model · 32,000-token output limit · every answer graded by code

The map put Qwen 4, Claude Opus 5.5, Kimi K3.1 Pro and three earlier Qwens through all nine jobs. The duel then reran the four jobs where Qwen 4 looked strongest (dense screens, paperwork, hard paperwork and writing to 16 to 20 rules) on 400 new tasks, each sealed with a cryptographic hash before any model saw it. A scale run then had Qwen 4 read 1,250 invoices and receipts.

Qwen 4 vs Claude Opus 5.5 on Sealed Tests

On all four sealed jobs, Opus led Qwen 4 by 0.2 to 0.8 points, and only the paperwork gap holds up statistically. The largest generational step is writing to 16 to 20 rules: 99.6 against 87.3 for Qwen3.8 Max, which ran out of tokens on 18 of 100 tasks.

Claude Fable 5.1, which joined only the duel, led Qwen 4 on all four jobs, by 0.3 to 1.1 points. The open-weight Kimi K3.1 Pro scored 0.2 to 0.8 points above Qwen 4 on three jobs, within 0.1 points of Opus on each, and Qwen 4 led it only on hard paperwork, by 0.5 points. The earlier Qwens trail Qwen 4: Qwen3.8 Max by 0.5 to 12.3 points, and Qwen3.8 Flash-Next and Omni-Flash by up to 31.2 and 34.9 points, on 16 to 20 rules.

Qwen 4 minus each rival, in points

Paired by task; left of zero, the rival led.

 
Qwen 4 finished within one point of Claude Opus 5.5 on dense screens, hard paperwork, paperwork and 16 to 20 rules, and 12.3 points above Qwen3.8 Max on the rules test.

Where Qwen 4 Stands Out

Five tasks from the test show the range:

Invoice
20 rules
Pixel click
8 languages
Video

A photographed Russian invoice with handwritten corrections: every header field, quantity, price and amount matched, and across 1,250 documents it read 99.8% of fields correctly.

 SKUQTYUNIT PRICEAMOUNTBIN-79946999.385,996.281514,990.70FRK-8077204,878.4297,568.4060292,705.20STR-412024993.8123,851.444039,752.4012printed, crossed out15written by hand, as Qwen 4 read it13 of 13header fields right33 linesevery number right0values invented

A customs notice under 20 rules at once: Qwen 4 passed all 20, while every earlier Qwen ran out of tokens.

 1Ends with ?2Para 5: 3 sentences3ASCII only4≤16 words/sentence5≤50 chars/line6One bold phrase7≤3 all-caps words8Two keywords9No exclamations10≤12 letters/word11Six paragraphs12<<Title>> line13P.S. at the end14Quote a table cell15Six digit groups16Products in order174 numbered lines18"update" ×419Two bullet lines20175 to 215 words

Click an 18 by 17 pixel icon on a dense console: Qwen 4 hit it, while earlier Qwens missed by 41 to 161 pixels.

 Qwen 4: inside the iconQwen3.8 Max: 41 pxQwen3.8 Flash-Next: 46 pxQwen3.8 Omni-Flash: 161 pxDashed box: the 18 by 17 px edit icon in the row of shipment KX-25422.

The same stock problem in eight languages: Qwen 4 answered 2224 each time, and all 64 tasks of the job correctly.

 EnglishEnglish2224中文Chinese2224日本語Japanese2224한국어Korean2224العربيةArabic2224اردوUrdu2224हिन्दीHindi2224РусскийRussian2224

One 10-minute recording with three one-second errors, sent as an MP4: Qwen 4 answered all four questions. Given 96 still frames instead, it answered half.

 15:39:2915:49:29q1 first error at 15:42:20q2 Settings tab, the click beforeq3 three errorsq4 KX-53913 saved as ON_HOLDroutine noticered error, one second on screen4 of 4 rightONE 600-SECOND MP4, 388,312 INPUT TOKENS

Where Claude Opus 5.5 Keeps an Edge

Opus leads on two jobs: dashboard threshold times, 100% against 71% in the first round, and long archives, 99.0 against 84.4. Qwen 4’s dashboard misses are chart-reading errors: given the same data as text, it answered every question. Its archive misses all came at 128K tokens or more.

Where Opus leads

 
Dashboard threshold times, first roundQwen 471%Claude Opus 5.5100%Long archives: eight shared case files, 32K to 256K tokensQwen 484.4Claude Opus 5.599.0

Opus also wrote about a third of Qwen 4’s output tokens, at a lower reasoning-effort setting: high against xhigh.

Qwen 4 Speed and Token Efficiency

On the same 912 tasks, Qwen 4 wrote 20% fewer output tokens than Qwen3.8 Max and answered in 40% less time. It also used fewer input tokens than Claude on a screenshot, 1,262 against 1,728, and fewer on a 12-second clip sent as video than as frames, 7,823 against 15,453:

Where Qwen 4 saves tokens and time

 
 
Qwen 4 used 6,090 output tokens and 99 seconds per answer against 7,624 and 164 for Qwen3.8 Max, 1,262 tokens for a screenshot against 1,728 for Claude, and 7,823 tokens for a 12-second clip as video against 15,453 as frames.

Sending Images and Video to Qwen 4

One converter builds every Qwen 4 request as an OpenAI-compatible chat completion, with images and video inline as base64 data URLs:

families/base.pyPYTHON
MEDIA_TYPES = {".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".mp4": "video/mp4"}
# ...

def _b64(rel: str) -> tuple[str, str]:
    path = EVAL / rel
    return MEDIA_TYPES[path.suffix.lower()], base64.b64encode(path.read_bytes()).decode()


def to_openai(prompt: dict) -> list:
    parts = []
    for rel in prompt.get("images") or []:
        mt, data = _b64(rel)
        parts.append({"type": "image_url", "image_url": {"url": f"data:{mt};base64,{data}"}})
    if prompt.get("video"):
        mt, data = _b64(prompt["video"])
        parts.append({"type": "video_url", "video_url": {"url": f"data:{mt};base64,{data}"}})
    parts.append({"type": "text", "text": prompt["text"]})
    msgs = [{"role": "system", "content": prompt["system"]}] if prompt.get("system") else []
    msgs.append({"role": "user", "content": parts if len(parts) > 1 else prompt["text"]})
    return msgs

The body streams the reply, reports usage and caps output, reasoning included; the map and duel ran Qwen 4 at effort xhigh:

clients/qwen.pyPYTHON
body = {"model": self.model, "messages": messages, "stream": True,
        "stream_options": {"include_usage": True}}
if effort is not None:
    body["reasoning_effort"] = effort
if max_completion_tokens is not None:
    body["max_completion_tokens"] = max_completion_tokens

The photographed Russian invoice from the showcase cost 2,147 image tokens, and Qwen 4 reasoned for 7,613 tokens before a 2,090-token answer:

Output: usage recordJSON
{
  "prompt_tokens": 2401,
  "total_tokens": 12104,
  "completion_tokens": 9703,
  "prompt_tokens_details": {
    "image_tokens": 2147,
    "text_tokens": 254
  },
  "completion_tokens_details": {
    "reasoning_tokens": 7613,
    "text_tokens": 2090
  }
}

Run Qwen Models on Hyperstack

Qwen 4 is not available on Hyperstack, as we tested it through early API access. To get our next model test as soon as it is published, subscribe below. You can start building with the Qwen family now, as two models from this test run on Hyperstack:

Its model card calls it an experimental preview of the Qwen4 architecture; it runs on Hyperstack AI Studio with image input. In our sealed jobs, it scored 15.5 points below Qwen 4 on dense screens and 31.2 below on 16 to 20 rules.

It runs on AI Studio for text; our guide deploys it on 64 NVIDIA H100 GPUs.

Both use an OpenAI-compatible API, as our GLM-5.2 tutorial shows; Dedicated Inference serves a model on its own GPUs.

Hyperstack AI Studio

Build With Qwen Models on Hyperstack

Call Qwen3.8 Max and Qwen3.8 Flash-Next through AI Studio, or run open models on NVIDIA H100 GPUs.

OpenAI-compatible APINVIDIA H100Per-minute billing

Get started with Hyperstack in minutes.

FAQs

What is Qwen 4?

Qwen 4 is the next major release of Alibaba’s Qwen models, tested here through early API access.

How does Qwen 4 compare with Claude Opus 5.5?

Opus finished slightly ahead, within one point, on all four sealed jobs, and led more clearly on dashboard times and the longest archives.

Is Qwen 4 more efficient than Qwen3.8 Max?

On the same 912 tasks, both at effort xhigh, it wrote 20% fewer output tokens and answered in 40% less time.

Can I run Qwen models on Hyperstack?

Yes. Qwen3.8 Flash-Next and Qwen3.8 Max run on Hyperstack AI Studio.

Fareed Khan

Fareed Khan

calendar 11 Nov 2026

•

Read More
tutorials Tutorials link

Deploy Kimi K3.1 Pro on Hyperstack: A Comprehensive Guide for ...

Kimi K3.1 Pro is Moonshot AI's open-weight, natively ...

Kimi K3.1 Pro is Moonshot AI's open-weight, natively multimodal agentic model, post-trained from Kimi K3. Its sparse Mixture-of-Experts architecture has 2.8 trillion parameters, with 104 billion active per token, and a 1-million-token context window. Moonshot AI reports improvements in coding, 3D creation, financial research and factual accuracy, with benchmark results competitive with leading proprietary models.

This tutorial serves Kimi K3.1 Pro on 32 NVIDIA H100 GPUs across four Hyperstack virtual machines with SGLang, the same cluster shape as our Kimi K3 deployment, and then puts the endpoint to work: reasoning effort, preserved thinking, tool calls, image input, a coding agent, and Claude Code, Kimi Code CLI and OpenClaw on top. For the model family behind it, see our technical deep dive into Kimi K3.

What Is Kimi K3.1 Pro?

Kimi K3.1 Pro is built on the Kimi K3 architecture, with one major change to attention. Here is how the architecture works:

  1. Sparse MoE Routing: 896 experts in total, with 16 selected per token plus 2 shared experts, so only 104B of the 2.8T parameters are active for any single token.
  2. Hybrid Attention Stack: 93 layers made up of 69 Kimi Delta Attention (KDA) layers and 24 Gated DSA layers, with one dense layer.
  3. Gated DeepSeek Sparse Attention: Compared with Kimi K3, the full-attention Gated MLA layers are replaced with Gated DSA. A lightweight indexer with 32 heads scores every earlier token and keeps the top 2,048, and attention then runs exactly over only those tokens. The vLLM team reports that at long context a decode step reads about a quarter of the bytes per layer that dense MLA reads.
  4. Native MXFP4 Quantisation: The routed-expert weights are stored in MXFP4 with MXFP8 activations, trained with quantisation-aware training rather than quantised after the fact. Attention, the shared experts and the vision tower stay in BF16.
  5. Configurable Thinking Effort: Reasoning depth is set per request with reasoning_effort, which accepts "low", "high" and "max" (default "max").
  6. Native Multimodal Fusion (MoonViT-V2): A 401M-parameter vision encoder is integrated directly, so the model accepts images alongside text in the same request.

Inside Kimi K3.1 Pro

Ninety-three layers, sixty-nine of them Kimi Delta Attention and twenty-four Gated DSA, with a latent Mixture-of-Experts block that routes each token to sixteen of eight hundred and ninety-six experts.

2.8T total104B active per token93 layers896 experts, top-161M contextMXFP4 expertsMoonViT-V2 visionKimi K3.1 Pro licence
CHECKPOINT ON DISK
1,561.29 GB
96 safetensors shards, 1,561,293,160,568 bytes
WEIGHT FORMAT
MXFP4 experts
MXFP8 activations, quantisation-aware training
ATTENTION
69 KDA + 24 Gated DSA
one dense layer, then a 3:1 hybrid stack
SPARSITY
16 of 896 experts
plus 2 shared, 104B of 2.8T active per token
CONTEXT
1,048,576 tokens
max_position_embeddings in config.json
VISION
MoonViT-V2, 401M
images and text in the same request

Figures from the moonshotai/Kimi-K3.1-Pro model card and config.json; the byte count is the repository file list. The weights carry Moonshot AI's Kimi K3.1 Pro licence rather than a stock open-source licence, so read it before building a commercial service on top.

What one token touches

Kimi K3.1 Pro is dense in memory and sparse in compute. Both bars describe the same model, counted two different ways.

Per token, 104 billion of the 2.8 trillion parameters are active, 3.7 per cent, and 16 of the 896 routed experts run, 1.8 per cent.

Size the cluster from the full bar: every one of the 896 experts has to be resident on some GPU, even though only 16 of them run for any given token.

Where the 24 Sparse Layers Sit

The layer pattern is regular. Three Kimi Delta Attention layers are followed by one Gated DSA layer, all the way down the stack, and the last two layers are both sparse. In the model configuration the DSA layers are 4, 8, 12 and every fourth layer up to 92, plus 93.

All 93 layers, in order

Lavender cells are Kimi Delta Attention, purple cells are Gated DSA.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Kimi Delta Attention, 69 layersGated DSA, 24 layersthe one dense MLP layer

Source: dsa_config.dsa_layers and linear_attn_config.kda_layers in the Kimi K3.1 Pro config.json.

How Gated DSA Picks 2,048 Tokens

Each sparse layer runs a small indexer next to its MLA attention. The indexer keeps one FP8 key per token, 132 bytes with its scale, scores every earlier token with 32 lightweight heads and keeps the 2,048 highest-scoring ones. MLA then attends exactly, but only over those tokens, reading their full 576-byte latents.

One Gated DSA layer

A cheap pass over everything, then exact attention over a fixed-size selection.

1The indexer scores every earlier token
32 lightweight heads, one FP8 index key per token, 132 bytes with its scale
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
earlier tokens in the contextthe top 2,048 are kept
 
 
2Exact attention over the kept tokens
MLA reads the full 576-byte latent for just those 2,048 tokens, whatever the length of the context

Byte sizes are FP8 figures from the vLLM Kimi K3.1 Pro launch post.

The saving grows with the context. Dense MLA reads 576 bytes per earlier token per layer. DSA still scans every earlier token, but only its 132-byte index key, and then reads full latents for a fixed 2,048 tokens. The chart works that arithmetic through from 4K to 1M tokens.

Bytes read per decode step, sparse against dense

Share of the bytes a dense MLA layer would read, for one decode step at each context length.

At 8K tokens of context a Gated DSA layer reads about 47.9 per cent of the bytes a dense MLA layer reads; at 128K about 24.5 per cent; at 1M tokens about 23.1 per cent, approaching the 22.9 per cent floor set by the 132-byte index keys.

Calculated as (132 × L + 576 × min(L, 2,048)) ÷ (576 × L) for L tokens of context, from the per-token sizes in the vLLM Kimi K3.1 Pro post.

Kimi K3.1 Pro Features

Kimi K3.1 Pro is designed for long-running, multi-step work rather than single-turn chat:

  • Agentic Coding: Scores 65.7 on Terminal-Bench 4.0, 51.7 on SWE Marathon v1.1 and 75.5 on DeepSWE v1.1, with the coding results evaluated through an agent harness.
  • Agentic Search and Tool Use: Scores 92.1 on BrowseComp and 70.0 on HLE-Full with tools, and 73.3 on Automation Bench-AA.
  • Office and Knowledge Work: Moonshot AI highlights financial research and document work, with 64.4 on OfficeQA Pro v2 and 85.7 on GDP.pdf with Python.
  • Factual Accuracy: On Moonshot AI's internal hallucination benchmark with tools, Kimi K3.1 Pro records a claim-level hallucination rate of 8.3 per cent (lower is better), down from 23.4 per cent for Kimi K3.
  • 3D Creation: Scores 72.8 on BenchCAD without tools and 92.7 with tools.
  • Multimodal and Long Context: A 1,048,576-token context window with native image understanding through MoonViT-V2.

Against Kimi K3 itself, the Kimi K3.1 Pro release reports gains on every internal benchmark it lists:

61.2

Kimi Code Bench 3.0 Long-horizon, up from 55.95 for Kimi K3

8.3%

claim-level hallucination rate on Kimi Hallu Bench Hard, from 23.4%

+11.6

points on the internal Financial Research benchmark

+7.2

points on the internal Financial Modelling benchmark

About 4.2×

Kimi K3's score on the Business Operation simulation

Kimi K3.1 Pro vs Leading Models on Coding and Agentic Benchmarks

Kimi K3.1 Pro against the leading proprietary models

Six coding and agentic benchmarks from the model card. Higher is better on every one.

Kimi K3.1 Pro (max)Claude Opus 5.5 (max, w/ fallback)GPT-6 Astra (max, w/ fallback)Claude Fable 5.1 (max, w/ fallback)
Kimi K3.1 Pro scores 65.7 on Terminal-Bench 4.0, 51.7 on SWE Marathon v1.1, 75.5 on DeepSWE v1.1, 70.0 on HLE-Full with tools, 92.1 on BrowseComp and 73.3 on Automation Bench-AA, against Claude Opus 5.5, GPT-6 Astra and Claude Fable 5.1.

Claude Fable 5.1 has no reported BrowseComp score. Source: the Kimi K3.1 Pro model card, whose footnotes give the harness for each benchmark.

Benchmark Kimi K3.1 Pro Claude Opus 5.5 GPT-6 Astra Claude Fable 5.1 DeepSeek-V4.1-Flash-1017
Terminal-Bench 4.0 65.7 66.4 58.2 57.9 42.3
SWE Marathon v1.1 51.7 46.3 42.5 45.6 40.0
DeepSWE v1.1 75.5 74.2 74.1 67.4 77.0
HLE-Full w/ tools 70.0 67.7 57.2 65.6 58.8
BrowseComp 92.1 90.8 91.5 n/a n/a
Automation Bench-AA 73.3 69.5 68.5 59.4 66.6
GPQA-Diamond 94.2 93.9 96.1 93.7 92.2
Kimi Hallu Bench Hard w/ tools (lower is better) 8.3 15.0 5.5 23.3 23.3

The deepest purple marks the best score in each row; on the hallucination row that is the lowest. Kimi K3.1 Pro and DeepSeek-V4.1-Flash-1017 run at max effort; the proprietary models at max effort with fallback, as the model card reports them.

What Kimi K3.1 Pro Builds

Moonshot AI published a set of projects that Kimi K3.1 Pro built end to end, across game engines, web pages and 3D tools. The coding examples run in Unreal Engine and Godot, and mix in web search and 3D generation. Pick a project under the player to switch the clip.

Celestial Palace battle game in Unreal Engine

A mythical Eastern palace in the sky, built in Unreal Engine 5.8: a 36-bay colonnade with a radius of 1,750 metres, a colossal dragon modelled procedurally in Blender, a MetaHuman lead character, and 36 million source triangles rendered with Nanite and lit with Lumen.

Celestial Palace battle game in Unreal EngineCelestial Palace
Eastern-style 3D RPG preview in Unreal EngineSword Flight
3D adventure game in GodotGodot Adventure

Videos: Moonshot AI, Kimi K3.1 Pro release blog and Kimi K3.1 Pro quickstart.

One of the coding projects is still live. Kimi K3.1 Pro generated a browser-based 3D robotic-arm reveal with exploded views, transparent shells and cross-sections: 2,317 parts and 268 dynamic wire routes, all produced in code and checked by 55 passing browser tests. It runs below.

The live robotic-arm page. Open it full screen at ayhiidmm4ui46.ok.kimi.link. Built by Kimi K3.1 Pro, published by Moonshot AI.

A Long-Horizon Run: Teaching a Body to Walk

Kimi K3.1 Pro's long-horizon coding is strengthened through large-scale reinforcement learning. In one internal test it built a human walking dynamics simulator, with training and evaluation pipelines, on top of an open-source anatomical model of the human body. When reward shaping failed to improve arm motion, it ran open-loop probes of the simulator's dynamics, corrected errors in the shoulder-muscle moment-arm calculations and retrained the controller.

296

skeletal components in the anatomical model, cartilage included

402

muscle components

167

missions, with 420 independent reviews

36

moment-arm errors found and corrected

11.2 s

of continuous walking, from collapsing within seconds

The walking simulator, from falling to a natural gait. Video: Moonshot AI, Kimi K3.1 Pro release blog.

3D Modelling and Design

Without MCP connectors, Kimi K3.1 Pro writes and runs scripts for tools such as Blender and CAD software to build and refine assets, edit components, and adjust geometry, materials and scene layout. On BenchCAD, which tests 3D reconstruction from multi-view renderings through CAD code generation, it scores 92.7 with tools. These are four of the assets it built:

Turbofan model built in FreeCAD

A turbofan built in FreeCAD from Python: fan, reduction gearbox, compressors, combustor, turbines and external piping across 2,100 solids, with step-by-step assembly, an exploded internal view, and the fan, low-pressure and high-pressure spools turning at 2,780, 8,590 and 12,400 RPM.

Turbofan model built in FreeCADTurbofan
Cathedral interior modelled in BlenderCathedral
An airport's indoor rainforest valley in BlenderRainforest Valley
3D-printable modular lamp built with trimeshModular Lamp

Videos: Moonshot AI, Kimi K3.1 Pro release blog and Kimi K3.1 Pro quickstart.

Kimi K3.1 Pro Deployment Architecture on 32 NVIDIA H100 GPUs

Kimi K3.1 Pro keeps the MXFP4 expert format of Kimi K3, and every expert has to stay resident in GPU memory. The checkpoint is 1,561,293,160,568 bytes across 96 shards in the repository file list, about 357 MB more than Kimi K3, in line with the small indexer added to each of the 24 sparse layers. That number decides the shape of the cluster.

Ninety-six shards, four times over

Tensor parallelism shards the model across GPUs at load time, but every node still needs the complete checkpoint on its own disk first, because each rank reads its slice of every tensor locally.

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96 safetensors shards, one node1,561.29 GB
 
 
the same download runs on all four nodes at once
PULLED ACROSS THE CLUSTER
6.25 TB
four complete copies, one per node
SHARDS PER NODE
96
the safetensors files in the repository
BYTES PER NODE
1,561.29 GB
1,561,293,160,568 bytes
CLUSTER TOTAL
6.25 TB
four nodes downloading in parallel

The nodes do not wait for each other, so the wall clock is one download rather than four.

An NVIDIA H100 "80GB" card is a rounded label. On this flavour nvidia-smi reports 81,559 MiB per card and PyTorch counts 79.19 GiB of usable capacity, so thirty-two cards come to about 2,534 GiB. Set the 1,454 GiB of weights against that and the deployment fits, with about 1,080 GiB left for the KV cache, the recurrent state that Kimi Delta Attention keeps for every request, the activations and the communication buffers.

The Checkpoint Against the Cluster

Thirty-two NVIDIA H100 cards, four nodes, one model. The bar is the whole cluster, and the shaded part is what the weights claim before the engine asks for anything.

NODE 0
NODE 1
NODE 2
NODE 3
 
 
 
 
Model weights · 1,454 GiB · 57%Everything else · 1,080 GiB · 43%
ONE CARD
79.19 GiB
as the PyTorch allocator counts an NVIDIA H100
THIRTY-TWO CARDS
2,534 GiB
the memory of the four nodes together
WEIGHTS
1,454.07 GiB
the 1,561.29 GB checkpoint, in GiB
LEFT OVER
1,080 GiB
KV cache, KDA state, context and buffers

No single node holds the model: a quarter of the shaded region lives on each machine. Card capacity is the figure PyTorch reports for an NVIDIA H100 on this flavour.

Why Tensor Parallel Has to Be 32

Tensor parallelism has to divide both the 96 attention heads and the 7168 hidden size evenly. Their greatest common divisor is 32, so the valid tensor-parallel sizes are 1, 2, 4, 8, 16 and 32, and only the largest leaves the weights under the capacity of an 80 GB card.

Why tensor parallelism has to be exactly 32

Two tests have to pass at once: the size has to divide 96 and 7168 into whole numbers, and it has to leave the weights under 79.19 GiB per card.

TP 8
96 HEADS ÷ TP
12
7168 ÷ TP
896
WEIGHTS PER CARD
181.8 GiB
✗
divides cleanly, but 8 cards cannot hold it
TP 16
96 HEADS ÷ TP
6
7168 ÷ TP
448
WEIGHTS PER CARD
90.9 GiB
✗
still above 79.19 GiB per card
TP 32
96 HEADS ÷ TP
3
7168 ÷ TP
224
WEIGHTS PER CARD
45.4 GiB
✓
the shape this deployment uses
TP 64
96 HEADS ÷ TP
1.5
7168 ÷ TP
112
WEIGHTS PER CARD
n/a
✗
a rank cannot hold half an attention head
GREATEST COMMON DIVISOR OF 96 AND 7168
32
the valid sizes are 1, 2, 4, 8, 16 and 32, and only the largest of them fits on an 80 GB card

Weights per card is the 1,454.07 GiB checkpoint divided evenly, before the engine adds anything of its own.

So four nodes of eight NVIDIA H100 GPUs is the shape for this model on this generation. A fifth node cannot lower the per-GPU weight load, because 40 does not divide 96, and data parallelism replicates the model rather than sharding it.

One Model, Four Machines

A multi-node deployment runs tensor parallelism across the node boundary, with expert parallelism laid over the top: thirty-two equal ranks in one process group. Three things follow, and they shape every command below. All four nodes sit in the same environment, which puts them on a shared private network. Collectives are pinned to that private interface with NCCL_SOCKET_IFNAME and run over TCP. And every node keeps its own full copy of the weights on its ephemeral disk.

Thirty-Two Equal Ranks

Every rank holds one thirty-second of every layer and one thirty-second of the experts. Rank 0 also runs the HTTP server, so it is the only node a client talks to.

NODE 0 · HEAD--node-rank 0
GPU
GPU
GPU
GPU
GPU
GPU
GPU
GPU
8x NVIDIA H100 · ranks 0 to 7 · NVLink bridges each card to one neighbour
a quarter of the model resident on this node
serves the OpenAI-compatible API on port 8000
 
 
torch.distributed rendezvous on port 20000 · NCCL over TCP sockets
the private network of one environment, NCCL_IB_DISABLE=1
NODE 1--node-rank 1
GPU
GPU
GPU
GPU
GPU
GPU
GPU
GPU
8x NVIDIA H100 · ranks 8 to 15
same launch command
NODE 2--node-rank 2
GPU
GPU
GPU
GPU
GPU
GPU
GPU
GPU
8x NVIDIA H100 · ranks 16 to 23
same launch command
NODE 3--node-rank 3
GPU
GPU
GPU
GPU
GPU
GPU
GPU
GPU
8x NVIDIA H100 · ranks 24 to 31
same launch command
World size
32
Tensor parallel
--tp-size 32
Expert parallel
--ep-size 32
Nodes
--nnodes 4

Tensor parallel 32 and expert parallel 32 give a world size of 32: 28 of the 896 routed experts on each GPU.

The Kernel Path on NVIDIA H100

Kimi K3.1 Pro's routed experts are MXFP4, and SGLang resolves its native MXFP4 runner automatically only on NVIDIA Blackwell. On NVIDIA H100 the launch selects the Marlin W4A16 kernel with --moe-runner-backend marlin: weights stay four-bit in memory and are expanded inside the kernel for each matrix multiply, the same path that serves Kimi K3 on this cluster.

The attention side changes with Kimi K3.1 Pro. The SGLang Kimi K3.1 Pro cookbook notes that SGLang serves the model with an FP8 KV cache and a page size of 64, that the MLA latent and indexer keys take about 18.9 KB per token, and that tensor parallelism replicates them on every GPU. Its tuning notes add that the recurrent KDA state pool, held per request, sets the concurrency ceiling, and its NVIDIA H100 layout caps concurrency with --max-running-requests 64.

Why Deploy Kimi K3.1 Pro on Hyperstack?

Hyperstack is a cloud platform engineered specifically to accelerate AI and machine learning workloads. Here is why it suits Kimi K3.1 Pro:

01
NVIDIA H100 and NVIDIA Blackwell for 3T-Class Models
Kimi K3.1 Pro runs across four 8x NVIDIA H100 virtual machines, and on a single NVIDIA HGX B300 virtual machine when one node is the better fit.
02
High-Speed Networking for Multi-Node Inference
Network-optimised environments give compatible GPU virtual machines, NVIDIA H100 PCIe with NVLink among them, inter-VM bandwidth of up to 350 Gbps, the path every tensor-parallel layer crosses.
03
Ephemeral Storage Sized for the Checkpoint
Each NVIDIA H100 NVLink node carries 6,500 GB of ephemeral storage, which holds the 1.56 TB checkpoint and the container image at /ephemeral, off the small root disk.
04
Pre-Configured CUDA and Docker Images
Ubuntu images with the NVIDIA driver, CUDA and Docker already installed remove the driver and runtime setup phase, so SGLang and vLLM, two of the engines Moonshot AI recommends, go straight from ssh to docker run.
05
A Path to Multi-Node and Private Clusters
Start on four NVIDIA H100 nodes or one NVIDIA HGX B300 node, then scale to NVIDIA GB300 NVL72 or a Secure Private Cloud deployment for production agentic serving.
06
Pay Only for What You Use
Per-minute GPU billing means an evaluation run costs only the minutes the virtual machines are running.

Run Kimi K3.1 Pro on Hyperstack

Serve a 3T-Class Open Model on NVIDIA GPUs You Control

Four 8x NVIDIA H100 nodes, one SGLang command, and an endpoint that Claude Code, Kimi Code CLI and OpenClaw can drive.

32x NVIDIA H100SGLangOpenAI and Anthropic APIsPer-minute billing

Get started with Hyperstack in minutes.

How to Deploy Kimi K3.1 Pro on Hyperstack

Now, let us walk through the step-by-step process of deploying the necessary infrastructure, from four empty virtual machines to a live endpoint.

1
Access Hyperstack
Sign in to the console and set up billing.
2
Deploy four virtual machines
8x NVIDIA H100-80G-PCIe-NVLink each, in one environment.
3
Configure the firewall
Your own address for SSH and the API, the peers for everything.
4
Access your nodes
Private IP, interface name, GPUs and disks on every node.
5
Prepare the ephemeral disk
Docker and the model cache move to /ephemeral.
6
Download the weights
All 96 shards on every node, with the image pull alongside.
7
Check all 96 shards
A complete checkpoint on every node before you serve.
8
Launch across four nodes
One command per node; only the rank and the IP change.
9
Test the deployment
The model list, then a first chat request.

Step 1: Accessing Hyperstack

First, you will need an account on Hyperstack.

  • Go to the Hyperstack console and log in.
  • If you are new, create an account and set up your billing information. Our documentation can guide you through the initial setup.

Step 2: Deploying Four 8x NVIDIA H100 Virtual Machines

From the Hyperstack dashboard, launch four identical GPU virtual machines. Tensor parallel 32 needs 32 GPUs, so the node count follows from the arithmetic above.

  • Create a Network-Optimised Environment: On the Environments page, click Create New Environment, name it and select CANADA-1. Hyperstack marks network-optimised environments with the ⚡ icon, and inside one, compatible GPU virtual machines reach inter-VM bandwidth of up to 350 Gbps, against up to 125 Gbps in legacy environments. NVIDIA H100 PCIe with NVLink is on the compatible list, and at tensor parallel 32 every layer exchanges data across all four nodes.
  • Initiate Deployment: Look for the "Deploy New Virtual Machine" button on the dashboard and click it.
Deploy New Virtual Machine button on the Hyperstack Virtual Machines page, the start of a Kimi K3.1 Pro deployment

The Deploy New Virtual Machine button.

Selecting the 8x NVIDIA H100-80G-PCIe-NVLink flavour in the Hyperstack console for a Kimi K3.1 Pro node

The flavour card for 8x NVIDIA H100-80G-PCIe-NVLink.

  • Choose the Operating System: Select the "Ubuntu Server 24.04 LTS R570 CUDA 12.8 with Docker" image. The image reference lists it with the NVIDIA driver, the CUDA toolkit and Docker installed, so the node is ready for containers as soon as you connect.
  • Environment: Choose the network-optimised environment you created. All four nodes must land in the same environment, because that is what puts them on a shared private network.
  • Select a Keypair: Choose an existing SSH keypair from your account to securely access the VMs. Use the same keypair for all four nodes.
  • Network Configuration: Ensure you assign a Public IP to every node. This is crucial for remote management and connecting your local development tools.
  • Review and Deploy: Double-check your settings, click the "Deploy" button, and repeat until four identical nodes are running.
Hyperstack OS image list including Ubuntu Server 24.04 LTS R570 CUDA 12.8 with Docker for a Kimi K3.1 Pro node

The OS image list. Choose Ubuntu Server 24.04 LTS R570 CUDA 12.8 with Docker.

Step 3: Configure the Firewall

The four nodes have to talk to each other freely on the private network, and you need to reach the API from your own machine. On each node's Firewall tab, add these firewall rules:

Port Source Why
22 your public IP /32 SSH access to all four nodes
8000 your public IP /32 The inference API, on the head node only
1 to 65535, TCP the other nodes' private IPs NCCL, Gloo and the torch.distributed rendezvous on port 20000
Adding an inbound TCP rule on the Hyperstack Firewall tab for the Kimi K3.1 Pro endpoint

Adding an inbound rule on the Firewall tab. Use your own address followed by /32 rather than 0.0.0.0/0.

Every node's private IP is shown on its detail page in the dashboard, so you can fill in the third rule before logging in anywhere. NCCL negotiates its ports dynamically, so that range has to be wide, but its source does not: scope it to the peer nodes' private addresses.

The endpoint has no authentication by default. Every example passes EMPTY as the key, and anything that reaches port 8000 has full use of the model, so keep the rule scoped to your own IP and never open it to 0.0.0.0/0.

Step 4: Accessing Your Nodes

Once your VMs are running, find each node's Public IP address in the Hyperstack dashboard and connect to it in a separate terminal.

Terminal, on your own machineSHELL
# Connect to each node using your private key and the node's public IP
ssh -i [path_to_your_ssh_key] ubuntu@[your_node_public_ip]

Replace [path_to_your_ssh_key] with the path to your private SSH key file and [your_node_public_ip] with the IP address of the node. Then, on every node, read its private IP and interface name, and confirm that all eight GPUs are visible and the large disk is mounted:

Terminal, run on all four nodesSHELL
# Private IP and the name of the private interface
ip -o -4 addr show | awk '{print $2, $4}' | grep -E ' 10\.'

# All eight NVIDIA GPUs present, with their memory size
nvidia-smi --query-gpu=index,name,memory.total --format=csv

# The two disks: a small root and a very large ephemeral disk
df -h / /ephemeral
Output of the three commands aboveOUTPUT
ens6 10.0.0.219/24

index, name, memory.total [MiB]
0, NVIDIA H100 PCIe, 81559 MiB
1, NVIDIA H100 PCIe, 81559 MiB
...
7, NVIDIA H100 PCIe, 81559 MiB

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        96G   12G   84G  13% /
/dev/vdb1       6.3T   28K  6.0T   1% /ephemeral

On these nodes the private interface is ens6 on a 10.0.0.0/24 subnet. Read both values from your own output and substitute them wherever this tutorial shows ens6 or a 10.0.0.x address; they go into the launch command in Step 8. The disk check shapes the rest: the root filesystem is about 96 GB, while the ephemeral disk mounted at /ephemeral offers about 6.3 TB.

Step 5: Prepare Storage on the Ephemeral Disk

The Kimi K3.1 Pro checkpoint is far too large for the root partition, so both the model weights and Docker's own storage go on the ephemeral disk mounted at /ephemeral. Everything in this step runs on all four nodes.

Terminal, all four nodes: 1 of 3, the directoriesSHELL
# The Hugging Face cache and Docker's storage both go on the ephemeral disk
sudo mkdir -p /ephemeral/hf /ephemeral/docker
sudo chown -R ubuntu:ubuntu /ephemeral/hf

Next, move Docker itself. The data-root key tells the daemon to store images and layers on the ephemeral disk rather than the root partition, and it takes effect on a restart:

Terminal, all four nodes: 2 of 3, move DockerSHELL
# Docker data-root -> /ephemeral (root is only ~96 GB; the image is about 16 GB)
sudo systemctl stop docker docker.socket
echo '{"data-root":"/ephemeral/docker"}' | sudo tee /etc/docker/daemon.json
sudo systemctl start docker
sleep 4

Finally, clear anything Docker has already written to the root disk, then confirm the move. docker info should report Docker Root Dir: /ephemeral/docker:

Terminal, all four nodes: 3 of 3, reclaim and confirmSHELL
# Reclaim whatever the previous storage driver left on the root disk
docker system prune -af

# Then confirm both halves of the move
docker info | grep 'Docker Root'
df -h /

Prune first, then pull. Recent Docker releases also keep image layers under the containerd snapshotter at /var/lib/containerd, which data-root does not cover. Running the prune before the pull, and keeping an eye on df -h / while it runs, leaves room for the image on the root disk.

Step 6: Pre-Download the Model Weights

The download is large enough that it is worth running once outside Docker, so you can monitor progress and recover cleanly from interruptions. Every node needs its own complete copy, so run this step on all four nodes at the same time. First make sure the Hugging Face client is present:

Terminal, run on all four nodesSHELL
# Ubuntu 24.04 marks its Python as externally managed, hence the flag
python3 -m pip install -q --break-system-packages -U huggingface_hub

Start the image pull first. It does not depend on the weights, so it can run while they download. The tag is the one the SGLang Kimi K3.1 Pro cookbook names for NVIDIA H100:

Terminal, all four nodes: 1 of 3, the container imageSHELL
# Start the image pull in the background. It does not depend on the
# weights, so there is no reason to wait for it.
nohup docker pull lmsysorg/sglang:dev-kimi-k31-pro >/tmp/pull.log 2>&1 &

Then start the weights. HF_TOKEN authenticates the download, because Hugging Face applies tighter rate limits to anonymous traffic than to signed-in users, and HF_HOME puts the cache on the ephemeral disk:

Terminal, all four nodes: 2 of 3, the weightsSHELL
# Authenticate, then pull 1.56 TB of weights onto the ephemeral disk.
# max_workers=16 runs sixteen file downloads in parallel.
export HF_TOKEN="YOUR_HF_TOKEN_HERE"
nohup env HF_HOME=/ephemeral/hf HF_TOKEN="$HF_TOKEN" \
  python3 -c "from huggingface_hub import snapshot_download; snapshot_download('moonshotai/Kimi-K3.1-Pro', max_workers=16)" \
  >/tmp/dl.log 2>&1 &
Terminal, all four nodes: 3 of 3, watch it landSHELL
# Watch the disk fill towards 1.56 TB
watch -n 30 'df -h /ephemeral | tail -1'

Important: keep HF_HOME=/ephemeral/hf on the download command. Without it, the cache defaults to ~/.cache/huggingface on the 96 GB root disk, which cannot hold a 1.56 TB checkpoint.

Keep the checkpoint between sessions. Data on /ephemeral is cleared when a virtual machine is hibernated, so to reuse the 1.56 TB later, copy it to a shared storage volume first, as the ephemeral storage guide describes.

Step 7: Check All 96 Shards Before You Serve

A 32-rank cluster loads for several minutes before it is in a position to notice that one of the 96 shards is short. Checking the download first takes seconds and gives you a definite answer before the expensive part begins. The script reads your token from ~/hf_token.txt, so save it there first with echo "$HF_TOKEN" > ~/hf_token.txt. It starts with the arguments and the header that authenticates the API call:

check_k31_download.py · 1 of 4, arguments and authPYTHON
#!/usr/bin/env python3
# check_k31_download.py - confirm a node has the COMPLETE Kimi K3.1 Pro
# checkpoint before we try to serve. Run ON the node.
import argparse, glob, json, os, urllib.request

ap = argparse.ArgumentParser()
ap.add_argument("--repo", default="moonshotai/Kimi-K3.1-Pro")
ap.add_argument("--hf-home", default="/ephemeral/hf")
ap.add_argument("--token-file", default=os.path.expanduser("~/hf_token.txt"))
a = ap.parse_args()

tok = ""
if os.path.exists(a.token_file):
    tok = open(a.token_file).read().strip()
h = {"User-Agent": "Mozilla/5.0"}
if tok:
    h["Authorization"] = "Bearer " + tok

Next it asks Hugging Face what should be there. The repository metadata lists every file, and keeping only the safetensors files gives the 96 names to look for:

check_k31_download.py · 2 of 4, what should be herePYTHON
# expected manifest from HF
req = urllib.request.Request(f"https://huggingface.co/api/models/{a.repo}", headers=h)
meta = json.loads(urllib.request.urlopen(req, timeout=60).read())

expected = [s["rfilename"] for s in (meta.get("siblings") or [])]
exp_st = sorted(f for f in expected if f.endswith(".safetensors"))

Then it finds the local copy. The downloader writes into a directory named after the commit and fills it with links into the blob store, so the size of each file is read through os.path.realpath:

check_k31_download.py · 3 of 4, what is herePYTHON
snap = os.path.join(a.hf_home, "hub", "models--" + a.repo.replace("/", "--"), "snapshots")
dirs = glob.glob(os.path.join(snap, "*"))
if not dirs:
    print(f"MISSING: no snapshot dir under {snap}")
    raise SystemExit(2)
d = dirs[0]

local, total = {}, 0
for f in exp_st:
    p = os.path.join(d, f)
    if os.path.exists(p):
        sz = os.path.getsize(os.path.realpath(p))
        local[f] = sz
        total += sz

Finally it compares the two and exits non-zero if anything is missing, so it can sit in front of your launch command:

check_k31_download.py · 4 of 4, compare and reportPYTHON
missing = [f for f in exp_st if f not in local]
incomplete = glob.glob(os.path.join(d, "*.incomplete"))
cfg_ok = os.path.exists(os.path.join(d, "config.json"))

print(f"repo             : {a.repo}")
print(f"snapshot dir     : {d}")
print(f"safetensors      : {len(local)}/{len(exp_st)} present")
print(f"total bytes      : {total:,} ({total/1e9:.2f} GB)")
print(f"config.json      : {'OK' if cfg_ok else 'MISSING'}")
print(f".incomplete files: {len(incomplete)}")

ok = (not missing) and (not incomplete) and cfg_ok
print("RESULT:", "COMPLETE" if ok else "INCOMPLETE")
raise SystemExit(0 if ok else 1)

Run it on every node. This is the result to look for, with the same commit hash on all four:

Output of check_k31_download.py, on every nodeOUTPUT
repo             : moonshotai/Kimi-K3.1-Pro
snapshot dir     : /ephemeral/hf/hub/models--moonshotai--Kimi-K3.1-Pro/snapshots/6d0a0202956796543364d666ab19c6ad1a494ee1
safetensors      : 96/96 present
total bytes      : 1,561,293,160,568 (1561.29 GB)
config.json      : OK
.incomplete files: 0
RESULT: COMPLETE

Step 8: Launch Kimi K3.1 Pro Across All Four Nodes

All four nodes run the same command, and only two values change between them: --node-rank and SGLANG_HOST_IP. Rank 0 is the head, and it is the only node that answers HTTP. Set the values first; paste this block into each node's terminal and change the first two lines:

Terminal, all four nodes: 1 of 3, the valuesSHELL
# Run this on EVERY node. Only RANK and SELF_PRIV change between them.
export RANK=0                     # 0 on the head, then 1, 2 and 3
export SELF_PRIV="10.0.0.219"     # THIS node's private IP
export HEAD_PRIV="10.0.0.219"     # the head node's private IP, on all four
export NIC="ens6"                 # the private interface from Step 4
export HF_TOKEN="YOUR_HF_TOKEN_HERE"

# Clear any container left from an earlier launch
docker rm -f sgl 2>/dev/null || true

Next collect the engine arguments, which follow the SGLang cookbook's NVIDIA H100 layout for Kimi K3.1 Pro: tensor parallel 32, expert parallel 32 and a 0.85 static memory share across four nodes.

Terminal, all four nodes: 2 of 3, the engine argumentsSHELL
# Everything the engine itself needs, collected in one variable so the
# docker command below stays readable.
K31_ARGS="--trust-remote-code \
  --model-path moonshotai/Kimi-K3.1-Pro \
  --tp-size 32 \
  --ep-size 32 \
  --nnodes 4 \
  --node-rank $RANK \
  --dist-init-addr $HEAD_PRIV:20000 \
  --moe-runner-backend marlin \
  --mem-fraction-static 0.85 \
  --max-running-requests 64 \
  --dist-timeout 3600 \
  --reasoning-parser kimi_k3 \
  --tool-call-parser kimi_k3 \
  --host 0.0.0.0 \
  --port 8000"

Then launch. Everything here is container-level: the GPUs, host networking and shared memory, the weights mounted where the engine looks for them, and the environment it reads at start-up:

Terminal, all four nodes: 3 of 3, launchSHELL
docker run -d --name sgl --gpus all --network host --ipc=host --shm-size 32g \
  --ulimit memlock=-1 --ulimit stack=67108864 \
  -v /ephemeral/hf:/root/.cache/huggingface \
  --env "HF_TOKEN=$HF_TOKEN" \
  --env NCCL_CUMEM_ENABLE=1 \
  --env PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
  --env SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0 \
  --env SGLANG_HOST_IP=$SELF_PRIV \
  --env NCCL_SOCKET_IFNAME=$NIC \
  --env GLOO_SOCKET_IFNAME=$NIC \
  --env NCCL_IB_DISABLE=1 \
  lmsysorg/sglang:dev-kimi-k31-pro \
  sglang serve $K31_ARGS

Start rank 0 first, then the other three. The rendezvous on port 20000 waits for all four, and --dist-timeout 3600 gives it an hour. This is what each setting does:

--tp-size 32
Shards every layer across all 32 GPUs, the largest size that divides both the 96 attention heads and the 7168 hidden size.
--ep-size 32
Spreads the 896 routed experts across the same 32 ranks, 28 on each.
--nnodes / --node-rank 4 / $RANK
The cluster size and this node's position in it.
--dist-init-addr $HEAD_PRIV:20000
The rendezvous point: every node points at the head on port 20000.
--moe-runner-backend marlin
Runs the MXFP4 experts through the W4A16 Marlin kernel on NVIDIA H100.
--mem-fraction-static 0.85
The share of each GPU for weights, KV cache and KDA state.
--max-running-requests 64
The concurrency cap; each running request holds its own KDA state.
--dist-timeout 3600
An hour for the rendezvous, enough for every rank to load its share of 1.56 TB.
--reasoning-parser kimi_k3
Returns the chain of thought in a separate reasoning_content field.
--tool-call-parser kimi_k3
Converts Kimi's tool tokens into standard OpenAI tool_calls.
--trust-remote-code
Kimi K3.1 Pro ships its own configuration and processor classes in the repository.
NCCL_SOCKET_IFNAME, GLOO_SOCKET_IFNAME=$NIC
Pins the collectives and the control channel to the private interface.
NCCL_IB_DISABLE=1
The nodes talk over the private Ethernet network, not InfiniBand.
SGLANG_HOST_IP=$SELF_PRIV
The address this rank advertises to the other 31.
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
Lets the allocator grow segments rather than fragment memory while 1.56 TB loads.
SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK=0
Skips the start-up check that every rank has the same free memory.
NCCL_CUMEM_ENABLE=1
NCCL's cuMem buffer allocation, as in the Kimi K3 launch on this cluster.
Terminal, the head nodeSHELL
docker logs -f sgl

What happens between docker run and the first request

Five stages, in order, on all four nodes at once.

1
The containers start
SGLang reads the same flags on every node.
2
Thirty-two ranks join
The rendezvous on port 20000 completes once all four nodes are up.
3
Weights load from /ephemeral
Each rank reads its slice of every tensor, and the experts are prepared for the Marlin kernel.
4
Memory is sized
The KV cache and KDA state pools take what remains of the 0.85 share once the weights are resident.
5
The API opens on the head node
The log prints its ready line and port 8000 starts answering.

Stages of an SGLang start-up for this configuration.

The process is complete when the head node's log shows:

Log line, the head nodeOUTPUT
The server is fired up and ready to roll!

Step 9: Test the Deployment

Run these from your local machine (not the VM), against the head node's public IP, once the port 8000 rule from Step 3 is in place. First list the served model:

Terminal, on your own machineSHELL
# Use the HEAD node's PUBLIC IP here, not the private one
export HEAD_IP="your.head.node.public.ip"

curl -s http://$HEAD_IP:8000/v1/models
ResponseJSON
{
  "object": "list",
  "data": [
    {
      "id": "moonshotai/Kimi-K3.1-Pro",
      "object": "model",
      "owned_by": "sglang",
      "root": "moonshotai/Kimi-K3.1-Pro",
      "max_model_len": 1048576
    }
  ]
}

Then send a first chat request. reasoning_effort is set to "low" to keep the check quick:

Terminal, on your own machineSHELL
curl -s http://$HEAD_IP:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer EMPTY" \
  -d '{
    "model": "moonshotai/Kimi-K3.1-Pro",
    "messages": [{"role": "user", "content": "Who are you? One sentence."}],
    "reasoning_effort": "low",
    "max_tokens": 256
  }'
Response, the message objectJSON
"message": {
  "role": "assistant",
  "content": "Hello! I am Kimi, an AI assistant developed by Moonshot AI.",
  "reasoning_content": "The user asks who I am, in one sentence. I am Kimi,
                        developed by Moonshot AI. Answer briefly.",
  "tool_calls": null
}

A successful response returns the answer in content and the model's thinking in a separate reasoning_content field. The Kimi K3.1 Pro model is now deployed on Hyperstack.

Moonshot AI's published evaluation results use the following sampling parameters:

Sampling parameters behind the model card resultsJSON
{"reasoning_effort": "max", "temperature": 1.0, "top_p": 0.95}

Controlling Thinking Effort

Now that the SGLang server is running, we can interact with it from Python. The helper below uses only the standard library, so there is nothing to install; any OpenAI-compatible client works the same way against /v1/chat/completions.

k31_chat.py · the request helperPYTHON
import json
import time
import urllib.request

BASE = "http://<HEAD_NODE_PUBLIC_IP>:8000/v1"
MODEL = "moonshotai/Kimi-K3.1-Pro"
KEY = "EMPTY"

def post(body, timeout=1800):
    req = urllib.request.Request(
        BASE + "/chat/completions",
        data=json.dumps(body).encode(),
        headers={"Content-Type": "application/json",
                 "Authorization": "Bearer " + KEY})
    t0 = time.time()
    with urllib.request.urlopen(req, timeout=timeout) as r:
        return json.load(r), time.time() - t0

A first request. The thinking and the answer come back in separate fields:

k31_chat.py · a requestPYTHON
messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Explain what a mixture-of-experts model is, simply, in 2 sentences."},
]

resp, dt = post({"model": MODEL, "messages": messages, "max_tokens": 4096,
                 "reasoning_effort": "high"})     # low, high or max
k31_chat.py · reading the two fieldsPYTHON
m = resp["choices"][0]["message"]
content = m.get("content") or ""
reasoning = m.get("reasoning_content") or ""

print("--- thinking ---")
print(reasoning)              # the chain of thought lands here
print("--- answer ---")
print(content)                # the final answer lands here
OutputOUTPUT
--- thinking ---
The user wants a simple, two-sentence explanation of a mixture-of-experts model.
Key idea: many expert sub-networks, a router picks a few per token, so only part
of the model runs each time. Keep it plain.
--- answer ---
A mixture-of-experts model is a large neural network split into many smaller
"expert" sub-networks, plus a router that sends each token to only a few of them.
Because only those few experts run for any given token, the model can hold far
more knowledge than it has to compute with at each step.

Kimi K3.1 Pro always thinks. Unlike Kimi K2.6, there is no instant mode to switch thinking off. Instead, the depth of thinking is set with the top-level reasoning_effort field, which accepts "low", "high" and "max" (default "max"). Moonshot AI's reasoning effort guide presents the three levels as a trade between reasoning depth, latency and token usage. Use "low" for direct questions and keep "max" for debugging, planning and maths.

k31_chat.py · the same problem at two effortsPYTHON
prompt = ("Three friends split a bill. Ana pays twice what Ben pays, and Ben pays 3 more "
          "than Cara. The total is 43. How much does each pay?")

for effort in ("low", "max"):
    resp, dt = post({"model": MODEL, "max_tokens": 16384, "reasoning_effort": effort,
                     "messages": [{"role": "user", "content": prompt}]})
    m = resp["choices"][0]["message"]
    print(f"  [{effort:>3}] {m.get('content')}")
OutputOUTPUT
  [low] Cara pays 8.50, Ben pays 11.50 and Ana pays 23.00.
  [max] Cara pays 8.50, Ben pays 11.50 and Ana pays 23.00, which adds up to 43.

Both efforts reach the same answer. What changes is the thinking in front of it:

The reasoning_content of the two responsesOUTPUT
# the low-effort thinking:
Cara = c, Ben = c+3, Ana = 2c+6. Total 4c+9 = 43, c = 8.5. Ben 11.5, Ana 23.

# the opening of the max-effort thinking:
The user wants me to solve a word problem. Let me work through it.
Let Cara pay x. Ben pays 3 more than Cara: Ben = x + 3.
Ana pays twice what Ben pays: Ana = 2(x + 3) = 2x + 6.
Total: x + (x + 3) + (2x + 6) = 43, so 4x + 9 = 43 and x = 8.5 ...
Check: 8.5 + 11.5 + 23 = 43.

Every request pays for a reasoning pass, even at "low". Read usage in the response when budgeting token costs, as a client that reads only content still pays for the thinking tokens.

Preserved Thinking for Multi-Turn Coding Agents

For multi-turn conversations and tool calls, Kimi K3.1 Pro requires the complete assistant message returned by the API to be passed back into messages as-is, including reasoning_content and tool_calls, not just content. This is a requirement rather than an option: if the reasoning is dropped between turns, the model loses the thinking it built on the previous turn.

The example below, adapted from the Moonshot AI model card, shows the pattern. The prior assistant turn carries reasoning that mentions five numbers, but its visible answer lists only three:

k31_chat.py · a conversation with reasoning in itPYTHON
# the example from the Kimi K3.1 Pro model card: the earlier reasoning
# named five numbers, the visible answer gave only three
msgs = [
    {"role": "user", "content": "Tell me three random numbers."},
    {"role": "assistant",
     "reasoning_content": "I will start by listing five numbers: 473, 921, 235, 215, 222, "
                          "and I will tell you the first three.",
     "content": "473, 921, 235"},
]
k31_chat.py · the whole turn, every timePYTHON
# pass the assistant message back AS-IS, including reasoning_content.
# For a turn you received from the server, rebuild it the same way:
def assistant_turn(m):
    turn = {"role": "assistant", "content": m.get("content") or ""}
    if m.get("reasoning_content"):
        turn["reasoning_content"] = m["reasoning_content"]
    if m.get("tool_calls"):
        turn["tool_calls"] = m["tool_calls"]
    return turn
k31_chat.py · the follow-up questionPYTHON
msgs.append({"role": "user", "content": "What are the other two numbers you have in mind?"})

resp2, dt2 = post({"model": MODEL, "messages": msgs, "max_tokens": 16384,
                   "reasoning_effort": "max"})
print(resp2["choices"][0]["message"].get("content"))
OutputOUTPUT
The other two numbers were 215 and 222.

Because the prior reasoning trace mentioned 215 and 222, the model can answer with those exact numbers. If you rebuild the assistant turn from content alone, that reasoning is silently lost, so carry reasoning_content back explicitly, as assistant_turn() does.

Multimodal Capabilities with Kimi K3.1 Pro

Kimi K3.1 Pro is natively multimodal through its integrated MoonViT-V2 encoder, so it can analyse images alongside text in the same request. The image input format is identical to the OpenAI vision API. To make the check objective, the example builds its own test image, left half red and right half blue, with nothing but the standard library:

k31_vision.py · 1 of 2, a test imagePYTHON
import base64
import struct
import zlib

def make_png(w=128, h=128):
    rows = b""
    for _ in range(h):
        row = b"\x00"                                    # filter byte
        for x in range(w):
            row += b"\xff\x00\x00" if x < w // 2 else b"\x00\x00\xff"
        rows += row

    def chunk(tag, data):
        c = struct.pack(">I", len(data)) + tag + data
        return c + struct.pack(">I", zlib.crc32(tag + data) & 0xFFFFFFFF)

    ihdr = struct.pack(">IIBBBBB", w, h, 8, 2, 0, 0, 0)    # 8-bit truecolour
    return (b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", ihdr)
            + chunk(b"IDAT", zlib.compress(rows, 9)) + chunk(b"IEND", b""))
k31_vision.py · 2 of 2, the requestPYTHON
b64 = base64.b64encode(make_png()).decode()

resp, dt = post({"model": MODEL, "max_tokens": 2048, "reasoning_effort": "low",
                 "messages": [{"role": "user", "content": [
                     {"type": "text", "text": "What do you see in this image? "
                                              "Name the colours and how they are arranged."},
                     {"type": "image_url",
                      "image_url": {"url": f"data:image/png;base64,{b64}"}}]}]})

ans = (resp["choices"][0]["message"].get("content") or "").strip()
print(f"  ANSWER: {ans[:300]}")
OutputOUTPUT
  ANSWER: The image shows two solid colour blocks side by side: the left half is
          red and the right half is blue, meeting along a sharp vertical line down
          the middle.

The image travels as a base64 data URI in the "url" field, so the server needs no outbound access to fetch it.

Agentic Use Case with Kimi K3.1 Pro

One of the defining features of moonshotai/Kimi-K3.1-Pro is long-horizon agentic tool calling. Unlike standard chat where the model just generates text, an agentic workflow lets it:

  • Decide when external tools are needed
  • Call tools automatically
  • Receive tool outputs and continue reasoning
  • Complete multi-step tasks autonomously

Because we launched SGLang with --tool-call-parser kimi_k3, the server emits structured tool calls in the standard OpenAI format. Start with a round trip that is easy to check: an arithmetic tool and a small weather lookup.

k31_tools.py · 1 of 8, safe arithmeticPYTHON
import ast
import operator

ops = {
    ast.Add:  operator.add,
    ast.Sub:  operator.sub,
    ast.Mult: operator.mul,
    ast.Div:  operator.truediv,
    ast.Pow:  operator.pow,
    ast.USub: operator.neg,
}
k31_tools.py · 2 of 8, the calculatorPYTHON
def calculate(expression: str):
    def ev(n):
        if isinstance(n, ast.Constant):
            return n.value
        if isinstance(n, ast.BinOp):
            return ops[type(n.op)](ev(n.left), ev(n.right))
        if isinstance(n, ast.UnaryOp):
            return ops[type(n.op)](ev(n.operand))
        raise ValueError("bad expr")

    return {"result": ev(ast.parse(expression, mode="eval").body)}
k31_tools.py · 3 of 8, a weather lookupPYTHON
def get_weather(city: str):
    forecasts = {"Tokyo": "22C, clear", "London": "14C, rain", "Cairo": "35C, sunny"}
    return {"city": city, "weather": forecasts.get(city, "18C, partly cloudy")}

IMPL = {"calculate": calculate, "get_weather": get_weather}
k31_tools.py · 4 of 8, the calculator schemaPYTHON
CALCULATE_TOOL = {
    "type": "function",
    "function": {
        "name": "calculate",
        "description": "Evaluate a basic arithmetic expression.",
        "parameters": {
            "type": "object",
            "properties": {
                "expression": {"type": "string", "description": "e.g. '47*89'"},
            },
            "required": ["expression"],
        },
    },
}
k31_tools.py · 5 of 8, the weather schemaPYTHON
WEATHER_TOOL = {
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get current weather for a city.",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}

TOOLS = [CALCULATE_TOOL, WEATHER_TOOL]

The loop sends the task, runs every tool call the model returns, appends the results and calls the model again until it stops asking for tools. Each assistant turn goes back whole:

k31_tools.py · 6 of 8, the loopPYTHON
task = ("What is 47 * 89? Also, what is the weather in Tokyo? "
        "Use your tools, then give me one combined answer.")
messages = [{"role": "system", "content": "You are a helpful assistant with tools."},
            {"role": "user", "content": task}]

for turn in range(6):
    resp, dt = post({"model": MODEL, "messages": messages, "tools": TOOLS,
                     "max_tokens": 4096, "reasoning_effort": "high"})
    m = resp["choices"][0]["message"]
    tcs = m.get("tool_calls") or []
    print(f"[turn {turn}] tool_calls={len(tcs)}")

    if not tcs:
        print(m.get("content", ""))
        break
k31_tools.py · 7 of 8, inside the loop: the turn goes backPYTHON
    # echo the assistant message back AS-IS (content + reasoning_content + tool_calls)
    messages.append(assistant_turn(m))
k31_tools.py · 8 of 8, inside the loop: run each callPYTHON
    for tc in tcs:
        fn = tc["function"]["name"]
        try:
            args = json.loads(tc["function"].get("arguments") or "{}")
            result = IMPL[fn](**args)
        except Exception as e:
            args, result = {}, {"error": str(e)}

        print(f"    -> {fn}({args}) = {result}")
        messages.append({"role": "tool", "tool_call_id": tc.get("id", fn),
                         "name": fn, "content": json.dumps(result)})
OutputOUTPUT
[turn 0] tool_calls=2
    -> calculate({'expression': '47*89'}) = {'result': 4183}
    -> get_weather({'city': 'Tokyo'}) = {'city': 'Tokyo', 'weather': '22C, clear'}
[turn 1] tool_calls=0

Here are both results:

- 47 x 89 = 4,183
- Tokyo weather: 22C and clear

So 47 times 89 is 4,183, and it is a clear day at 22C in Tokyo.

Both calls arrive in a single turn, and the second turn combines the two results into one answer.

A Coding Agent with a Shell Tool

For sustained engineering work, the same harness gets a single shell tool scoped to a workspace directory. Run it on a machine you are happy for the model to change, since the tool executes whatever command the model writes:

k31_agent.py · 1 of 3, the shell toolPYTHON
import os
import subprocess

WORKSPACE = os.path.expanduser("~/agent_workspace")
os.makedirs(WORKSPACE, exist_ok=True)

SHELL_TOOL = {
    "type": "function",
    "function": {
        "name": "run_shell",
        "description": "Run a shell command inside the workspace and return its output.",
        "parameters": {
            "type": "object",
            "properties": {"command": {"type": "string"}},
            "required": ["command"],
        },
    },
}
k31_agent.py · 2 of 3, running a commandPYTHON
def run_shell(command):
    try:
        proc = subprocess.run(command, shell=True, cwd=WORKSPACE,
                              capture_output=True, text=True, timeout=120)
    except subprocess.TimeoutExpired:
        return "command timed out after 120 seconds"
    return (proc.stdout + proc.stderr)[-8000:]
k31_agent.py · 3 of 3, the agent loopPYTHON
def agent_loop(task, max_steps=30):
    messages = [{"role": "user", "content": task}]
    for _ in range(max_steps):
        resp, dt = post({"model": MODEL, "messages": messages, "tools": [SHELL_TOOL],
                         "max_tokens": 16384, "reasoning_effort": "high"})
        m = resp["choices"][0]["message"]
        messages.append(assistant_turn(m))      # the whole turn goes back each time
        if not m.get("tool_calls"):
            return m.get("content")
        for tc in m["tool_calls"]:
            command = json.loads(tc["function"]["arguments"])["command"]
            messages.append({"role": "tool", "tool_call_id": tc["id"],
                             "name": "run_shell", "content": run_shell(command)})
    return "step limit reached"

Example 1: Long-Horizon Refactor

This is the kind of sustained, multi-step engineering work Kimi K3.1 Pro is built for: read existing code, plan a change, apply it and check it without losing track. We seed the workspace with a small file and ask the model to refactor it:

k31_agent.py · the refactor taskPYTHON
# Seed the workspace with a deliberately rough file
with open(os.path.join(WORKSPACE, "calc.py"), "w") as f:
    f.write("def calc(a, b, op):\n"
            "    if op == 'add': return a + b\n"
            "    if op == 'sub': return a - b\n"
            "    if op == 'mul': return a * b\n"
            "    if op == 'div': return a / b\n")

print(agent_loop(
    "Refactor calc.py to use a dict-based dispatch table instead of if chains, "
    "add type hints, handle division by zero, and add three pytest tests in "
    "test_calc.py. Run the tests and fix any failures."
))

What happens internally over the tool calls:

  1. The model interprets the request and decides it needs to read calc.py first.
  2. It calls run_shell with cat calc.py and reads the existing structure.
  3. It writes a refactored version of the file.
  4. It writes test_calc.py with three test cases.
  5. It runs pytest test_calc.py -q and reads the output.
  6. If a test fails, it reads the failure, edits the file and re-runs. This is where preserved thinking matters most, as the model continues from its earlier reasoning instead of re-deriving it.
  7. It returns a summary of changes.

Example 2: Coding-Driven Design (Build a Website)

Using the same agent harness, Kimi K3.1 Pro can turn a single prompt into a self-contained website:

k31_agent.py · the website taskPYTHON
print(agent_loop(
    "Build a single-page cat-themed website at index.html. Include a hero section, "
    "a description of three cat breeds in cards, a scroll-triggered fade-in "
    "animation, and inline CSS so the file works standalone. Then confirm the "
    "file exists."
))

The model writes a complete index.html in ~/agent_workspace. Open the file in a browser to review the page it generated.

Integration with Third-Party Coding Assistants

Because SGLang exposes the OpenAI-compatible /v1/chat/completions endpoint alongside an Anthropic-compatible /v1/messages route, and we enabled the Kimi tool-call parser, the self-hosted Kimi K3.1 Pro plugs into most modern coding assistants. Below are three of the most useful integrations.

Integrating with Kimi Code CLI

Moonshot AI's own agent framework is the Kimi Code CLI, available at kimi.com/code, and Moonshot AI uses it as the harness for several of the published Kimi K3.1 Pro benchmark results. Install it with the official script:

Terminal, on your own machineSHELL
# Install Kimi Code CLI (macOS and Linux)
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash

By default Kimi Code talks to Moonshot AI's hosted API. To point it at your endpoint, add a provider and a model to ~/.kimi-code/config.toml. The providers reference documents the openai type for any OpenAI-compatible service, and it handles the reasoning_content field and effort settings itself:

~/.kimi-code/config.tomlTOML
# ~/.kimi-code/config.toml
default_model = "hyperstack/kimi-k3.1-pro"

[providers.hyperstack]
type = "openai"
base_url = "http://<HEAD_NODE_PUBLIC_IP>:8000/v1"
api_key = "EMPTY"

[models."hyperstack/kimi-k3.1-pro"]
provider = "hyperstack"
model = "moonshotai/Kimi-K3.1-Pro"
max_context_size = 131072
capabilities = ["thinking", "always_thinking", "image_in", "tool_use"]
support_efforts = ["low", "high", "max"]
default_effort = "high"

max_context_size is required, and it tells the CLI when to compact a long session; keep it at or below the KV cache size SGLang prints at start-up as max_total_num_tokens. The field names follow the configuration file reference. Then start the CLI in a project directory:

Terminal, in your projectSHELL
# Start in your project directory, then check the model with /status
kimi

Integration with Claude Code

Moonshot AI provides an Anthropic-compatible API for Kimi K3.1 Pro, and SGLang serves an Anthropic-compatible /v1/messages route on every server, so you can point Claude Code at your self-hosted Kimi K3.1 Pro server. Moonshot AI also evaluated many of the coding benchmarks above using the Claude Code harness.

Set the following environment variables before launching Claude Code:

Terminal, on your own machineSHELL
# Point Claude Code at the head node's Anthropic-compatible route
export ANTHROPIC_BASE_URL="http://<HEAD_NODE_PUBLIC_IP>:8000"
export ANTHROPIC_AUTH_TOKEN="EMPTY"
export API_TIMEOUT_MS="3000000"
export CLAUDE_CODE_ATTRIBUTION_HEADER=0
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1

# Use Kimi K3.1 Pro for every Claude Code model tier
export ANTHROPIC_DEFAULT_OPUS_MODEL="moonshotai/Kimi-K3.1-Pro"
export ANTHROPIC_DEFAULT_SONNET_MODEL="moonshotai/Kimi-K3.1-Pro"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="moonshotai/Kimi-K3.1-Pro"

claude

Environment Variables Overview

ANTHROPIC_BASE_URL
Points to your SGLang server on the head node.
ANTHROPIC_AUTH_TOKEN
Sent as the bearer token. Any non-empty value works while the server runs without a key.
API_TIMEOUT_MS
A long request timeout, for long reasoning turns.
CLAUDE_CODE_ATTRIBUTION_HEADER=0
Drops the per-request attribution block from the start of the system prompt.
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
Turns off non-essential network traffic such as auto-updates, telemetry and error reporting.
ANTHROPIC_DEFAULT_*_MODEL
The model name each Claude Code tier sends.

Efficiency Tip: Add these environment variables to your shell profile (for example ~/.bashrc or ~/.zshrc) or define them inside ~/.claude/settings.json under the "env" key for a persistent setup.

Keep the prefix cache warm. Claude Code places a per-request attribution block at the start of the system prompt, which changes every turn. CLAUDE_CODE_ATTRIBUTION_HEADER=0 removes it, so SGLang's prefix cache can reuse the conversation from one turn to the next, as the SGLang Anthropic API guide and the Claude Code environment variable reference describe.

Once Claude Code launches, check the connection with a simple prompt. If the model responds correctly, your agentic coding environment is running on Kimi K3.1 Pro.

Deployment with OpenClaw

Kimi K3.1 Pro's long-horizon reasoning also makes it a strong engine for OpenClaw, the open-source, self-hosted agent platform. Pointing OpenClaw at your SGLang server gives you an autonomous coding environment in your terminal. Install it with the official installer:

Terminal, on your own machineSHELL
# Install OpenClaw (macOS, Linux and WSL2)
curl -fsSL https://openclaw.ai/install.sh | bash

# Any non-empty value works while the server runs without a key
export SGLANG_API_KEY="EMPTY"

Configuring the Local Provider

OpenClaw ships an SGLang provider for OpenAI-compatible SGLang servers. To bridge it to your cluster, merge the following provider block into ~/.openclaw/openclaw.json:

~/.openclaw/openclaw.jsonJSON
{
  "models": {
    "mode": "merge",
    "providers": {
      "sglang": {
        "baseUrl": "http://<HEAD_NODE_PUBLIC_IP>:8000/v1",
        "apiKey": "${SGLANG_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "moonshotai/Kimi-K3.1-Pro",
            "name": "Kimi K3.1 Pro on Hyperstack",
            "reasoning": true,
            "input": ["text", "image"],
            "contextWindow": 131072,
            "maxTokens": 8192
          }
        ]
      }
    }
  }
}

Configuration Tip: The id field must match the model id the server reports at /v1/models (here, moonshotai/Kimi-K3.1-Pro). contextWindow tells OpenClaw how much history to send, so keep it within the KV cache size in the SGLang start-up log, as with Kimi Code.

Once configured, set the model and launch the OpenClaw TUI:

Terminal, on your own machineSHELL
openclaw models set sglang/moonshotai/Kimi-K3.1-Pro
openclaw tui

From here you can issue high-level coding instructions and the Kimi K3.1 Pro-backed agent will plan, edit and check changes on your 32-GPU NVIDIA H100 cluster.

Running Kimi K3.1 Pro on One NVIDIA B300 Node

If you would rather serve Kimi K3.1 Pro from a single machine, the vLLM Kimi K3.1 Pro recipe gives the simplest working setup on NVIDIA Blackwell: one tensor-parallel group of eight GPUs, on one NVIDIA B300 node. Hyperstack offers it as the NVIDIA HGX B300 flavour n3-B300-SXM6x8, with 224 CPUs, 1,920 GB of RAM, a 1,000 GB root disk, 40,000 GB of ephemeral storage and 2.3 TB of HBM3e across its eight GPUs, so the whole checkpoint fits on one node and NVIDIA Blackwell runs the MXFP4 experts natively.

  • The flavour reference requires the "Ubuntu Server 24.04 LTS R595 CUDA 13.2 with Docker" image for this flavour, which suits the CUDA 13 build of the vLLM image.
  • The checkpoint goes on /ephemeral as on the NVIDIA H100 nodes, using Steps 5 to 7 on the one machine.
  • The firewall needs only the SSH and port 8000 rules, since there are no peers to reach.

Then start the recipe's command for one NVIDIA B300 node, with the cache mounted from the ephemeral disk:

Terminal, the NVIDIA B300 nodeSHELL
# One 8x NVIDIA B300 node: the vLLM recipe's command, cache on /ephemeral
docker run --gpus all \
  --privileged --ipc=host -p 8000:8000 \
  -v /ephemeral/hf:/root/.cache/huggingface \
  -e VLLM_ENGINE_READY_TIMEOUT_S=3600 \
  vllm/vllm-openai:kimi-k31 moonshotai/Kimi-K3.1-Pro \
  --trust-remote-code \
  --tensor-parallel-size 8 \
  --load-format fastsafetensors \
  --enable-auto-tool-choice \
  --tool-call-parser kimi_k3 \
  --reasoning-parser kimi_k3

The vLLM team reports that tensor parallel 8 on eight NVIDIA B300 GPUs holds about 2.6 million tokens of FP8 KV cache, and that decode context parallelism raises that to about 18.5 million when long sessions need more. One client-side difference from the SGLang endpoint: vLLM returns the thinking in a reasoning field rather than reasoning_content, and accepts either name on the way back in.

For production agentic serving beyond one node, the same recipe runs tensor parallel 8 across two trays of an NVIDIA GB300 NVL72, and a Secure Private Cloud keeps the whole deployment on dedicated infrastructure.

Kimi K3.1 Pro Deployment Cost

The four-node cluster bills as four 8x NVIDIA H100 NVLink virtual machines. At the GPU pricing rate of $2.80 per GPU per hour on demand, and from $1.82 per GPU per hour reserved, the cluster comes to:

Basis One node, per hour Cluster, per hour Cluster, per day Cluster, 730-hour month
On demand, $2.80 per GPU hour $22.40 $89.60 $2,150.40 $65,408.00
Reserved, from $1.82 per GPU hour $14.56 $58.24 $1,397.76 $42,515.20

Hyperstack bills per minute, with your balance updating as resources run, so an evaluation run costs only the minutes the nodes are active. The download and the start-up are part of that time, which is one more reason to start the four downloads in parallel.

Run Kimi K3.1 Pro on Hyperstack

Serve a 3T-Class Open Model on NVIDIA GPUs You Control

Four 8x NVIDIA H100 nodes, one SGLang command, and an endpoint that Claude Code, Kimi Code CLI and OpenClaw can drive.

32x NVIDIA H100SGLangOpenAI and Anthropic APIsPer-minute billing

Get started with Hyperstack in minutes.

FAQs

What is Kimi K3.1 Pro?

Kimi K3.1 Pro is Moonshot AI's open-weight, natively multimodal agentic model and its most capable 3T-class model to date. It uses a Mixture-of-Experts architecture with 2.8T total parameters and 104B activated, and is post-trained from Kimi K3 with large-scale joint reinforcement learning.

What is the difference between Kimi K3 and Kimi K3.1 Pro?

Kimi K3.1 Pro keeps Kimi K3's parameter count, layer count, 896-expert MoE and MXFP4 expert format. The main change is attention: the 24 full-attention Gated MLA layers become Gated DeepSeek Sparse Attention (DSA). Moonshot AI also reports gains in coding, 3D creation, financial research and factual accuracy.

What is Kimi K3.1 Pro's context window?

Kimi K3.1 Pro supports a native 1,048,576-token context window. How much a deployment can use at once depends on the KV cache left after the weights, which SGLang prints at start-up as max_total_num_tokens.

Can I turn off thinking in Kimi K3.1 Pro?

No. Kimi K3.1 Pro always reasons before answering. You control how much it reasons with the reasoning_effort field, which accepts "low", "high" and "max" (default "max"). For multi-turn conversations and tool calls, pass the full assistant message back, including reasoning_content.

What hardware is needed for Kimi K3.1 Pro?

Every one of the 896 experts has to stay resident in GPU memory, so total GPU memory is the constraint. This tutorial serves the 1.56 TB checkpoint on 32 NVIDIA H100 GPUs across four Hyperstack nodes with SGLang; one 8x NVIDIA B300 node with vLLM also holds it.

Which inference engines support Kimi K3.1 Pro?

Moonshot AI recommends vLLM, SGLang and TokenSpeed. vLLM and SGLang both use the kimi_k3 reasoning and tool-call parsers for Kimi K3.1 Pro.

Damanpreet Kaur Vohra

Damanpreet Kaur Vohra

calendar 5 Nov 2026

•

Read More

Create Your Account

From hardware to inference, one unified platform to scale your AI workloads.