Files
weval-consulting/api/wevia-providers.php

45 lines
3.0 KiB
PHP

<?php
header('Content-Type: application/json');
$providers = [
'local' => [
['name'=>'granite4','type'=>'ollama','model'=>'granite4:latest','size'=>'2.1GB','active'=>1,'arch'=>'Hybrid Mamba/Transformer','params'=>'3B','use'=>'Function calling, RAG','license'=>'Apache 2.0'],
['name'=>'qwen3:8b','type'=>'ollama','model'=>'qwen3:8b','size'=>'5.2GB','active'=>1,'params'=>'8B','use'=>'General','license'=>'Apache 2.0'],
['name'=>'qwen3:4b','type'=>'ollama','model'=>'qwen3:4b','size'=>'2.5GB','active'=>1,'params'=>'4B','use'=>'Widget, fast','license'=>'Apache 2.0'],
['name'=>'qwen3.5:4b','type'=>'ollama','model'=>'qwen3.5:4b','size'=>'~2.5GB','active'=>0,'arch'=>'Gated DeltaNet + MoE','params'=>'4B','use'=>'Next-gen general','license'=>'Apache 2.0','note'=>'Pulling...'],
['name'=>'qwen2.5:7b','type'=>'ollama','model'=>'qwen2.5:7b','size'=>'4.7GB','active'=>1,'params'=>'7B','use'=>'Legacy','license'=>'Apache 2.0'],
['name'=>'mistral:latest','type'=>'ollama','model'=>'mistral:latest','size'=>'4.4GB','active'=>1,'params'=>'7B','use'=>'Multilingual','license'=>'Apache 2.0'],
],
'cloud' => [
['name'=>'groq','type'=>'cloud','model'=>'llama-3.3-70b-versatile','active'=>1,'speed'=>'ultra-fast','cost'=>'Free (rate-limited)','use'=>'Default provider','priority'=>1],
['name'=>'cerebras','type'=>'cloud','model'=>'llama-3.3-70b','active'=>1,'speed'=>'fast','cost'=>'Low','use'=>'Backup','priority'=>2],
['name'=>'glm-5','type'=>'cloud','model'=>'zai-org/glm-5','active'=>0,'speed'=>'medium','cost'=>'$1/M in, $3.2/M out','use'=>'Agentic, anti-hallucination','priority'=>3,'note'=>'Needs Z.ai API key'],
['name'=>'glm-5-turbo','type'=>'cloud','model'=>'zai-org/glm-5-turbo','active'=>0,'cost'=>'$1.2/$4 per M','use'=>'OpenClaw/Agent workflows','note'=>'Needs Z.ai API key'],
],
'agents' => [
['name'=>'hermes-agent','type'=>'agent','active'=>1,'skills'=>27,'cron'=>'*/30 * * * *','path'=>'/root/.hermes/'],
['name'=>'skill-sync','type'=>'cron','active'=>1,'schedule'=>'*/30 * * * *','sources'=>4,'path'=>'/opt/wevia-skill-sync.sh'],
],
];
// Test ollama connectivity
$ch = curl_init('http://127.0.0.1:11434/api/tags');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER=>true, CURLOPT_TIMEOUT=>3]);
$r = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch);
$ollama_up = $code === 200;
$models = $ollama_up ? array_column(json_decode($r, true)['models'] ?? [], 'name') : [];
// Mark active based on actual availability
foreach ($providers['local'] as &$p) {
$p['available'] = in_array($p['model'], $models) || in_array(explode(':', $p['model'])[0], array_map(function($m) { return explode(':', $m)[0]; }, $models));
}
echo json_encode([
'ok' => true,
'ollama' => $ollama_up,
'models_loaded' => count($models),
'providers' => $providers,
'total_local' => count($providers['local']),
'total_cloud' => count($providers['cloud']),
'total_agents' => count($providers['agents']),
], JSON_PRETTY_PRINT);