Files
dobetternorge-tools/includes/ToolModels.php
T
2026-05-23 10:17:34 +02:00

26 lines
769 B
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/FreeTier.php';
/**
* Tier-aware model routing for tools that expose the existing engine selector.
*
* Plus/trial users get the cost-controlled Azure mini path. Pro users get the
* full Azure path. CaveauAI sessions keep the engine requested by their UI.
*/
final class ToolModels
{
public static function engineForUser(int $userId, string $requestedEngine): string
{
$valid = ['azure_mini', 'azure_full', 'gpu', 'regex'];
$requestedEngine = in_array($requestedEngine, $valid, true) ? $requestedEngine : 'azure_mini';
if ($userId <= 0) {
return $requestedEngine;
}
return FreeTier::tier($userId) === 'pro' ? 'azure_full' : 'azure_mini';
}
}