"gpt-3.5-turbo", "messages" => [ ["role" => "user", "content" => $prompt] ], "temperature" => 0.7 ]; $ch = curl_init("https://api.openai.com/v1/chat/completions"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Content-Type: application/json", "Authorization: Bearer $apiKey" ]); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); $result = curl_exec($ch); curl_close($ch); if ($result) { $json = json_decode($result, true); if (isset($json["choices"][0]["message"]["content"])) { $response = $json["choices"][0]["message"]["content"]; } else { $response = "❌ Erreur de réponse de l'API : " . ($json["error"]["message"] ?? "Réponse vide. "); } } else { $response = "❌ Erreur lors de la communication avec l'API. "; } } } } } ?> Comment puis-je vous aider ?

Comment puis-je vous aider ?