$cfile, 'model' => 'whisper-large-v3', 'language' => 'ar', 'response_format' => 'json' ]; $ch = curl_init('https://api.groq.com/openai/v1/audio/transcriptions'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . $apiKey ] ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error = curl_error($ch); curl_close($ch); if ($httpCode !== 200) { error_log("Groq Error: $response | $error"); json_error('فشل في تحويل الصوت إلى نص', 500); } $data = json_decode($response, true); json_success(['text' => $data['text'] ?? ''], 'تم التحويل بنجاح');