gpt-3.5-turbo
는 채팅 모델로 v1/chat/completions
엔드포인트를 사용해야 합니다.
$api_key = ”;
$url = ‘https://api.openai.com/v1/chat/completions’;
$messages = [
[“role” => “system”, “content” => “You are a helpful assistant that rephrases sentences.”],
[“role” => “user”, “content” => “명령문: ” . $content]
];
$response = wp_remote_post($url, array(
'headers' => array(
'Authorization' => 'Bearer ' . $api_key,
'Content-Type' => 'application/json'
),
'body' => json_encode(array(
'model' => 'gpt-3.5-turbo',
'messages' => $messages
))
));