• Reading time ~ 1 min
  • 08.11.2022

OpenAI PHP Client is a supercharged PHP API client that allows you to interact with the OpenAI API.

Here's a brief example from the package's readme of using the OpenAI PHP client:

$client = OpenAI::client('YOUR_API_KEY');
 
$result = $client->completions()->create([
    'model' => 'davinci',
    'prompt' => 'PHP is',
]);
 
echo $result['choices'][0]['text'];
// an open-source, widely-used, server-side scripting language.

At the release of this post, the OpenAI PHP client supports the following resources:

OpenAI has a broad range of uses related to natural language processing (NLP), generating code from natural language, and more. To start using the OpenAI package, you'll need to familiarize yourself with the OpenAI platform. I'd recommend starting with the API docs and OpenAI API examples.

To start using OpenAI with your PHP applications, check out this package on GitHub at openai-php/client.

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

ABOUT

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

About author CrazyBoy49z
WORK EXPERIENCE
Contact
Ukraine, Lutsk
+380979856297