Expand description
Explicit model targets — operator-written aliases in the forward path.
Runs between body parse and body compression: an exact alias match
([proxy.routing.aliases], RoutingRules) may replace the model field
and re-target the request to another upstream of the same wire shape —
or, with the shape-xlat feature (enterprise#16), route an Anthropic
/v1/messages request onto an OpenAI-shape upstream with the translation
flag set. "acme/fast" = "foundry:gpt-4o-mini" gives clients a stable org
name for an approved endpoint; a local target keeps traffic on-device.
LeanCTX never picks a model on its own. The rewrite is recorded as
routed_from on the usage record so the operator can see it happened.
Missing rules/model and unavailable target shapes leave the body unchanged.
Structs§
- Route
Decision - What an alias resolved to for one request. Applied by the forward path:
modelalready swapped in the body byroute_request; the caller re-targets the upstream and injects the registry credential if set.
Functions§
- route_
request - Applies the alias rules to a parsed request body. On a match the body’s
modelfield is rewritten in place and the decision is returned; without a match or reachable target the body is untouched andNoneis returned.