Looking to hire Laravel developers? Try LaraJobs

openai-laravel maintained by 2k11cs12

Description
Streamline OpenAI integration in Laravel for text generation.
Author
Last update
2025/07/31 07:27 (dev-cursor/create-professional-wbs-with-estimations-4480)
License
Links
Downloads
12

Comments
comments powered by Disqus

Laravel OpenAI Integration

GitHub GitHub release (latest by date) GitHub Workflow Status

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();

Additional Options

Contributing

License