Web Analytics
 Contoh Open AI dengan PHP Curl

Contoh Open AI dengan PHP Curl


<?php

$curl = curl_init();

curl_setopt_array($curl, array(

  CURLOPT_URL => 'https://api.openai.com/v1/completions',

  CURLOPT_RETURNTRANSFER => true,

  CURLOPT_ENCODING => '',

  CURLOPT_MAXREDIRS => 10,

  CURLOPT_TIMEOUT => 0,

  CURLOPT_FOLLOWLOCATION => true,

  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

  CURLOPT_CUSTOMREQUEST => 'POST',

  CURLOPT_POSTFIELDS =>'{

  "model": "text-davinci-003",

  "prompt": "pertanyaan apa saja yang bisa dilakukan oleh open ai",

  "max_tokens": 3000,

  "temperature": 0

}',

  CURLOPT_HTTPHEADER => array(

    'Content-Type: application/json',

    'Authorization: Bearer Token_API'

  ),

));

 

$response = curl_exec($curl);

 

curl_close($curl);

echo $response;

 


Lanjut Part : 1
Jam : 01:40:44
Durasi Part : 0:0:1
Durasi Total : 0:0:1

Punya Pertanyaan , Silahkan Whatsapp Langsung
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1
Theme Customizer

Theme Styles