“)exit;
$query=sprintf(‘{“model”:”text-davinci-003″,”prompt”:”%s”,”max_tokens”:%d,”temperature”:%f}’,urldecode($_POST[“prompt”]),$_POST[“tokens”],$_POST[“temp”]);
$c=curl_init();
curl_setopt($c,CURLOPT_URL,”https://api.openai.com/v1/completions”);
curl_setopt($c,CURLOPT_HTTPHEADER,array(‘Content-Type: application/json’,”Authorization: Bearer
curl_setopt($c,CURLOPT_POST,1);
curl_setopt($c,CURLOPT_POSTFIELDS,$query);
curl_setopt($c,CURLOPT_RETURNTRANSFER,true);
curl_setopt($c,CURLOPT_SSL_VERIFYPEER,false);
$r=curl_exec($c);
curl_close($c);
$r=json_decode($r);
$t=$r->choices[0]->text;
die(str_replace(“\n\n”,”\n”,trim($t)));
?>