2k11cs12 / openai-laravel
Streamline OpenAI integration in Laravel for text generation.
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
pkg:composer/2k11cs12/openai-laravel
Requires
- php: ^8.0
This package is auto-updated.
Last update: 2025-12-31 00:24:43 UTC
README
Laravel OpenAI Integration simplifies the integration of OpenAI's powerful language models into your Laravel application. This package provides a convenient way to interact with OpenAI for natural language processing and text generation tasks.
Features
- Easy configuration of OpenAI API credentials.
- Simplified methods for generating text using OpenAI models.
- Customizable options for text generation.
- Seamless integration with your Laravel project.
Installation
You can install this package via Composer. Run the following command in your Laravel project:
composer require Mangrio/laravel-openai
Configuration
OPENAI_API_KEY=your-api-key-here
OPENAI_API=https://api.openai.com/v1/chat/completions
OPENAI_MODEL=gpt-3.5-turbo
Usage
// Import the OpenAI facade at the top of your file
use Mangrio\OpenAiLaravel\Facades\OpenAiLaravel;
$response = OpenAiLaravel::generate('Prompt')
->key('your-api-key')
->temperature(1.0)
->maxTokens(1000)
->topP(0.8)
->model('custom-model')
->frequencyPenalty(0.5)
->presencePenalty(0.3)
->execute();