Self-Hosting MiniMax M3.1 Flash With vLLM and SGLang
A step-by-step guide to running MiniMax M3.1 Flash locally: weight download, vLLM and SGLang server startup, OpenAI-compatible endpoints, prompt caching and effort-level tuning.
Why Self-Host This Particular Model
MiniMax M3.1 Flash is an unusual candidate for a self-hosting guide because it arrived with weights, an API and day-zero serving support at the same time. The open checkpoint is MiniMaxAI/MiniMax-M3.1-Flash on Hugging Face, ungated and MXFP8-quantised under the MiniMax Community license (source: AICoder release coverage, October 2026). The same coverage lists day-zero support from Together AI, from Inferact on vLLM, and from LightSeek's TokenSpeed (source: AICoder release coverage, October 2026).
The model is a native multimodal mixture-of-experts with roughly 428 billion total parameters and about 23 billion active per token, a one-million-token context window, and text, image and video input. Thinking cannot be disabled; the effort parameter offers five levels from low through medium, high, xhigh and max, with max as the default (source: ModelScope model card for MiniMax-M3.1-Flash).
Step 1 — Get the Weights
The fastest path on a machine without Hugging Face access is ModelScope. The vLLM quickstart documents the exact switch: set the environment variable VLLM_USE_MODELSCOPE=True before initialising the engine, and downloads resolve from ModelScope instead (source: vLLM Quickstart documentation). The model page on ModelScope is the corresponding landing point for the weights (source: ModelScope model card for MiniMax-M3.1-Flash).
Budget disk accordingly. A 428B-parameter checkpoint distributed in MXFP8 is a large download, and anyone planning to serve more than one concurrent replica needs to think about that before the first pull rather than after.
Step 2 — Install a Serving Engine
For vLLM, the documented installation path on NVIDIA GPUs uses uv to create an isolated environment, then installs the package and pre-compiles kernels. The published sequence is: create a Python 3.12 environment with uv venv --python 3.12 --seed, activate it with source .venv/bin/activate, install the package with uv pip install vllm --torch-backend=auto, then run vllm download-kernels to fetch the pre-compiled kernels (source: vLLM Quickstart documentation).
The vllm download-kernels step matters more than it looks: it installs pre-compiled kernels that vLLM would otherwise download and compile at startup, which "can add several minutes on Hopper and newer GPUs" (source: vLLM Quickstart documentation). The same documentation notes Python 3.11 to 3.14 on Linux as the supported range, with macOS support through vLLM-Metal for Apple Silicon.
SGLang is the alternative engine and the better fit for very long contexts. Its own installation command is equally short: uv pip install sglang sglang-kernel with the matching extra index URL for the target CUDA build (source: SGLang project documentation).
Both engines speak OpenAI-compatible endpoints, so the client code does not change when the backend does. SGLang's supported hardware spans NVIDIA GPUs, AMD GPUs, Google TPU, CPU servers, Ascend NPUs and XPU, and its documented feature set includes disaggregated prefill/decode, speculative decoding, parallelisms, a zero-overhead scheduler and optimised GPU kernels (source: SGLang project documentation).
Step 3 — Launch the Server
With vLLM, serving is a single command. The server starts at http://localhost:8000 by default, the address is changed with --host and --port, and it hosts one model at a time while implementing list-models, create-chat-completion and create-completion endpoints (source: vLLM Quickstart documentation):
The concrete invocation is vllm serve MiniMaxAI/MiniMax-M3.1-Flash, optionally followed by the serving flags discussed below (source: vLLM Quickstart documentation).
Two operational flags deserve attention. Passing --generation-config vllm stops the server from applying the model's own generation_config.json defaults, which otherwise override sampling parameters (source: vLLM Quickstart documentation). Setting --api-key, or the VLLM_API_KEY environment variable, enables header-based key checks — and multiple keys can be passed, which supports rotation without a restart.
For SGLang, the launch command follows the same shape, pointing at the model path and the standard OpenAI-compatible port.
Step 4 — Wire Up the Client
Because both servers implement the OpenAI protocol, the client is the familiar one. With vLLM, the documented pattern sets the key to a placeholder and points the base URL at the local server:
The documented pattern sets the API key to a placeholder such as EMPTY and points the base URL at http://localhost:8000/v1, then creates a standard OpenAI client instance (source: vLLM Quickstart documentation).
A curl request against the chat completions endpoint works the same way as any OpenAI-compatible server (source: vLLM Quickstart documentation). For offline batch work, vLLM exposes LLM and SamplingParams directly, with llm.generate for raw prompts and llm.chat for message lists that need the chat template applied (source: vLLM Quickstart documentation).
Step 5 — Tune Cost and Latency
The hosted API prices cached input at US$0.015 per million tokens against US$0.15 for fresh input and US$0.60 for output (source: MiniMax Research blog, October 19, 2026). A self-hosted stack should reproduce that shape: keep a stable system prompt and tool definitions in front of the conversation so the prefix cache can hit, because a long-lived agent loop re-sends the same prefix on every turn. The SGLang release notes describe exactly this mechanism — the unified radix tree, where a shared prefix on DeepSeek-V4-Flash with a common system prompt raises token hit rate from 43.8 percent (source: SGLang project documentation).
The second lever is the effort dial. Because max is the default and thinking cannot be turned off, a self-hosted deployment that simply forwards requests inherits the most expensive configuration. For classification, extraction and routing tasks, dropping to low or medium is the single largest cost reduction available, and it changes latency far more than model size does. Recent SGLang releases push in the same direction: version 0.5.21 added the ability for prefill and decode instances to switch roles on the fly without a restart, and version 0.5.22 reports up to 27 percent more throughput and half the p95 time-to-first-token on long-prompt workloads with disaggregated serving (source: SGLang project documentation).
Step 6 — Decide Hosted or Self-Hosted
The hosted API remains the lower-friction path for most teams, and the model list and pricing pages are the reference points for what the platform exposes (source: MiniMax API documentation). Self-hosting earns its place when three conditions hold at once: request volume is high enough that per-token pricing dominates the bill, the workload carries data that should not leave the network, and the team can absorb the operational cost of running a large MoE checkpoint. If only one of those is true, the hosted endpoint is usually the better trade.