Skip to main content

Routing state and cache keys

Everything the router remembers between requests, where it lives, and how long it lasts. This state lives in the router's routing cache, a DualCache. Every worker uses the same keys, encodings and TTLs, so a fleet shares one Redis. In the keys below, {id} is the deployment's model_info.id and {minute} is the UTC time as HH-MM.

The routing cache keys shared through Redis when it is configured, beside the
state kept only in this process

KeyWritten byRead byValueTTLTiers
deployment:{id}:cooldownHealth::add_cooldownthe cooldown filter, health().cooldowns{exception_received, status_code, timestamp, cooldown_time}the cooldown timememory + Redis, memory re-checked against Redis every 1s
deployment:{id}:allowed_failsHealth::record_failurethe samefail countthe cooldown timememory + Redis
deployment:{id}:allowed_fails:{suffix}the same, with a deployment-level policythe samefail count per error typethe cooldown timememory + Redis
{id}:successes, {id}:failsHealth::record_success, Health::record_failurethe default error-rate cooldown rule, health().failures_this_minute()count60smemory only
global_router:{id}:{model}:tpm:{minute}, :rpm:Health::record_success after each responsepre-call rate limit checks, health().usage()count60sRedis increment, memory
global_router:{id}:{model}:itpm:{minute}, :otpm:the input and output token rate limit checkthe same checkinput and output token counts60smemory + Redis
{id}:{model}:tpm:{minute}, {id}:{model}:rpm:{minute}the usage-based-routing-v2 strategythe samecount60smemory, pushed to Redis every 1s
{model_group}_mapthe latency-based-routing strategythe samelatency and ttft samples per deploymentrouting_strategy_args.ttl, 1 hourmemory + Redis
{model_group}_request_count:{id}the least-busy strategythe samerequests in flight1 hourmemory + Redis

Strategies and plugins keep their own keys (the strategy counters above, the budget limiter, prompt cache pins, deployment and session affinity).

Process-local state​

Some state is per router and is never shared.

  • the registry, with its indexes and registry().version, and the settings view, each held as one snapshot that apply() swaps
  • provider clients, cached per deployment for client_ttl seconds
  • the background health check results in health().health_checks

This state is rebuilt from config in every process, which is why deployment ids must be stable across processes.

LiteLLM Enterprise
SSO/SAML, audit logs, spend tracking, multi-team management, and guardrails, built for production.
Learn more →