SGLang Model Gateway - Rust-based inference gateway Usage: smg launch [OPTIONS] Launch router (short command) amg launch [OPTIONS] Launch router (alternative) sglang-router [OPTIONS] Launch router (full name) Examples: # Regular mode smg launch --worker-urls http://worker1:8000 http://worker2:8000 # PD disaggregated mode smg launch --pd-disaggregation \ --prefill http://127.0.0.1:30001 9001 \ --prefill http://127.0.0.2:30002 9002 \ --decode http://127.0.0.3:30003 \ --decode http://127.0.0.4:30004 \ --policy cache_aware # With different policies smg launch --pd-disaggregation \ --prefill http://127.0.0.1:30001 9001 \ --prefill http://127.0.0.2:30002 \ --decode http://127.0.0.3:30003 \ --decode http://127.0.0.4:30004 \ --prefill-policy cache_aware --decode-policy power_of_two Usage: sgl-model-gateway [OPTIONS] sgl-model-gateway Commands: launch Launch the router (same as running without subcommand) [alias: start] help Print this message or the help of the given subcommand(s) Options: --enable-mesh --mesh-server-name --mesh-host [default: 0.0.0.0] --mesh-port [default: 39527] --mesh-peer-urls [...] -h, --help Print help (see a summary with '-h') Worker Configuration: --host Host address to bind the router server [default: 0.0.0.0] --port Port number to bind the router server [default: 30000] --worker-urls [...] List of worker URLs (supports IPv4 and IPv6) Routing Policy: --policy Load balancing policy to use [default: cache_aware] [possible values: random, round_robin, cache_aware, power_of_two, prefix_hash, manual] --cache-threshold Cache threshold (0.0-1.0) for cache-aware routing [default: 0.3] --balance-abs-threshold Absolute threshold for load balancing trigger [default: 64] --balance-rel-threshold Relative threshold for load balancing trigger [default: 1.5] --eviction-interval Interval in seconds between cache eviction operations [default: 120] --max-tree-size Maximum size of the approximation tree for cache-aware routing [default: 67108864] --max-idle-secs Maximum idle time in seconds before eviction (for manual policy) [default: 14400] --assignment-mode Assignment mode for manual policy when encountering a new routing key [default: random] [possible values: random, min_load, min_group] --prefix-token-count Number of prefix tokens to use for prefix_hash policy [default: 256] --prefix-hash-load-factor Load factor threshold for prefix_hash policy [default: 1.25] --dp-aware Enable data parallelism aware scheduling --enable-igw Enable IGW (Inference Gateway) mode for multi-model support PD Disaggregation: --pd-disaggregation Enable PD (Prefill-Decode) disaggregated mode --decode Decode server URLs (can be specified multiple times) --prefill-policy Specific policy for prefill nodes in PD mode [possible values: random, round_robin, cache_aware, power_of_two, prefix_hash, manual] --decode-policy Specific policy for decode nodes in PD mode [possible values: random, round_robin, cache_aware, power_of_two, prefix_hash, manual] --worker-startup-timeout-secs Timeout in seconds for worker startup and registration [default: 1800] --worker-startup-check-interval Interval in seconds between worker startup checks [default: 30] Service Discovery (Kubernetes): --service-discovery Enable Kubernetes service discovery --selector [...] Label selector for Kubernetes service discovery (format: key=value) --service-discovery-port Port to use for discovered worker pods [default: 80] --service-discovery-namespace Kubernetes namespace to watch for pods --prefill-selector [...] Label selector for prefill server pods in PD mode --decode-selector [...] Label selector for decode server pods in PD mode Logging: --log-dir Directory to store log files --log-level Set the logging level [default: info] [possible values: debug, info, warn, error] --json-log Enable structured JSON log output instead of plain text Prometheus Metrics: --prometheus-port Port to expose Prometheus metrics [default: 29000] --prometheus-host Host address to bind the Prometheus metrics server [default: 0.0.0.0] --prometheus-duration-buckets [...] Custom buckets for Prometheus duration metrics Request Handling: --request-id-headers [...] Custom HTTP headers to check for request IDs --request-timeout-secs Request timeout in seconds [default: 1800] --shutdown-grace-period-secs Grace period in seconds to wait for in-flight requests during shutdown [default: 180] --max-payload-size Maximum payload size in bytes [default: 536870912] --cors-allowed-origins [...] CORS allowed origins HTTP Client: --pool-idle-timeout-secs Idle timeout in seconds for pooled upstream HTTP connections [env: SMG_POOL_IDLE_TIMEOUT_SECS=] [default: 50] --connect-timeout-secs Timeout in seconds for new upstream HTTP connections [env: SMG_CONNECT_TIMEOUT_SECS=] [default: 10] --pool-max-idle-per-host Maximum idle upstream HTTP connections to keep per host [env: SMG_POOL_MAX_IDLE_PER_HOST=] [default: 500] --tcp-keepalive-secs TCP keepalive idle time in seconds for upstream HTTP connections [env: SMG_TCP_KEEPALIVE_SECS=] [default: 30] Rate Limiting: --max-concurrent-requests Maximum concurrent requests (-1 to disable) [default: -1] --queue-size Queue size for pending requests when limit reached [default: 100] --queue-timeout-secs Maximum time in seconds a request can wait in queue [default: 60] --rate-limit-tokens-per-second Token bucket refill rate (tokens per second) Retry Configuration: --retry-max-retries Maximum number of retry attempts [default: 5] --retry-initial-backoff-ms Initial backoff delay in milliseconds [default: 50] --retry-max-backoff-ms Maximum backoff delay in milliseconds [default: 30000] --retry-backoff-multiplier Multiplier for exponential backoff [default: 1.5] --retry-jitter-factor Jitter factor (0.0-1.0) for retry delays [default: 0.2] --disable-retries Disable automatic retries Circuit Breaker: --cb-failure-threshold Number of failures before circuit opens [default: 10] --cb-success-threshold Successes needed in half-open state to close [default: 3] --cb-timeout-duration-secs Seconds before attempting to close open circuit [default: 60] --cb-window-duration-secs Sliding window duration for tracking failures [default: 120] --disable-circuit-breaker Disable circuit breaker Health Checks: --health-failure-threshold Failures before marking worker unhealthy [default: 3] --health-success-threshold Successes before marking worker healthy [default: 2] --health-check-timeout-secs Timeout in seconds for health check requests [default: 5] --health-check-interval-secs Interval in seconds between health checks [default: 60] --health-check-endpoint Health check endpoint path [default: /health] --disable-health-check Disable all worker health checks at startup Tokenizer: --model-path Model path for loading tokenizer (HuggingFace ID or local path) --tokenizer-path Explicit tokenizer path (overrides model_path) --chat-template Chat template path --tokenizer-cache-enable-l0 Enable L0 (exact match) tokenizer cache --tokenizer-cache-l0-max-entries Maximum entries in L0 tokenizer cache [default: 10000] --tokenizer-cache-enable-l1 Enable L1 (prefix matching) tokenizer cache --tokenizer-cache-l1-max-memory Maximum memory for L1 tokenizer cache in bytes [default: 52428800] Parsers: --reasoning-parser Parser for reasoning models (e.g., deepseek-r1, qwen3) --tool-call-parser Parser for tool-call interactions --mcp-config-path Path to MCP server configuration file Backend: --backend Backend runtime to use [default: sglang] [possible values: sglang, vllm, trtllm, openai, anthropic] --history-backend History storage backend [default: memory] [possible values: memory, none, oracle, postgres, redis] --enable-wasm Enable WebAssembly support Oracle Database: --oracle-wallet-path Path to Oracle ATP wallet directory [env: ATP_WALLET_PATH=] --oracle-tns-alias Oracle TNS alias from tnsnames.ora [env: ATP_TNS_ALIAS=] --oracle-dsn Oracle connection descriptor/DSN [env: ATP_DSN=] --oracle-user Oracle database username [env: ATP_USER=] --oracle-password Oracle database password [env: ATP_PASSWORD=] --oracle-pool-min Minimum Oracle connection pool size [env: ATP_POOL_MIN=] --oracle-pool-max Maximum Oracle connection pool size [env: ATP_POOL_MAX=] --oracle-pool-timeout-secs Oracle connection pool timeout in seconds [env: ATP_POOL_TIMEOUT_SECS=] PostgreSQL Database: --postgres-db-url PostgreSQL database connection URL --postgres-pool-max-size Maximum PostgreSQL connection pool size Redis Database: --redis-url Redis connection URL --redis-pool-max-size Maximum Redis connection pool size --redis-retention-days Redis data retention in days (-1 for persistent, default 30) TLS/mTLS Security: --tls-cert-path Path to server TLS certificate (PEM format) --tls-key-path Path to server TLS private key (PEM format) Tracing (OpenTelemetry): --enable-trace Enable OpenTelemetry tracing --otlp-traces-endpoint OTLP collector endpoint (format: host:port) [default: localhost:4317] Control Plane Authentication: --api-key API key for worker authorization --jwt-issuer JWT issuer URL for OIDC authentication [env: JWT_ISSUER=] --jwt-audience Expected JWT audience claim [env: JWT_AUDIENCE=] --jwt-jwks-uri Explicit JWKS URI (discovered from issuer if not set) [env: JWT_JWKS_URI=] --jwt-role-claim JWT claim name containing the role [default: roles] --jwt-role-mapping Role mapping from IDP to gateway role (format: idp_role=gateway_role) --control-plane-api-keys API keys for control plane access (format: id:name:role:key) [env: CONTROL_PLANE_API_KEYS=] --disable-audit-logging Disable audit logging for control plane operations