Skip to main content

Configuration and defaults

The constructor arguments of litellm.Router, grouped by what they control. SDK users pass them to Router(). In proxy config.yaml they sit under router_settings, with model_list at the top level. litellm.router_api.router_init_args() lists every accepted name.

from litellm import Router

router = Router(
model_list=model_list,
routing_strategy="simple-shuffle",
num_retries=2,
fallbacks=[{"gpt-4o": ["claude-sonnet"]}],
)

Router(**arguments) freezes the arguments into a RouterConfig, and they stay fixed for the router's life. Change them with apply(), see Entry points. Where a default below says litellm.<name>, the value comes from the process settings, which the router reads as one RouterDynamicConfig snapshot per call.

The Router constructor arguments grouped into five areas: deployments,
selection, reliability, state and health

Deployments​

ArgumentDefaultMeaning
model_listNonethe deployments, see Concepts
model_group_alias{}name to group, or {"model": group, "hidden": true}
routing_groupsNonegroups of model groups with their own strategy
default_litellm_params{}merged into every call. The router adds max_retries: 0 to it
assistants_config, search_tools, guardrail_listNonenon-model resources the router serves
ignore_invalid_deploymentsFalseskip a bad deployment instead of failing construction

Selection​

ArgumentDefaultMeaning
routing_strategy"simple-shuffle"see the strategy table in Strategies, routing groups and sub-routers
routing_strategy_args{}strategy options, for example ttl and lowest_latency_buffer for latency routing
enable_pre_call_checksFalserun context window, region and rate limit checks per request
optional_pre_call_checksNoneextra checks, such as prompt caching or Responses API affinity
enable_tag_filtering, tag_filtering_match_any, tag_routing_prefixFalse, True, ""route by request tags against deployment tags
pluginsNonerouting plugins that narrow candidates or attach signals
default_max_parallel_requestsNoneper-deployment concurrency cap when a deployment sets none
provider_budget_configNoneper-provider budgets enforced by the budget limiter filter
deployment_affinity_ttl_seconds, model_group_affinity_config, session_affinity_repin_on_failover3600, None, Falsesticky routing for sessions and response chains
default_priority, polling_intervalNone, Nonethe priority scheduler queue, shared through the router's Redis when one is set

Reliability​

ArgumentDefaultMeaning
num_retrieslitellm.num_retries, else 2retries in the same group
retry_policy, model_group_retry_policyNone, {}retries per error type, router-wide or per group
retry_after0minimum seconds to wait before a backoff retry
timeout, stream_timeoutNoneper-call timeouts. A deployment's own values win
fallbacks[][{"group": ["other", ...]}] for any error
context_window_fallbacks[]the same, for ContextWindowExceededError
content_policy_fallbacks[]the same, for ContentPolicyViolationError
default_fallbacksNonebecomes the "*" entry of fallbacks
max_fallbackslitellm.max_fallbacks, else 5hop limit for fallbacks
fallback_on_unsupported_paramsTruefall back on an unsupported-parameter 400
fallback_access_check, fallback_budget_checkNonecallables that may veto a fallback target
enable_weighted_failoverFalsepick again in the group before falling back, simple-shuffle only
enable_mid_stream_fallback_continuationFalsecontinue a broken stream on a fallback group
cooldown_time5 secondshow long a deployment stays cooled down
allowed_failslitellm.allowed_fails (3)fails allowed per cooldown window, used only when set explicitly or changed from the default
allowed_fails_policyNoneallowed fails per error type
disable_cooldownsNoneturn cooldowns off

State​

ArgumentDefaultMeaning
redis_url, redis_host, redis_port, redis_password, redis_dbNonethe Redis behind the routing state, see Shared state
cache_kwargs{}extra arguments for the Redis client
cache_responses, caching_groupsFalse, Noneresponse caching through litellm.cache
client_ttl3600seconds before a cached provider client is rebuilt

Health​

ArgumentDefaultMeaning
enable_health_check_routingFalsedrop deployments failing background health checks, and with an allowed fails policy ignore cooldowns when they would leave nothing
health_check_staleness_thresholdNonehow old a health result may be and still count
health_check_ignore_transient_errorsFalsedo not mark a deployment unhealthy for transient errors
background_health_check_model_groupsNonelimit health checks to these groups
alerting_configNoneSlack alerting on routing events

Per-deployment overrides​

These go in a deployment's litellm_params (some also in model_info) and win over the router-wide value.

KeyEffect
rpm, tpmlimits for usage-aware strategies and pre-call checks, and simple-shuffle weights
weightsimple-shuffle weight
orderin-group priority, lowest first
cooldown_timethis deployment's cooldown time, which wins over the Retry-After header and the router value
num_retriesretries for requests that land here
max_parallel_requestsconcurrency cap
timeout, stream_timeoutper-call timeouts
model_info.team_idrestrict the deployment to one team
model_info.blockedpaused by an admin

Constants​

From litellm/constants.py. Each can be overridden with the environment variable of the same name.

ConstantDefaultUsed for
DEFAULT_COOLDOWN_TIME_SECONDS5router cooldown_time default
DEFAULT_COOLDOWN_REDIS_READ_INTERVAL_SECONDS1.0how often the cooldown cache re-reads Redis
DEFAULT_FAILURE_THRESHOLD_PERCENT0.5error-rate cooldown threshold
DEFAULT_FAILURE_THRESHOLD_MINIMUM_REQUESTS5minimum requests in the window before the error rate counts
SINGLE_DEPLOYMENT_TRAFFIC_FAILURE_THRESHOLD1000requests needed before a lone deployment can be cooled down at 100% failures
ROUTER_MAX_FALLBACKS5max_fallbacks default
DEFAULT_REDIS_SYNC_INTERVAL1seconds between usage counter pushes to Redis
DEFAULT_MAX_RETRIES2the default retry count elsewhere in LiteLLM. The router uses the OpenAI SDK's value, which is also 2
INITIAL_RETRY_DELAY, MAX_RETRY_DELAY, JITTER0.5, 8.0, 0.75the retry backoff in seconds
LiteLLM Enterprise
SSO/SAML, audit logs, spend tracking, multi-team management, and guardrails, built for production.
Learn more →