Expand description
Lightweight model → provider lookup.
Used by cloud-side validation (PATCH /v1/admin/routes) and the
gateway’s defensive logging to detect routes that would cross provider
boundaries. The runtime registry in tt-core is the source of truth;
this helper is a cheap heuristic so callers that can’t depend on
the full provider registry still get the answer right for the
prefixes we actually ship.
Conservative semantics: returns Some(&'static str) only for prefixes
we know for certain belong to a single provider. Ambiguous names
(e.g. llama-3-* which could be Groq, Together, or OpenRouter) return
None so the caller doesn’t reject a legitimate use of an aggregator.
Functions§
- infer_
provider - Returns the provider id for
modelwhen it’s a well-known single-provider prefix; otherwiseNone. - known_
to_ differ - Returns
trueiff bothaandbresolve to known providers AND those providers differ.falsewhen either side is unknown (we don’t block routes that aggregate throughopenrouter/together/groqwhose model names overlap across providers). - local_
backend - If
modelis a local-backend-prefixed id (ollama/…,vllm/…,lmstudio/…) with a non-empty model name, return the backend id; else None. Single source of truth for local routing — used by the registry resolver, the same-provider exemption, andLocalProvider’s prefix strip.