pub struct RouteConfig {
pub to: Vec<RouteTarget>,
pub pick: Pick,
pub needs: Vec<String>,
pub when: RouteWhen,
pub fallback: Option<bool>,
pub hedge: Option<Duration>,
pub tries: Option<u32>,
pub backoff: Option<Duration>,
pub max_backoff: Option<Duration>,
pub until: Commit,
}Expand description
One route: the candidates a model name goes to, and how they are picked, retried and raced.
Fields§
§to: Vec<RouteTarget>Where it goes: provider, provider/model or provider/{model}
({model} the name asked for), or a list of them, each alone or
as { target = "..", weight = 3 }.
pick: PickHow the candidates are ordered: first (as listed), cheapest
(by each model’s pricing: input plus three times output), fastest (by the gateway’s own record of each one’s time
to a response), weighted or random. first if unset.
needs: Vec<String>What a candidate’s model must be able to do, as its provider’s
listing says, such as tools or vision; one the listing says
nothing of is kept.
when: RouteWhenWhich requests it applies to; every request if unset.
fallback: Option<bool>Whether a failed candidate falls back to the next; true if unset.
hedge: Option<Duration>Races the candidates instead, each started this long after the one
before, such as 200ms; off if unset.
tries: Option<u32>Tries per candidate, retries included; 1 if unset.
backoff: Option<Duration>The first wait before a retry, doubled after each; 250 ms if unset.
max_backoff: Option<Duration>The longest wait before a retry; a Retry-After longer than it means
no retry. 10 s if unset.
until: CommitHow far an answer is read before it counts as a success.