PHPackages                             yandricr/gpti-php - 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. [API Development](/categories/api)
4. /
5. yandricr/gpti-php

ActiveLibrary[API Development](/categories/api)

yandricr/gpti-php
=================

This package simplifies your interaction with various GPT models, removing the need for tokens or other methods to access GPT

1.1(1y ago)319MITPHP

Since Jul 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/yandricr/gpti-php)[ Packagist](https://packagist.org/packages/yandricr/gpti-php)[ Docs](https://github.com/yandricr/gpti-php)[ RSS](/packages/yandricr-gpti-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

GPTI
====

[](#gpti)

[![packagist](https://camo.githubusercontent.com/ace810b42ae334cb0a576c9cdaca5d5a0ba4f1a1cf5dc8095a1fa43fe0b1d01e/68747470733a2f2f706f7365722e707567782e6f72672f79616e64726963722f677074692d7068702f646f776e6c6f6164733f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/ace810b42ae334cb0a576c9cdaca5d5a0ba4f1a1cf5dc8095a1fa43fe0b1d01e/68747470733a2f2f706f7365722e707567782e6f72672f79616e64726963722f677074692d7068702f646f776e6c6f6164733f7374796c653d666f722d7468652d6261646765) [![license](https://camo.githubusercontent.com/99eb9e257c85d9b2ec2917a4cd7052110c707f31269ca33271cead2390410a64/68747470733a2f2f706f7365722e707567782e6f72672f79616e64726963722f677074692d7068702f6c6963656e73653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/yandricr/gpti-php) [![GitHub Stars](https://camo.githubusercontent.com/b0525ea1089e6cb19991292c211a142a1deb73a39afe9ea3d40fcc81fa8da9d2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f79616e64726963722f677074692d7068702e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d53746172)](https://github.com/yandricr/gpti-php) [![Package Size](https://camo.githubusercontent.com/41368f2cf82a78faeec5ce1a7b71028cabeaa5bbb8c1f076963d94cfad7b12ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f79616e64726963722f677074692d7068702e7376673f6c6162656c3d5061636b61676525323073697a65267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/yandricr/gpti-php) [![Contributors](https://camo.githubusercontent.com/63695cacc3be0d5a940ae1b23fe96febf506c0d2430f4cdbbe38a1a2327d80b2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f79616e64726963722f677074692d7068702e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/yandricr/gpti-php/graphs/contributors) [![PHP](https://camo.githubusercontent.com/a48ea36fc3cf9165a86645baf62b7b4f8d6d810febb2ebee02548efcbc001bd9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d677265793f6c6f676f3d706870267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/yandricr/gpti-php)

This package simplifies your interaction with various GPT models, eliminating the need for tokens or other methods to access GPT. It also allows you to use three artificial intelligences to generate images: DALL·E, Prodia, and more, some of which are premium while others are free, all of this without restrictions or limits.

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

[](#installation)

You can install the package via Composer

```
  composer require yandricr/gpti-php
```

Available Models
----------------

[](#available-models)

GPTI provides access to a variety of artificial intelligence models to meet various needs. Currently, the available models include:

- [**ChatGPT**](#gpt)
- [**GPT-3.5-Turbo**](#gpt-v2)
- [**ChatGPT Web**](#gptweb)
- [**GPT-4o**](#gpt-4o)
- [**Bing**](#bing)
- [**LLaMA-3.1**](#llama-3.1)
- [**Blackbox**](#blackbox)
- [**AI Images**](#ai-images)

Api key
-------

[](#api-key)

If you want to access the premium models, enter your credentials. You can obtain them by [clicking here](https://nexra.aryahcr.cc/api-key/en).

```
require "./vendor/autoload.php";

use gpti\...; // select model

$res = new ...();
$res->setAPI(user:"user-xxxxxxxx", secret:"nx-xxxxxxx-xxxxx-xxxxx");
```

Usage GPT
---------

[](#usage-gpt)

```
require "./vendor/autoload.php";

use gpti\gpt;

$res = new gpt(messages:array(
    [
        "role" => "assistant",
        "content" => "Hello! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Hello, my name is Yandri."
    ],
    [
        "role" => "assistant",
        "content" => "Hello, Yandri! How are you today?"
    ]
), prompt:"Can you repeat my name?", model:"GPT-4", markdown:false);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    print(json_encode($res->result()));
}
```

#### Models

[](#models)

Select one of these available models in the API to enhance your experience.

- gpt-4
- gpt-4-0613
- gpt-4-32k
- gpt-4-0314
- gpt-4-32k-0314
- gpt-3.5-turbo
- gpt-3.5-turbo-16k
- gpt-3.5-turbo-0613
- gpt-3.5-turbo-16k-0613
- gpt-3.5-turbo-0301
- text-davinci-003
- text-davinci-002
- code-davinci-002
- gpt-3
- text-curie-001
- text-babbage-001
- text-ada-001
- davinci
- curie
- babbage
- ada
- babbage-002
- davinci-002

Usage GPT v2
------------

[](#usage-gpt-v2)

It's quite similar, with the difference that it has the capability to generate real-time responses via streaming using gpt-3.5-turbo.

```
require "./vendor/autoload.php";

use gpti\gptturbo;

$res = new gptturbo(messages:array(
    [
        "role" => "assistant",
        "content" => "Hello! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Hello, my name is Yandri."
    ],
    [
        "role" => "assistant",
        "content" => "Hello, Yandri! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Can you repeat my name?"
    ]
), markdown:false, stream:false);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    print(json_encode($res->result()));
}
```

Usage GPT v2 Streaming
----------------------

[](#usage-gpt-v2-streaming)

```
require "./vendor/autoload.php";

use gpti\gptturbo;

$res = new gptturbo(messages:array(
    [
        "role" => "assistant",
        "content" => "Hello! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Hello, my name is Yandri."
    ],
    [
        "role" => "assistant",
        "content" => "Hello, Yandri! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Can you repeat my name?"
    ]
), markdown:false, stream:true);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    foreach($res->stream() as $data){
        print(json_encode($data));
    }
}
```

Usage GPT Web
-------------

[](#usage-gpt-web)

GPT-4 has been enhanced by me, but errors may arise due to technological complexity. It is advisable to exercise caution when relying entirely on its accuracy for online queries.

```
require "./vendor/autoload.php";

use gpti\gptweb;

$res = new gptweb(prompt:"Are you familiar with the movie Wonka released in 2023?", markdown:false);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    print(json_encode($res->result()));
}
```

Usage GPT-4o
------------

[](#usage-gpt-4o)

```
require "./vendor/autoload.php";

use gpti\gpt4o;

$res = new gpt4o(messages:array(
    [
        "role" => "assistant",
        "content" => "Hello! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Hello, my name is Yandri."
    ],
    [
        "role" => "assistant",
        "content" => "Hello, Yandri! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Can you repeat my name?"
    ]
), markdown:false, stream:false);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    print(json_encode($res->result()));
}
```

Usage GPT-4o Streaming
----------------------

[](#usage-gpt-4o-streaming)

```
require "./vendor/autoload.php";

use gpti\gpt4o;

$res = new gpt4o(messages:array(
    [
        "role" => "assistant",
        "content" => "Hello! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Hello, my name is Yandri."
    ],
    [
        "role" => "assistant",
        "content" => "Hello, Yandri! How are you today?"
    ],
    [
        "role" => "user",
        "content" => "Can you repeat my name?"
    ]
), markdown:false, stream:true);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    foreach($res->stream() as $data){
        print(json_encode($data));
    }
}
```

Usage Bing
----------

[](#usage-bing)

```
require "./vendor/autoload.php";

use gpti\bing;

$res = new bing(messages:array(
    [
        "role" => "assistant",
        "content" => "Hello! How can I help you today? 😊"
    ],
    [
        "role" => "user",
        "content" => "Hi, tell me the names of the movies released in 2023."
    ]
), conversation_style:"Balanced", markdown:false, stream:false);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    print(json_encode($res->result()));
}
```

Usage Bing Streaming
--------------------

[](#usage-bing-streaming)

```
require "./vendor/autoload.php";

use gpti\bing;

$res = new bing(messages:array(
    [
        "role" => "assistant",
        "content" => "Hello! How can I help you today? 😊"
    ],
    [
        "role" => "user",
        "content" => "Hi, tell me the names of the movies released in 2023."
    ]
), markdown:false, stream:true);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    foreach($res->stream() as $data){
        print(json_encode($data));
    }
}
```

#### Parameters

[](#parameters)

ParameterDefaultDescriptionconversation\_styleBalancedYou can use between: "Balanced", "Creative" and "Precise"markdownfalseYou can convert the dialogues into continuous streams or not into MarkdownstreamfalseYou are given the option to choose whether you prefer the responses to be in real-time or not

Usage LLaMA 3.1
---------------

[](#usage-llama-31)

```
require "./vendor/autoload.php";

use gpti\llama;

$res = new llama(messages:array(
    [
        "role" => "user",
        "content" => "Hello, my name is Yandri."
    ]
), conversation_style:"Balanced", markdown:false, stream:false);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    print(json_encode($res->result()));
}
```

Usage LLaMA 3.1 Streaming
-------------------------

[](#usage-llama-31-streaming)

```
require "./vendor/autoload.php";

use gpti\llama;

$res = new llama(messages:array(
    [
        "role" => "user",
        "content" => "Hello, my name is Yandri."
    ]
), markdown:false, stream:true);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    foreach($res->stream() as $data){
        print(json_encode($data));
    }
}
```

Usage blackbox
--------------

[](#usage-blackbox)

```
require "./vendor/autoload.php";

use gpti\blackbox;

$res = new blackbox(messages:array(
    [
        "role" => "user",
        "content" => "Hello, my name is Yandri."
    ]
), conversation_style:"Balanced", markdown:false, stream:false);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    print(json_encode($res->result()));
}
```

Usage Blackbox Streaming
------------------------

[](#usage-blackbox-streaming)

```
require "./vendor/autoload.php";

use gpti\blackbox;

$res = new blackbox(messages:array(
    [
        "role" => "user",
        "content" => "Hello, my name is Yandri."
    ]
), markdown:false, stream:true);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    foreach($res->stream() as $data){
        print(json_encode($data));
    }
}
```

AI Images
---------

[](#ai-images)

Check the documentation [here](https://nexra.aryahcr.cc/documentation/en) to learn how to use the different image generation models.

```
require "./vendor/autoload.php";

use gpti\imageai;

$res = new imageai(prompt:"cat color red", model:"dalle", response:"url", data:[]);
$res->execute();

if($res->error() != null){
    print(json_encode($res->error()));
} else {
    print(json_encode($res->result()));
}
```

API Reference
-------------

[](#api-reference)

Currently, some models require your credentials to access them, while others are free. For more details and examples, please refer to the complete [documentation](https://nexra.aryahcr.cc/).

#### Code Errors

[](#code-errors)

These are the error codes that will be presented in case the API fails.

CodeErrorDescription400BAD\_REQUESTNot all parameters have been entered correctly500INTERNAL\_SERVER\_ERRORThe server has experienced failures200The API worked without issues403FORBIDDENThe API credentials are not valid401UNAUTHORIZEDAPI credentials are required

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~132 days

Total

2

Last Release

544d ago

### Community

Maintainers

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

---

Top Contributors

[![yandricr](https://avatars.githubusercontent.com/u/77084669?v=4)](https://github.com/yandricr "yandricr (4 commits)")

---

Tags

aibinggptgpt-freellamastreamaiGPT-3chatgenerate imagegptgpt-4gpt-3.5dallebinggpt-4oblackboxgptigpt-freeprodiallama-3.1

### Embed Badge

![Health badge](/badges/yandricr-gpti-php/health.svg)

```
[![Health](https://phpackages.com/badges/yandricr-gpti-php/health.svg)](https://phpackages.com/packages/yandricr-gpti-php)
```

###  Alternatives

[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)[softcreatr/php-mistral-ai-sdk

A powerful and easy-to-use PHP SDK for the Mistral AI API, allowing seamless integration of advanced AI-powered features into your PHP projects.

1517.9k](/packages/softcreatr-php-mistral-ai-sdk)[softcreatr/php-perplexity-ai-sdk

A powerful and easy-to-use PHP SDK for the pplx (Perplexity) API, allowing seamless integration of advanced AI-powered features into your PHP projects..

149.1k](/packages/softcreatr-php-perplexity-ai-sdk)[softcreatr/php-openai-sdk

A powerful and easy-to-use PHP SDK for the OpenAI API, allowing seamless integration of advanced AI-powered features into your PHP projects.

101.0k](/packages/softcreatr-php-openai-sdk)

PHPackages © 2026

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