'no key']); exit; } $imageUrl = $_POST['image_url'] ?? $_GET['image_url'] ?? ''; $prompt = $_POST['prompt'] ?? $_GET['prompt'] ?? 'Describe this image in detail'; if (!$imageUrl) { echo json_encode(['error'=>'no image_url']); exit; } $msgs = [['role'=>'user','content'=>[ ['type'=>'image_url','image_url'=>['url'=>$imageUrl]], ['type'=>'text','text'=>$prompt] ]]]; $ch = curl_init('https://openrouter.ai/api/v1/chat/completions'); curl_setopt_array($ch, [ CURLOPT_POST=>true, CURLOPT_RETURNTRANSFER=>true, CURLOPT_TIMEOUT=>30, CURLOPT_CONNECTTIMEOUT=>5, CURLOPT_HTTPHEADER=>['Content-Type: application/json', 'Authorization: Bearer '.$key], CURLOPT_POSTFIELDS=>json_encode(['model'=>'qwen/qwen2.5-vl-32b-instruct', 'messages'=>$msgs, 'max_tokens'=>1000, 'temperature'=>0.5]) ]); $r = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($code == 200 && $r) { $d = json_decode($r, true); $text = $d['choices'][0]['message']['content'] ?? ''; echo json_encode(['response'=>$text, 'provider'=>'Qwen VL-32B', 'model'=>'qwen/qwen2.5-vl-32b-instruct']); } else { echo json_encode(['error'=>'API error', 'code'=>$code, 'raw'=>substr($r,0,200)]); }