For the complete documentation index, see llms.txt. This page is also available as Markdown.

Inference Server Environment Variables

Environment variables that control a self-hosted Roboflow Inference server - execution providers, caching, Workflows, Roboflow API retries, telemetry, HTTPS, and security.

Inference server behavior is controlled by a set of environment variables. Every variable is defined in inference/core/env.py; the ones below are the variables that need more explanation.

Pass them to the container with -e (see Docker configuration options for the most commonly changed settings):

docker run -it --rm -e ENV_VAR_NAME=env_var_value -p 127.0.0.1:9001:9001 roboflow/roboflow-inference-server-cpu:latest

These variables configure the Inference server. The Roboflow CLI and Python SDK read a different, smaller set of variables (ROBOFLOW_API_KEY, ROBOFLOW_CONFIG_DIR, and others): see Environment Variables in the Reference section.

For the source and release scope of recent security settings, see Security Configuration Migration.

Execution and models

Variable
Description
Default

ONNXRUNTIME_EXECUTION_PROVIDERS

List of execution providers in priority order. A warning is displayed if a provider is not supported on your platform.

See env.py

RUNS_ON_JETSON

Whether Inference runs on a Jetson device. Set to True in all Docker builds for the Jetson architecture.

False

MODEL_VALIDATION_DISABLED

Makes model loading faster by skipping the trial inference.

False

SAM2_MAX_EMBEDDING_CACHE_SIZE

Number of SAM2 embeddings held in GPU memory. Each embedding takes 16777216 bytes.

100

SAM2_MAX_LOGITS_CACHE_SIZE

Number of SAM2 logits held in CPU memory. Each logit takes 262144 bytes.

1000

DISABLE_SAM2_LOGITS_CACHE

Disables caching of SAM2 logits. Useful for debugging or to minimize memory usage, at the cost of slower repeated similar requests.

False

inference-models backend

Variable
Description
Default

USE_INFERENCE_MODELS

Selects the inference-models backend; images may override it.

False in the core library

ALLOW_INFERENCE_MODELS_DIRECTLY_ACCESS_LOCAL_PACKAGES

Allows local model packages, including their code. Incompatible with online model authorization. See Model Package Security.

False

ALLOW_INFERENCE_MODELS_UNTRUSTED_PACKAGES

Allows downloaded packages classified as untrusted. Separate from direct local loading; see image migration defaults.

False in the core library; image-dependent

MAX_INFERENCE_MODELS_CACHE_SIZE_MB

Enables the inference-models cache watchdog. When set above 0, the watchdog prunes model artifacts (oldest and biggest first) to prevent the system running out of disk space over time. Only applies when USE_INFERENCE_MODELS=True.

-1

INFERENCE_MODELS_CACHE_WATCHDOG_INTERVAL_MINUTES

Frequency of inference-models cache watchdog cycles. The minimum is 15 minutes.

60

ENABLE_CUDA_MEMORY_RECLAMATION_WATCHDOG

Enables a background daemon that periodically returns cached-but-unused CUDA memory to the driver via torch.cuda.empty_cache(). PyTorch's caching allocator retains freed device blocks in its own pool and never releases them on its own, so on a long-running server the high-water mark of concurrent or batched inference is sticky and reserved VRAM only grows. This watchdog reclaims that slack on a fixed interval; live allocations are untouched. It does not prevent an OOM caused by a genuinely oversubscribed concurrent peak. Only meaningful with USE_INFERENCE_MODELS=True on CUDA.

False

CUDA_MEMORY_RECLAMATION_WATCHDOG_INTERVAL_SECONDS

Interval between reclamation cycles of the CUDA memory watchdog. The minimum is 5 seconds (lower values are clamped up). Only applies when ENABLE_CUDA_MEMORY_RECLAMATION_WATCHDOG=True.

300

Workflows and video

Variable
Description
Default

ENABLE_WORKFLOWS_PROFILING

Allows the server to return Workflows profiler traces to the client.

False

WORKFLOWS_PROFILER_BUFFER_SIZE

Size of the profiler buffer: the number of consecutive Workflows Execution Engine run(...) invocations traced in the buffer.

64

WORKFLOWS_DEFINITION_CACHE_EXPIRY

Number of seconds to cache Workflow definitions returned by get_workflow_specification(...).

900 (15 minutes)

ENABLE_STREAM_API

Enables the integrated video management API. The standard CPU, GPU, and TensorRT images set this to True, as do the JetPack 5.1.1 and 6.2.0 images; slim images and the JetPack 6.0.0 and 7.1.0 images do not. Check your pinned image.

False in the core library; True in the images listed

STREAM_API_PRELOADED_PROCESSES

Target number of warm idle video workers, which reduces worker start time on GPU. Images may override it.

0 in the core library

STREAM_MANAGER_MAX_ACTIVE_PIPELINES

Cap on managed pipeline processes, including idle workers. Requests that need a new worker beyond the cap are rejected. Raised to STREAM_API_PRELOADED_PROCESSES if that is higher. See Video Configuration.

8

STREAM_MANAGER_MAX_RAM_MB

Total RAM budget for the stream manager and its workers. New workers are refused when the projected total would exceed it. This is an estimate-based guard, not a hard memory limit.

Not set (no RAM ceiling)

ALLOW_UNSAFE_GSTREAMER_PIPELINES

Bypasses media-reference validation for trusted raw pipelines in the pending runtime-hardening build. See migration scope.

False in that build

ALLOW_CUSTOM_PYTHON_EXECUTION_IN_WORKFLOWS

Allows Custom Python to execute locally. Does not disable Modal execution.

True

WORKFLOWS_CUSTOM_PYTHON_EXECUTION_MODE

Selects local or Modal Custom Python execution. See offline migration behavior.

local

ALLOW_WEBHOOK_WORKFLOWS_SINK_TO_NON_GLOBAL_ADDRESSES

Allows the Webhook Sink to connect to loopback, private, link-local, and other non-global addresses. Set to False when untrusted callers can choose webhook destinations. Redirects and HTTP(S) proxies are rejected for either value. See server security.

True

GPU tensor pipeline

On a capable NVIDIA GPU, Workflows can keep image data on the GPU from video decode through model inference to output, instead of moving it through the CPU. This lowers latency for GPU-heavy video Workflows. It needs USE_INFERENCE_MODELS=True, a GPU with compute capability 7.5 or higher (ex: T4, RTX 20-series and newer; not V100), and the onnx.gpu or Jetson Docker image. Without a matching GPU and image, Inference falls back to normal CPU-based execution.

Variable
Description
Default

ENABLE_TENSOR_DATA_REPRESENTATION

Turns on the GPU tensor pipeline: GPU-resident Workflows execution and hardware-accelerated (NVDEC) video decoding.

False

WORKFLOWS_IMAGE_TENSOR_DEVICE

Torch device Workflow tensors are placed on when the tensor pipeline is enabled.

cuda if available, else cpu

VIDEO_SOURCE_BUFFER_SIZE

Number of decoded frames buffered per video source.

8 when the tensor pipeline is enabled, 64 otherwise

VIDEO_SOURCE_ADAPTIVE_BACKPRESSURE

Drops buffered frames based on buffer state instead of estimated frame rate.

Matches ENABLE_TENSOR_DATA_REPRESENTATION

WORKFLOWS_ENFORCE_DENSE_INSTANCE_MASKS

Returns dense instance segmentation masks instead of RLE-encoded ones from tensor pipeline models.

False

WORKFLOWS_SAM_VIDEO_MASK_REPRESENTATION

Mask format (rle or dense) used by SAM video tracking blocks in the tensor pipeline.

rle

DISABLE_GSTREAMER_VIDEO_SOURCES

Disables GStreamer-based video sources, forcing standard CPU decoding.

False

Roboflow API connectivity

Variable
Description
Default

TRANSIENT_ROBOFLOW_API_ERRORS

Comma-separated list of HTTP codes from the Roboflow API that should be retried (GET endpoints only).

Not set

TRANSIENT_ROBOFLOW_API_ERRORS_RETRIES

Number of times transient errors (connection errors and transient HTTP codes) are retried (GET endpoints only).

3

TRANSIENT_ROBOFLOW_API_ERRORS_RETRY_INTERVAL

Delay between retries of transient Roboflow API errors (GET endpoints only).

3

RETRY_CONNECTION_ERRORS_TO_ROBOFLOW_API

Whether connection errors to the Roboflow API should be retried (GET endpoints only).

False

ROBOFLOW_API_REQUEST_TIMEOUT

Timeout in seconds (integer) for requests to the Roboflow API.

Not set

API_PROXY_BASE_URL

Base URL used for Roboflow API proxy requests to apiproxy/* endpoints. Set this to a direct heavy-API Cloud Run service root to bypass Firebase Hosting timeouts for long-running third-party proxy calls.

Value of API_BASE_URL

DISABLE_VERSION_CHECK

Disables the Inference version check that runs in a background thread. Force-set to True (overriding an explicit False) when SECURE_GATEWAY is configured, because api.github.com is unreachable behind the gateway.

False

SECURE_GATEWAY

Address of a Roboflow Secure Gateway for air-gapped deployments (legacy alias: LICENSE_SERVER). Routes Roboflow API and model download traffic through the gateway proxy, force-disables the version check, and falls back to local Workflow step execution when remote plus hosted is configured. See Docker configuration options.

Not set

Monitoring and telemetry

Variable
Description
Default

ENABLE_PROMETHEUS

Enables the Prometheus /metrics endpoint. See Telemetry.

True for the Docker Hub images

DOCKER_SOCKET_PATH

Path to the Docker daemon socket mounted into the container. When provided, enables polling Docker container stats from the daemon socket. See Telemetry.

Not set

METRICS_ENABLED

Controls Roboflow Model Monitoring.

True

MODEL_MONITORING_CACHE_BACKEND

Cache backend for model-monitoring pingback data. Use default to follow the normal cache selection (Redis when REDIS_HOST is configured, otherwise memory), or memory to force process-local buffering and keep Redis off the inference hot path.

default

HTTPS

Variable
Description
Default

ENABLE_HTTPS

Toggles HTTPS for the Inference server. When True, the server reads SSL_CERTFILE and SSL_KEYFILE and serves traffic over TLS. See Serving Inference over HTTPS.

False

SSL_CERTFILE

Path to a PEM-encoded TLS certificate served when ENABLE_HTTPS=True.

/etc/inference/certs/server.crt

SSL_KEYFILE

Path to the PEM-encoded TLS private key paired with SSL_CERTFILE.

/etc/inference/certs/server.key

SSL_KEYFILE_PASSWORD

Encrypted-key passphrase for Uvicorn. Unsupported by the parallel Gunicorn launcher.

Not set

SSL_CA_CERTS

Client CA bundle for HTTPS. See mTLS enforcement and release scope.

Not set

Authentication and input security

Variable
Description
Default

WORKSPACES_WHITELISTED_FOR_LOCAL_DEPLOYMENT

Allowed Workspace slugs for inference, Workflow, and integrated pipeline requests. See authentication and exemptions.

Not set

MODELS_CACHE_AUTH_ENABLED

Checks a caller's access to a Roboflow model online. Rejects direct local package loading in that mode.

False

ALLOW_OFFLINE_MODEL_CACHE_AUTH_BYPASS

Explicit authorization bypass required when offline mode and model cache authorization are both enabled. For trusted single-tenant deployments only.

False

Variables that control custom Python execution and URL image fetching (ALLOW_CUSTOM_PYTHON_EXECUTION_IN_WORKFLOWS, ALLOW_URL_INPUT, ALLOW_URL_TO_NON_GLOBAL_ADDRESSES, VALIDATE_IMAGE_URL_REDIRECTS, and others) are documented in Securing a Self-Hosted Server and Accepted Input Formats.

Last updated

Was this helpful?