PHPackages                             thomasgenster/laragpt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. thomasgenster/laragpt

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

thomasgenster/laragpt
=====================

Laravel chatgpt package, includes models listing and retrieving, completions prediction, chat completion from conversation, edits, images creation, image edit, image variations, audio translation and transcription.

02.6kPHP

Since Mar 14Pushed 2y agoCompare

[ Source](https://github.com/thomasgenster/laragpt)[ Packagist](https://packagist.org/packages/thomasgenster/laragpt)[ RSS](/packages/thomasgenster-laragpt/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Get the power of OpenAI's APIs with laragpt.

Laragpt is the perfect package for developers wanting to access the powerful Artificial Intelligence capabilities of OpenAI through an easy to use Laravel interface. With laragpt you can quickly get up and running with OpenAI’s powerful deep learning algorithms, natural language processing, and machine learning capabilities, allowing for the development of innovative and complex applications. By taking advantage of the OpenAI API and Laravel’s simple interfaces, laragpt makes it easy to integrate AI into your projects. Give your apps the intelligence of OpenAI with laragpt.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require jumbaeric/laragpt
```

publish config file

```
php artisan vendor:publish
```

and select laragpt package to publish.

Add openai api key to your env variable

```
OPENAI_API_KEY=
```

Usage
-----

[](#usage)

All methods return Array

```
use Jumbaeric\Laragpt\Laragpt;

// Complete
// Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
    $args = [
        'prompt' => 'Brainstorm some ideas combining VR and fitness', //required
        'model' => 'text-davinci-003',  //  required
    ];

    Laragpt::complete($args);

// Chat
// Given a chat conversation, the model will return a chat completion response.

Laragpt::chat([
        'model' => 'gpt-3.5-turbo', // required
        'messages' => [             // required
            [
                "role" => "system",
                "content" => "You are a helpful assistant."
            ],
            [
                "role" => "user",
                "content" => "Who won the world series in 2020?"
            ],
            [
                "role" => "assistant",
                "content" => "The Los Angeles Dodgers won the World Series in 2020."
            ],
            [
                "role" => "user",
                "content" => "Where was it played?"
            ],
        ],
        'temperature' => 1.0,   //  optional
        'max_tokens' => 4000,   //  optional
        'frequency_penalty' => 0,   //  optional
        'presence_penalty' => 0,    //  optional
    ]);

// Audio
// trascribe: Transcribes audio into the input language.
// translate: Translates audio into into English.

$type = "transcript"; // string: Required : value can be transcript or translation
Laragpt::audio([
            'model' => 'whisper-1',     //  required
            'file' => "audio.mp3",      //  required
            'prompt' => "",             //  optional
            'response_format' => '',    //  optional
            'temperature' => '',        //  optional
        ], $type);

// Edits
// Given a prompt and an instruction, the model will return an edited version of the prompt.
Laragpt::edits([
        'model' => 'text-davinci-edit-001', // required
        'input' => 'What day of the wek is it?',
        'instruction' => 'Fix the spelling mistakes',   //  required
        'n' => 1,   //  optional
        'temperature' => 1,   //  optional
        'top_p' => 1,    //  optional
    ]);

// Images
    $createArr = [ // $type = create
        'prompt' => 'A cute baby sea otter',
        'size' => '1024x1024',   //  required
        'n' => 1,   //  optional
    ] ;

    $ceateEditArr = [ // $type = createEdit
        'prompt' => 'A cute baby sea otter wearing a beret',    // required
        'image' => '@otter.png',                                //required
        'mask' => '@mask.png',
        'n' => 1,
        'size' => '1024x1024',
    ];

    $createVariationArr = [ // $type = variations
        'image' => '@otter.png',
        'n' => 2,
        'size' => '1024x1024',
    ];

    Laragpt::images($createArr, $type = 'create');

// Models
$model_id = null; // String : Optional : Lists all models when value is null, model set returns the model details
Laragpt::models($model_id);
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Eric Jumba](https://github.com/jumbaeric)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 Bus Factor1

Top contributor holds 84.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6c064467d3a2261d5c1372119d561e05152cf47233337485f72f66676f6fab7?d=identicon)[thomasgenster](/maintainers/thomasgenster)

---

Top Contributors

[![jumbaeric](https://avatars.githubusercontent.com/u/7954516?v=4)](https://github.com/jumbaeric "jumbaeric (11 commits)")[![thomasgenster](https://avatars.githubusercontent.com/u/1425786?v=4)](https://github.com/thomasgenster "thomasgenster (2 commits)")

### Embed Badge

![Health badge](/badges/thomasgenster-laragpt/health.svg)

```
[![Health](https://phpackages.com/badges/thomasgenster-laragpt/health.svg)](https://phpackages.com/packages/thomasgenster-laragpt)
```

###  Alternatives

[mnapoli/pretty

Run all code formatting tools with one command: pretty

1085.1k9](/packages/mnapoli-pretty)[vitorf7/lv-loadmorepagination

Load More Pagination for Laravel. Allows to load an initial number of items and subsequent pages can load a different number of items

111.2k](/packages/vitorf7-lv-loadmorepagination)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
