CHAPTER 04 · Model-Provider Abstraction and Multi-Model Strategy · 5 / 8
A model registry and validation
Centralise the list of allowed model ids in one place: a registry. This does double duty:
- Provider inference. A simple id-prefix rule (or an explicit map) tells the dispatcher which provider owns a model.
- Validation. The model id often arrives from the client (the user picked it). Validate it against the registry's allow-list before passing it to a provider, and fall back to a safe default for unknown ids. Never hand an unvalidated, client-supplied model id straight to an API.