ph-7/openai-sdk

An easy SDK for using OpenAI with PHP

Fund package maintenance!
Ko Fi
pH-7

v1.0.1 2022-03-24 09:49 UTC

This package is auto-updated.

Last update: 2024-11-09 07:46:37 UTC


README

👀 Contents

🔨 Requirements

💭 Examples

<?php
require_once __DIR__ . '/vendor/autoload.php'; // Include Composer's autoload

use PH7\OpenAi\Api\OpenAi as OpenAiApi;
use PH7\OpenAi\Api\PrivateKey as OpenAiKey;
use PH7\OpenAi\Client as AiClient;

$apiKey = new OpenAiKey('YOUR_OPENAI_KEY_HERE');
$openAi = new AiClient( new OpenAiApi($apiKey) );
$openAi->search('Some keywords'); // To search
$openAi->classifications('Some keywords'); // For OpenAI classifications

🎉 3rd party libraries

🧑‍🍳 Author

I'm Pierre-Henry Soria. A passionate, zen & dedicated software engineer 😊

You can keep in touch with me at: hi@ph7.me 📮

pH-7

Pierre-Henry Soria

Me building it! 🔥

Watch the video

👉 Click here to watch on YouTube

📃 License

PHP OpenAI SDK is distributed under MIT license 🚀 Enjoy! ❤️

Note: This is not an official library published by OpenAI. I just want to help the community by providing a great library layer to be used with OpenAI.