Additional Resources

NVIDIA Request Extensions (nvext)

View as Markdown

nvext is a top-level JSON object on the request body that provides NVIDIA-specific extensions to the OpenAI-compatible API. nvext fields are consumed by the Dynamo frontend, preprocessor, router, and backend workers to control routing, preprocessing, response metadata, scheduling, and engine-level priority.

Usage

Include nvext as a top-level field alongside standard OpenAI-compatible fields:

1{
2 "model": "my-model",
3 "messages": [{"role": "user", "content": "Hello"}],
4 "nvext": {
5 "greed_sampling": true,
6 "extra_fields": ["worker_id", "timing"],
7 "agent_hints": {
8 "latency_sensitivity": 5.0,
9 "osl": 1024,
10 "priority": 5
11 }
12 }
13}

Field Reference

FieldTypeDefaultConsumed ByDescription
greed_samplingboolNonePreprocessorForces greedy sampling regardless of other sampling parameters.
use_raw_promptboolNonePreprocessorBypasses the prompt template and passes the prompt directly to the tokenizer.
annotationsstring[]NonePreprocessorTriggers out-of-band information in the SSE stream via the event: field.
backend_instance_idu64NoneRouterRoutes the request to a specific backend instance.
token_datau32[]NonePreprocessorPre-tokenized prompt tokens. When provided with backend_instance_id, tokenization is skipped.
max_thinking_tokensu32NoneBackendMaximum thinking tokens allowed (passed through to backends).
extra_fieldsstring[]NoneResponse builderFields to include in the response nvext. Supported: "worker_id", "timing".
prefill_worker_idu64NoneRouterRoutes the request to a specific prefill worker (disaggregated serving).
decode_worker_idu64NoneRouterRoutes the request to a specific decode worker (disaggregated serving).
agent_hintsobjectNoneRouterPer-request hints for scheduling and load balancing. See Agent Hints.
cache_controlobjectNoneRouterKV cache pinning hint with TTL. See Cache Control.

Header Overrides

Routing fields can also be set via HTTP headers, which take priority over nvext values:

HeaderOverrides
x-worker-instance-idbackend_instance_id and decode_worker_id
x-prefill-instance-idprefill_worker_id

Agent Hints

The agent_hints sub-object carries per-request hints that the router uses for scheduling, load balancing, and KV cache optimization.

FieldTypeDefaultDescription
latency_sensitivityf64NonePriority scheduling hint in seconds. Shifts the request’s effective arrival time earlier in the router queue. Requires --router-queue-threshold.
oslu32NoneExpected output sequence length (tokens). Used for output block tracking and resource estimation.
speculative_prefillboolfalseWhen true, speculatively prefills the predicted next-turn prompt after the current turn completes to warm the KV cache.
priorityi32NoneBackend engine scheduling priority. Forwarded to the engine’s generate call for queue ordering, preemption, and KV cache eviction.

latency_sensitivity

When --router-queue-threshold is set and the queue is active, this value shifts the request’s effective arrival time earlier in the queue, giving it priority over requests with lower (or no) latency_sensitivity. A value of 5.0 means the request is treated as if it arrived 5 seconds earlier than it actually did. A recommended default is 1.2 for latency-sensitive agentic requests. Has no effect when queueing is disabled.

1{
2 "nvext": {
3 "agent_hints": {
4 "latency_sensitivity": 5.0
5 }
6 }
7}

osl

Expected output sequence length — the estimated number of output tokens the request will generate. The router uses this hint in two ways:

  1. Output block tracking: When --router-track-output-blocks is enabled, the router adds placeholder blocks during generation and applies fractional decay based on progress toward osl.
  2. Resource estimation: Helps the router estimate total resource requirements when making routing decisions.
1{
2 "nvext": {
3 "agent_hints": {
4 "osl": 1024
5 }
6 }
7}

speculative_prefill

When set to true, the system speculatively prefills the predicted next-turn prompt after the current assistant turn completes. This is designed for multi-turn agentic workloads where the next request’s prefix is predictable.

How it works:

  1. As the assistant response streams, the system accumulates the full response text.
  2. Once the response finishes, a background task constructs the next-turn prompt by appending the assistant response to the conversation history (with thinking content stripped for non-last turns).
  3. The constructed prompt is tokenized and sent as a max_tokens=1 request to warm the KV cache on a worker.
  4. When the actual next request arrives, it benefits from the already-warm KV cache, reducing TTFT.
1{
2 "nvext": {
3 "agent_hints": {
4 "speculative_prefill": true
5 }
6 }
7}

priority

Backend engine scheduling priority forwarded to the engine’s generate call. Influences queue ordering, KV cache eviction under memory pressure, and preemption of running requests.

The semantics of the priority value differ between backends:

  • SGLang: By default, larger values = higher priority. This can be inverted with --schedule-low-priority-values-first to match vLLM’s convention. Requires --enable-priority-scheduling on the engine.
  • vLLM: Smaller values = higher priority. A request with priority: 0 is scheduled before priority: 10. Ties are broken by arrival time. Requires --scheduling-policy priority on the engine.

When omitted, SGLang defaults to None (engine default); vLLM defaults to 0. TensorRT-LLM does not currently support per-request priority.

1{
2 "nvext": {
3 "agent_hints": {
4 "priority": 5
5 }
6 }
7}

Cache Control

Cache control is experimental and available on development branches only. The API may change.

The cache_control object enables explicit KV cache pinning with a TTL. When set, the router fires a pin_prefix call to the backend worker after generation completes, protecting the conversation’s KV cache from eviction for the specified duration.

FieldTypeDefaultDescription
cache_control.typestringCache control type. Currently only "ephemeral" is supported.
cache_control.ttlstring"300"TTL as integer seconds ("600") or shorthand ("5m", "1h"). Clamped to [300, 3600] seconds.
1{
2 "nvext": {
3 "cache_control": {
4 "type": "ephemeral",
5 "ttl": "1h"
6 }
7 }
8}

Requires --enable-cache-control and --router-mode=kv on the frontend. See SGLang for Agentic Workloads for full setup and usage details.

Response Extensions

When the client requests response metadata via extra_fields, the response includes an nvext object with the requested fields:

FieldRequested ViaDescription
worker_idextra_fields: ["worker_id"]Prefill/decode worker IDs and data parallel ranks that processed the request.
timingextra_fields: ["timing"]Per-request timing information (TTFT, ITL, queue time, etc.).
token_idsAutomatic (GAIE Stage 1)Tokenized prompt for reuse in Stage 2 query-only mode.

Example response nvext

1{
2 "nvext": {
3 "worker_id": {
4 "prefill_worker_id": 1,
5 "prefill_dp_rank": 0,
6 "decode_worker_id": 2,
7 "decode_dp_rank": 0
8 },
9 "timing": {
10 "ttft_ms": 45.2,
11 "itl_ms": 12.1
12 }
13 }
14}

See Also

DocumentDescription
Frontend GuideKServe gRPC configuration and integration
Router GuideFull router configuration and CLI arguments
SGLang for Agentic WorkloadsSGLang engine flags for priority scheduling, eviction policies, and cache pinning