isModelAllowed function
Check if a model is in the allowlist.
Implementation
bool isModelAllowed(String modelId, List<String>? allowlist) {
if (allowlist == null || allowlist.isEmpty) return true;
final resolved = resolveModel(modelId);
if (resolved == null) return false;
for (final allowed in allowlist) {
// Exact match
if (allowed == modelId || allowed == resolved.id) return true;
// Family alias match
if (modelFamilyAliases.contains(allowed)) {
if (resolved.family.name == allowed) return true;
}
// Provider ID match
for (final providerId in resolved.providerIds.values) {
if (providerId == allowed) return true;
}
}
return false;
}