‘deepseek-chat’,
‘messages’ => $messages,
‘temperature’ => 0.7,
‘max_tokens’ => 1000
];
$ch = curl_init(‘https://api.deepseek.com/v1/chat/completions’);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
‘Authorization: Bearer ‘ . $API_KEY,
‘Content-Type: application/json’
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
http_response_code($httpCode);
echo $response;
exit;
}
http_response_code(405);
echo json_encode([‘error’ => ‘Método no permitido’]);
