Native Chat Stage#
Understanding models that native SGLang serves through its OpenAI chat API, such as the Cosmos3 Reasoner, run in Omni as a native chat stage. The stage starts a native SGLang Engine and its chat service in the stage process and sends every Omni request through them, so the chat template, multimodal processing, sampling and KV cache are those of native SGLang. --text-only selects the Cosmos3 Reasoner.
sgl-omni serve --model-path /path/to/Cosmos3-Nano --text-only --port 8000
curl http://127.0.0.1:8000/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"messages": [{"role": "user", "content": [{"type": "text", "text": "What is in this image?"}, {"type": "image_url", "image_url": {"url": "https://example.com/scene.png"}}]}], "max_tokens": 128}'
Requests#
Messages carry text,
image_url,video_urlandaudio_urlcontent parts. The top levelimagesandvideoslists are added to the last user message. Top levelaudiosand the video processing options such asvideo_fpsare refused with 400, since native SGLang reads media only from content parts.Sampling fields that a request leaves out come from the checkpoint generation config, as with
sglang serve. For Cosmos3 Nano that is temperature 0.7, top_p 0.8 and top_k 20.Other native chat request fields go under the stage name in
stage_params, for example{"stage_params": {"reasoner": {"ignore_eos": true}}}. Native SGLang validates them, and an invalid one returns 400.The stage returns one text completion per request, so
stage_paramsthat ask for native tools,nabove 1 or log probabilities on a stream are refused with 400. Runsglang serveon the same checkpoint when you need native tool calls, a reasoning parser, several choices or streamed log probabilities.
Media policy#
--allowed-local-media-path and --allowed-media-domain apply as on the other chat routes. File URLs need --allowed-local-media-path and must resolve inside it, and local paths are confined to it once it is set. While --allowed-media-domain is set, the stage fetches remote media itself, checking the domain on every redirect, keeps native SGLang’s media_url_max_file_size_mb limit, and hands native SGLang a temporary file that it removes when the request ends. A refused reference returns 400 before native SGLang loads anything. A fetch that fails returns the status the other chat routes return: 400 when the media host answers 404, 500 when it fails, times out or sends more than the limit.
Sizing and admission#
Native SGLang derives the context length from the checkpoint and the memory fraction from the GPU, as
sglang servedoes.stages.reasoner.gpu_memory_fractionturns the placement budget into the memory fraction, and--mem-fraction-staticor any native server argument understages.reasoner.engine, for example--reasoner.engine.context_length 32768, overrides native SGLang. An explicit memory fraction wins over the placement budget with a warning.Admission is native SGLang’s by default: up to its
max_running_requestsrun at once and further requests wait in its queue, as withsglang serve. Setstages.reasoner.engine.max_running_requestsandstages.reasoner.engine.max_queued_requeststo bound it. Omni then answers 503 to requests beyond their sum before any media is loaded.Before the stage reports ready it sends the same warmup request as
sglang serve.stages.reasoner.engine.skip_server_warmupturns it off.
Lifecycle#
A cancelled request or a closed stream aborts the native request at once.
Native SGLang processes exit with the stage process. If a native scheduler or detokenizer process fails, native SGLang stops the stage and the server stops.