Provider routing

How LOCK distributes inference requests across your configured providers — from simple round-robin to region-pinned failover chains.

Bare alias round-robin

When you register multiple providers under a single alias without any routing rules, LOCK cycles through them in order. Each request hits the next provider in the list, wrapping back to the start.

# providers.toml
[providers.openai]
  alias = "gpt-4o"

[providers.azure-east]
  alias = "gpt-4o"

# Request 1 → openai
# Request 2 → azure-east
# Request 3 → openai

No affinity. No weighting. Pure sequential distribution.

Region prefix pinning

Prefix a provider entry with a region tag to pin requests from specific geographic zones. LOCK matches the incoming request's resolved region against the prefix and routes accordingly.

[providers.azure-westus]
  alias = "us-west::gpt-4o"

[providers.azure-frankfurt]
  alias = "eu-central::gpt-4o"

# Request from Oregon → azure-westus
# Request from Berlin → azure-frankfurt

Unmatched regions fall through to the first unpinned provider sharing the base alias.

Failover chains

Append a priority integer to any provider entry. On timeout, 5xx, or connection failure, LOCK walks the chain in ascending priority order until a provider returns healthy.

[providers.primary]
  alias = "gpt-4o"
  priority = 0

[providers.fallback-us]
  alias = "gpt-4o"
  priority = 1

[providers.fallback-eu]
  alias = "gpt-4o"
  priority = 2

# primary fails → fallback-us → fallback-eu

Combine with region pinning for locality-aware failover. A pinned provider that fails will only cascade to same-region fallbacks before crossing zones.