"llama-3.3-70b-versatile", "messages" => [ ["role" => "system", "content" => $system], ["role" => "user", "content" => $prompt] ], "max_tokens" => 500]); $ch = curl_init("https://api.groq.com/openai/v1/chat/completions"); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => ["Content-Type: application/json", "Authorization: Bearer $key"], CURLOPT_TIMEOUT => 20, CURLOPT_SSL_VERIFYPEER => false ]); $r = curl_exec($ch); $err = curl_error($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $d = @json_decode($r, true); $content = $d["choices"][0]["message"]["content"] ?? null; echo json_encode([ "ok" => !!$content, "content" => $content ?? "error: $err (HTTP $code)", "resp_len" => strlen($r), "key_len" => strlen($key) ]);