HTTP, authentication and tokenization
Read in the API server process thatmstar-serve starts, whichever frontend serves HTTP.
| Variable | Default | Meaning |
|---|---|---|
MSTAR_API_KEY | unset | Enable bearer authentication. --api-key overrides this value. The Python SDK reads it too. Authentication and public probes |
MSTAR_MAX_BODY_MB | 128 | Maximum request body size. The Rust transcription route allows the larger of this limit and 513 MiB including multipart overhead (512 MiB file cap). Also supplies the default WebSocket message limit. Oversized HTTP requests receive 413. |
MSTAR_LOG_REQUESTS | unset | 1 logs each request’s lifecycle through mstar.requests at any log level. By default the conductor logs a periodic summary. |
MSTAR_ROOT_PATH | "" | Additional URL prefix for a reverse proxy that preserves the prefix. Bare paths still work. |
MSTAR_MAX_IMAGES_PER_REQUEST | 10 | Upper bound for n on an image-generation request. Out-of-range counts return 400 before submission. |
MSTAR_TOKENIZE_PARALLEL | 1 | Allow the tokenizer to set TOKENIZERS_PARALLELISM=true for a long prompt split across chunks. 0 preserves the caller’s setting. |
MSTAR_TOKENIZE_CHUNK_CHARS | 4096 | Split longer prompts for parallel encoding on supported models. 0 disables splitting. |
MSTAR_TOKENIZE_MAX_CHUNKS | 8 | Most chunks one prompt is cut into. |
MSTAR_SILERO_VAD_PATH | unset | Local Silero ONNX file for realtime server_vad. Otherwise use the file in the installed silero-vad package. A missing model prevents that session mode. |
MSTAR_SMART_TURN_PATH | unset | Local Pipecat Smart Turn v3 ONNX file for realtime semantic_vad. Otherwise use smart-turn-v3.2-cpu.onnx in the Hugging Face cache. Download it before use. |
Rust frontend and remote media
Read bymstar-server, the default HTTP frontend (see Installation).
| Variable | Default | Meaning |
|---|---|---|
MSTAR_SERVER_BIN | unset | Select a particular mstar-server binary. --rust-frontend-bin takes precedence. Binary lookup |
MSTAR_SERVER_HOST | --host (default 0.0.0.0) | Bind address for the Rust frontend. An exported value overrides the launcher’s --host. |
MSTAR_REQUEST_TIMEOUT_S | 600 | Per-request deadline in seconds, set by the launcher from --timeout. Zero expires immediately. Invalid or negative values use the default. |
MSTAR_MAX_CONCURRENT_REQUESTS | 512 | Maximum in-flight generation POSTs at the Rust frontend. Additional POSTs receive 503. The YAML’s max_concurrent_requests separately limits conductor admission. |
MSTAR_ALLOW_REMOTE | 0 | 1 lets requests name http(s) media URLs, fetched server-side by both frontends (at most 3 redirects and 30 s, no proxy). A host that resolves to a loopback, private, link-local, multicast or reserved address, cloud metadata included, is refused unless allowlisted. Failures are a 400. mstar-server trusts the bundled Mozilla roots, not the system store, so a private CA works only with --python-frontend. |
MSTAR_REMOTE_ALLOWED_HOSTS | unset | Comma-separated hosts and *.suffix patterns (*.example.com matches its subdomains, not example.com). When set, only these hosts are fetched, on every redirect, and they skip the address check. An entry matches only the canonical spelling of a host, so 127.1 or 0x7f000001 never match. |
MSTAR_REMOTE_MAX_BYTES | 67108864 (64 MiB) | Maximum downloaded media size, enforced on the declared length and received bytes. |
MSTAR_TOKENIZER | unset | Path to a tokenizer.json for frontend tokenization. Leave it unset: the API server’s bridge to mstar-server refuses to start while it is set, since the model side owns tokenization. |
Request media
The data worker validates these limits on startup. They apply across all files in one request. A request over a limit receives HTTP 400.| Variable | Default | Meaning |
|---|---|---|
MSTAR_MAX_IMAGE_PIXELS | 89478485 | Total decoded pixels allowed across the request’s images. Checked from file headers before decode. |
MSTAR_MAX_VIDEO_PIXELS | 1073741824 | Total decoded pixels allowed across video frames. Each decoded frame counts at least 64 × 64 pixels. Effective duration depends on frame sampling and resolution. |
MSTAR_MAX_MEDIA_FILES | 16 | Total image, video and audio attachments allowed per request. A model can impose a smaller limit. |
MSTAR_MAX_AUDIO_SECONDS | 3600 | Maximum total decoded audio duration per request, checked before and during decoding. |
Communication
| Variable | Default | Meaning |
|---|---|---|
MSTAR_WIRE_CODEC | msgpack | Control-message encoding across the deployment. Only msgpack is accepted. Any other value fails at startup. |
MSTAR_ZMQ_TRANSPORT | the constructor’s protocol | Override control-message transport with IPC or TCP. |
MSTAR_ZMQ_TCP_HOST | --host (default 0.0.0.0) | Host used for TCP control endpoints. |
MSTAR_ZMQ_TCP_BASE_PORT | 19000 | Base TCP control port. The API server uses the base, the conductor base+1 and worker ranks base+100+rank. |
MSTAR_DEPLOYMENT_TOKEN | random per launch | Namespaces the SHM tensor files and arena segments, so no two launches share names, also across containers that share /dev/shm (--ipc=host). The API server mints one per launch and the conductor and workers inherit it. Set it only when a launcher starts a deployment’s processes separately: the same value in all of them, and a new value per launch. |
MSTAR_KV_SHM_DIR | /dev/shm, or /tmp if unavailable | Base directory for host-staged KV snapshots when remote KV transfer uses SHM. Each deployment makes a private child directory and holds a lock file there; startup removes this user’s directories that no live process holds. Workers that share snapshots must see the same filesystem. On a filesystem whose flock is per node (GPFS), do not point deployments on different nodes at one directory. |
MSTAR_SHM_ARENA_SEGMENT_MB | 256, less on a small or crowded /dev/shm | Size of each committed arena segment. Check free space in /dev/shm before increasing it. |
MSTAR_SHM_ARENA_MAX_SEGMENTS | 32, fewer on a small or crowded /dev/shm | Segments per entity (each worker and the data worker has an arena), so node-wide use can reach segments x size x entities; check df -h /dev/shm. With neither this nor MSTAR_SHM_ARENA_SEGMENT_MB set, the API server splits the free space among the arenas and logs the sizes. An entity with under 16 MiB, or on XPU or the in-progress ROCm backend, sends tensors as files. Set by hand, startup fails if one entity’s ceiling exceeds /dev/shm. |
MSTAR_SHM_ARENA_FULL_TIMEOUT_S | 30 | Maximum wait for a full arena when spill is disabled. |
MSTAR_SHM_ARENA_SPILL | 1 | At the segment cap, 1 sends the tensor through a file. 0 waits for a slot and can time out. Waiting requires a separate thread to process acknowledgements. |
MSTAR_SHM_ARENA_SPILL_AFTER_S | 0 | Grace before spilling, for deployments where another thread frees slots concurrently. 0 spills at once. |
MSTAR_SHM_ARENA_PIN | 1 | Page-lock mapped segments to support asynchronous host/device copies. 0 uses pageable memory. |
MSTAR_SHM_ARENA_PIN_MAX_MB | 4096 | Pinned memory budget per process, including segments mapped from peers. Further segments stay pageable. |
MSTAR_SHM_ARENA_GATHER_MAX_BYTES | 16384 | Maximum size of an item eligible to share a gathered host-to-device copy with matching items. |
MSTAR_SHM_ARENA_GATHER_WORDS_MAX_BYTES | 512 | For 8-byte-aligned small items, maximum size for the word-indexed gather path. |
MSTAR_SHM_ARENA_SLOT_TTL_S | 0 | Seconds before an unacknowledged slot may be reclaimed. 0 disables expiry. Allow at least twice the request timeout when enabled. |
MSTAR_SHM_ARENA_STATS_INTERVAL_S | 60 | With --log-stats: how often each arena logs its occupancy and fragmentation. |
MC_TRANSFER_TIMEOUT | 30 | Mooncake base timeout in seconds (minimum 5). M* adds 1 ns per byte for TCP and RDMA tensor reads. |
NCCL_SOCKET_IFNAME | lo | NCCL socket interface. The conductor selects loopback for same-host workers unless the deployment sets this or NCCL_SOCKET_FAMILY. |
NCCL_GRAPH_REGISTER | 0 | Register NCCL buffers in CUDA graphs. Workers normally disable it because it affected captured Cosmos3 SP4 outputs. |
GLOO_SOCKET_IFNAME | lo | PyTorch’s variable for the Gloo groups. The conductor sets lo for its workers unless you set it. |
Models
Per-model knobs, read when the model or its submodule is built.| Variable | Default | Meaning |
|---|---|---|
MSTAR_VIT_BATCHING | 0 | Batch BAGEL vision inputs. Packed bf16 computation can change a greedy token. |
MSTAR_VIT_ACCELERATOR_GRAPH | 0 | Capture BAGEL vision block loops. Requires model graph capture. Tune the capture ladder with prefill_token_buckets. |
MSTAR_VIT_ACCELERATOR_GRAPH_BATCH_SIZES | 1,2,4 | BAGEL vision batch sizes to capture. With vision batching disabled, only batch size one can be captured. |
COSMOS3_DISABLE_ACCELERATOR_GRAPH | unset | Any nonempty value disables Cosmos3 denoise, prefill and reasoner capture. The model config can also disable capture. |
COSMOS3_DISABLE_PREFILL_ACCELERATOR_GRAPH | unset | Any nonempty value disables Cosmos3 prompt-prefill captures while retaining denoise and reasoner decode captures. |
COSMOS3_GEN_CAPTURE_RES | model_kwargs.gen_capture_image, else 192x320,480x832,720x1280 | Cosmos3: image denoise resolutions to capture, as comma-separated HxW. A tier above COSMOS3_GRAPH_MAX_LATENT_AREA is still skipped. |
COSMOS3_GEN_CAPTURE_BS | 1 | Cosmos3: denoise batch sizes captured per resolution (for example 1,4,8), so concurrent requests replay a padded graph instead of running eagerly. |
COSMOS3_GEN_CAPTURE_VIDEO | model_kwargs.gen_capture_video, else none | Cosmos3: video denoise tiers to capture, as comma-separated HxWxF (for example 480x832x29). |
COSMOS3_GRAPH_MAX_LATENT_AREA | model_kwargs.graph_max_latent_area (2000) | Maximum latent height × width eligible for captured Cosmos3 denoise. Larger tiers run eagerly. |
COSMOS3_PREFILL_CAPTURE_BS | 1 | Cosmos3: batch sizes of the prompt prefill captures. The config’s prefill_token_buckets sets their token buckets. |
COSMOS3_COMPILE_VAE | 1 | Cosmos3: 0, false, no or off stops torch.compile of the VAE decode, which otherwise traces once per new output shape. |
COSMOS3_PNG_COMPRESS | 0 | Cosmos3: zlib level of PNG image outputs. PNG is lossless at every level; a higher level trades encode time for size. |
COSMOS3_X264_PRESET | ultrafast | Cosmos3: libx264 preset for MP4 video outputs, encoded at CRF 18. |
MSTAR_FLEX_BACKEND | unset | Waypoint ring-cache attention implementation. Select TRITON or FLASH. Automatic selection uses flash-attn-4 when available on supported Torch, otherwise Triton. |
MSTAR_KOKORO_STEP_LOG | unset | Log Kokoro’s batch size, bucket, frame groups and time on every step. Timing synchronizes the device. |
MSTAR_OMNIVOICE_MODEL_PATH | unset | Load an architecture-compatible OmniVoice checkpoint from this directory. |
WAN22_VAE_DECODE_TILING | the Wan2.2 config’s vae_decode_tiling, auto | Wan2.2 VAE decode path. auto decodes untiled when free GPU memory is at least 1.3 times the estimated untiled peak for the output size, and tiled otherwise; tiled and untiled force one. The chosen path is logged per request. |
Compilation
| Variable | Default | Meaning |
|---|---|---|
MSTAR_COMPILE_LEVEL | 1 | Compile tuning level for captured forwards. mstar serve -O sets this variable. Compile levels |
MSTAR_REQUIRE_ACCELERATOR_GRAPHS | 0 | 1 fails startup on a failed graph-bucket capture. Otherwise the worker logs the failure and runs that bucket eagerly. |
MSTAR_RECOMPILE_LIMIT | 84 | Dynamo’s recompile limit, clamped to [8, 256]. Raise it if the logs show hit config.recompile_limit. |
MSTAR_KERNEL_TABLES | unset | Search directories for kernel tuning tables, separated by the platform path separator. Use the same tables on all ranks. |
MSTAR_COMPILE_DETERMINISTIC | config’s knobs: compile_deterministic, else 0 | Enable deterministic Inductor mode for Qwen3.5 decode captures. Its prefill, mixed and vision captures already use this mode. |
TRITON_PTXAS_BLACKWELL_PATH | torch’s ptxas, when needed | Triton’s variable: the ptxas it runs for sm_100 and newer. ptxas before 13.1.115 (Triton 3.7.1 bundles 13.1.80) miscompiles some integer floor divisions on sm_103. Unset, on a compute capability 10.x GPU where only torch’s ptxas is new enough, the conductor points its workers at torch/bin/ptxas and sets TORCH_COMPILE_CACHE_KEY_TAG, so the compile cache does not reuse the old ptxas’s kernels. An existing cache tag is preserved and suffixed with -ptxas-blackwell-<version>. |
TORCHINDUCTOR_CACHE_DIR | $XDG_CACHE_HOME/mstar/torchinductor (~/.cache/mstar/torchinductor) | Persistent compiled-graph and autotuning cache. Set a writable path before launch. Compile cache |
TRITON_CACHE_DIR | $TORCHINDUCTOR_CACHE_DIR/triton | Persistent Triton kernel cache. An explicit value overrides the default derived from the Inductor cache. |
Worker scheduling
| Variable | Default | Meaning |
|---|---|---|
MSTAR_TP_ASYNC_SCHED | config’s tp_async_sched, else 1 | Enable async scheduling for lockstep nodes with 1 or a comma-separated list of node names. Use 0 for synchronous scheduling. Values must agree across ranks. Leave MSTAR_ENGINE_STEP_SYNC=0 when enabled. |
MSTAR_ENGINE_STEP_SYNC | 0 | Wait for device outputs on every step. This reduces overlap and can help diagnose a full CUDA launch queue. |
MSTAR_PRE_PLAN_SPEC | config’s knobs: pre_plan, else 1 | Plan speculative attention on a dedicated thread. 0 plans inline on the GPU thread. |
MSTAR_NUM_SLOTS | 2 | Buffer slots rotated when a node double-buffers. Values below two become two for such nodes. |
MSTAR_STEP_THREADS | config’s knobs: step_threads, else threaded | threaded divides step work between GPU and plan threads. serial performs host work on the main thread. |
MSTAR_STEP_THREAD_CORE | config’s knobs: step_thread_core, else auto | Pins each worker’s main, GPU and plan threads, and the API server’s message thread and bridge, on CPUs of their own, so handoffs do not wait for a core to wake from deep idle. off pins nothing. always: three cores per worker, one for the API server. siblings: a worker’s threads on one core’s hardware threads. auto pins nothing and logs why. A number names the first worker’s core. Servers sharing /tmp take different cores. |
MSTAR_IDLE_HOLD | config’s knobs: idle_hold, else off | qos holds /dev/cpu_dma_latency open at 10 µs for the server’s lifetime. This host-wide setting can increase idle power use. If the device is unavailable, startup continues. |
MSTAR_DECODE_BUCKETS | 1,2,4,8,16,32,48,64,96,128 | Comma-separated decode batch sizes for compatible sampled-token decoders. Smaller ladders save graph memory. MSTAR_QWEN35_DECODE_BUCKETS overrides this setting for Qwen3.5. The Cosmos3 reasoner defaults to 1,2,4,8,16,24,32,48,64. |
MSTAR_LAZY_PUBLISH | 1 | Publish resource state only on frames or completions that require it. 0 builds publication data on every step. |
MSTAR_MAX_CONSECUTIVE_SPEC_STEPS | 1024 | Cap on back-to-back speculative steps before the leader yields to other ready work. 0 turns speculation off. A non-integer value is ignored with a warning. |
MSTAR_SPEC_PEEK_FOR_FAIRNESS | 1 | Yield the speculation chain only when another (node, walk) is ready right now; 0 uses the consecutive-step cap alone. |
MSTAR_LAUNCH_WAIT_MS | 5 | Milliseconds the speculative submitter waits off the GIL for the GPU thread to reach the launch. An unreadable, nan or inf value is ignored with a warning; a negative one becomes 0. |
MSTAR_KV_CHAIN_LAZY_STEPS | config’s knobs: kv_chain_lazy_steps, else 1 | Decode steps of sampled ids the KV manager holds back before it extends the requests’ prefix-cache keys, so it extends once per batch of steps. A page key then appears up to that many steps late, and a request that finishes in between may leave its last page unindexed. |
MSTAR_WORKSPACE_BUFFER_MB | 512 | Starting size of each FlashInfer attention workspace, per plan label and slot. A startup plan that asks for more grows it. Raise it when an eager step fails asking for more, since a captured graph holds the workspace’s address. A ragged resource that declares workspace_mb (LTX-2.5) starts there and ignores this. |
MSTAR_KV_PINNED_INDPTRS | config’s knobs: kv_pinned_indptrs, else 0 | The KV plan writes FlashInfer’s index arrays into page-locked host buffers, so the copies FlashInfer’s plan issues are asynchronous. Costs one CUDA event per plan. |
MSTAR_GC_GEN0_THRESHOLD | config’s knobs: gc_gen0_threshold, else 0 | Generation-0 garbage-collection threshold a worker sets after warmup; 0 keeps CPython’s 700. At high batch, 700 runs a collection almost every decode step and a full one every few hundred; a large value such as 50000 stops that, at the cost of holding that many young objects. |
MSTAR_RESIDENT_PLANNING | config’s knobs: resident_planning, else auto | auto runs a node’s captured decode steps off per-request tables on the device where the model and every resource of the node support it; the worker log says why a node stays on the host. off plans every step on the host. The tables are sized at startup from the largest capture batch and the KV pool’s max_seq_len. |
MSTAR_DEVICE_LOOPBACK | config’s knobs: device_loopback, else 1 | Keep the sampled loop-back token on device for supported decode walks with sampler graph buffers. 0 restores per-request tensor routing. |
MSTAR_INGRAPH_DECODE_ROPE | config’s knobs: ingraph_decode_rope, else 0 | Build rotary tables inside captured Qwen3.5 text prefill and mixed steps. Captured decode already does this. |
MSTAR_SAMPLER_INGRAPH_SCATTER | config’s knobs: sampler_ingraph_scatter, else 1 | Update offsets and sampled tokens inside compatible single-rank decode graphs. Capacity is set by MSTAR_SAMPLER_SLOTS. |
MSTAR_SAMPLER_SLOTS | config’s knobs: sampler_slots, else 4096 | Request slots for the captured sampler, with a floor at the node’s largest capture batch size. |
MSTAR_PY_SWITCH_INTERVAL_SEC | unset (Python’s default) | Python thread switch interval in worker processes, in seconds. |
MSTAR_DRAIN_TTL_S | 120 | Maximum time to await worker release of a finished request before reclaiming its conductor slot. |
MSTAR_RUST_SEND_TIMING | unset | 1 prints a breakdown of the Rust graph runtime’s send path every 500 calls. |
MSTAR_PHASE_TIMING | 0 | N > 0: every N iterations, log p50, p95 and mean per phase of the worker main loop (speculate, await_gpu, submit_spec, …). |
Set by the launcher
These values describe one launch. The launcher supplies them to its child processes.| Variable | Default | Meaning |
|---|---|---|
MSTAR_SHM_ARENA_PLAN | set by the API server | Per-arena segment size and count selected at startup. 0x0 selects file transfer. |
MSTAR_STEP_CORE_SET | set by the API server | Which core set the API server locked under step_thread_core, for the conductor and workers it starts. |
MSTAR_OPENAI_ADAPTER | set by the launcher | Selects the OpenAI adapter. Without it the adapter-backed routes return 404. |
MSTAR_SAMPLE_RATE | 24000 | Sample rate stamped on mstar-server’s WAV output; the launcher sets it to the model’s audio output rate. |
MSTAR_LIBSNDFILE | set by the launcher | Shared library the Rust frontend opens for MP3, FLAC and Opus. WAV and PCM are available without it. |
MSTAR_SERVED_MODELS | unset | The names a request’s model may carry, as JSON: the base model’s names and the LoRA adapters served at launch. |
MSTAR_TRANSCRIPTION | unset | What mstar-server’s /v1/audio/transcriptions needs from the served model, as JSON. |
MSTAR_OPENPI | unset | The deployment’s openpi policy, as JSON; unset serves no socket at /. |
MSTAR_WS_MAX_BYTES | the body limit | The largest WebSocket message mstar-server reads, in bytes: the config’s ws_max_message_mb. |
MSTAR_CLIENT_STREAMS | [] | The model’s client streams, as JSON: on /generate/ws a request to a model with any is a live call. |
MSTAR_REALTIME | unset | What mstar-server’s /v1/realtime runs with, as JSON. |
Tests and debugging
| Variable | Default | Meaning |
|---|---|---|
MSTAR_KV_DEBUG_ASSERTS | 0 | Check KV page ownership, reservations and commits on lifecycle changes, each verify step’s settled counts against its blocks and across the TP ranks, and that a selected read picks no entry twice. Use this in a diagnostic run. |
MSTAR_ASR_DATA | data/asr | test/asr GPU parity tests: the set benchmark.asr_data built. |
MSTAR_WHISPER_REPO | openai/whisper-large-v3-turbo | test/asr/test_whisper_parity.py: the Whisper checkpoint to compare. |
MSTAR_QWEN_ASR_REPO | Qwen/Qwen3-ASR-1.7B | test/asr/test_qwen3_asr_parity.py: the Qwen3-ASR checkpoint to compare. |
MSTAR_QWEN_ASR_REF | refs/Qwen3-ASR | test/asr/test_qwen3_asr_parity.py: a checkout of the qwen-asr SDK, which the reference transcripts come from. |
MSTAR_QWEN_ASR_REF_SITE | unset | test/asr/test_qwen3_asr_parity.py: a directory holding transformers 4.57, put first on the path of the subprocess that runs the SDK. Unset under transformers 5, the SDK comparison is skipped. |
MSTAR_SIM and the MSTAR_SIM_* variables belong to python -m mstar_sim, a Linux-only simulator in the checkout that runs M* on emulated GPUs for correctness tests. Its flags set them; mstar_sim/README.md describes the rest.