geekr / openai-laravel
Laravel OpenAI wrapper with suppoort for proxy
dev-master
2023-03-08 06:00 UTC
Requires
- php: ^8.1.0
- laravel/framework: ^9.46.0|^10.2.0
- openai-php/client: ^0.3.4
This package is auto-updated.
Last update: 2024-12-08 09:30:42 UTC
README
Laravel OpenAI Wrapper with support for proxy
Install:
composer require geekr/openai-laravel
Publish config file:
php artisan vendor:publish --provider="GeekrOpenAI\Laravel\ServiceProvider"
Edit OPENAI_*
setting in .env
:
OPENAI_API_KEY={your openai api key}
OPENAI_BASE_URI=open.aiproxy.xyz/v1
Usage:
use GeekrOpenAI\Laravel\Facades\OpenAI; $response = OpenAI::chat()->create([ 'model' => 'gpt-3.5-turbo', 'messages' => $messages ]); $content = $response->choices[0]->message->content
Sample Project: