Skip to main content

Module providers

Module providers 

Source
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 model when it’s a well-known single-provider prefix; otherwise None.
known_to_differ
Returns true iff both a and b resolve to known providers AND those providers differ. false when either side is unknown (we don’t block routes that aggregate through openrouter / together / groq whose model names overlap across providers).
local_backend
If model is 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, and LocalProvider’s prefix strip.