Builds the provider for a chat. The provider and model are, first one
wins:
provider: provider, then the ai.json default, then OpenRouter.
model: model; then the ai.json default model when it is for the same
provider; then DEFAULT_CHAT_MODEL for OpenRouter, the first
saved model for custom, or the first preset model of the provider.
secrets holds every known key, for redact.
It never throws for a missing key, an unknown provider or a broken
ai.json: it returns { error } with a message to show the user.
Builds the provider for a chat. The provider and model are, first one wins:
provider, then theai.jsondefault, then OpenRouter.model; then theai.jsondefault model when it is for the same provider; then DEFAULT_CHAT_MODEL for OpenRouter, the first saved model forcustom, or the first preset model of the provider.secretsholds every known key, forredact.It never throws for a missing key, an unknown provider or a broken
ai.json: it returns{ error }with a message to show the user.