PHPackages                             iteks/laravel-openai - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. iteks/laravel-openai

ActiveLibrary[HTTP &amp; Networking](/categories/http)

iteks/laravel-openai
====================

A powerful package that seamlessly integrates OpenAI's advanced AI capabilities into your Laravel applications. This package offers quick setup and intuitive configuration to leverage AI models for chat, embeddings, and more.

v1.0.6(1y ago)81.3k↓59.1%2MITPHPPHP ^8.1

Since May 29Pushed 1y agoCompare

[ Source](https://github.com/iteks/laravel-openai)[ Packagist](https://packagist.org/packages/iteks/laravel-openai)[ RSS](/packages/iteks-laravel-openai/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (7)Dependencies (7)Versions (8)Used By (0)

[![Laravel OpenAI](https://raw.githubusercontent.com/iteks/art/master/logo-packages/laravel-openai.svg)](https://raw.githubusercontent.com/iteks/art/master/logo-packages/laravel-openai.svg)

[![Total Downloads](https://camo.githubusercontent.com/2bc3eceb922f0cb80d50338ff7ab036ccc161b932f4c16a50805a47a5a6ffdcd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6974656b732f6c61726176656c2d6f70656e6169)](https://packagist.org/packages/iteks/laravel-openai)[![Latest Stable Version](https://camo.githubusercontent.com/48de58206649892ddd9a8cc8ac12005b24957e274634a63f549d8da92b94698d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6974656b732f6c61726176656c2d6f70656e6169)](https://packagist.org/packages/iteks/laravel-openai)[![License](https://camo.githubusercontent.com/389f3c677a56f43f4b43745445a85a030a64e997088233a47e15033bb046c7f2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6974656b732f6c61726176656c2d6f70656e6169)](https://packagist.org/packages/iteks/laravel-openai)

**Laravel OpenAI** is a community-maintained PHP API client, a powerful and user-friendly package designed to seamlessly integrate OpenAI's advanced AI capabilities into your Laravel applications. This package simplifies interaction with the OpenAI API, offering an elegant interface to quickly leverage various AI models for chat, embeddings, and more. With intuitive configuration through environment variables and smooth integration via a dedicated Laravel service provider, **Laravel OpenAI** ensures you can get started with OpenAI endpoints swiftly and efficiently. Enhance your Laravel applications by harnessing the power of OpenAI's AI models with this versatile and easy-to-use client.

Offered by [iteks](https://github.com/iteks/), Developed by [jeramyhing](https://github.com/jeramyhing/).

Get Started
-----------

[](#get-started)

> **Requires [PHP 8.1+](https://php.net/releases/)**

Install **Laravel OpenAI** via the [Composer](https://getcomposer.org/) package manager:

```
composer require iteks/laravel-openai
```

Set your OpenAI API key and base URI in your .env file. These configurations are required:

```
OPENAI_API_KEY=
OPENAI_BASE_URI=
```

To explore additional optional configurations, publish the package configuration file using the following command:

```
php artisan vendor:publish --provider="Iteks\Providers\OpenAiServiceProvider" --tag=config
```

Usage
-----

[](#usage)

Include the OpenAi facade.

```
use Iteks\Support\Facades\OpenAi;
```

For API calls, required parameters should be passed directly to the Facade methods without wrapping them in an array. Optional parameters can be included as an associative array at the end. Each method's documentation includes a link to the official API reference for further details.

```
// Example of a required parameter
$response = OpenAi::chat('Your message here');

// Example with optional parameters
$response = OpenAi::chat('Your message here', ['temperature' => 0.7, 'max_tokens' => 150]);
```

- [ENDPOINTS](#endpoints)
    - [Audio](#audio)
        - [Create speech](#create-speech)
        - [Create transcription](#create-transcription)
        - [Create translation](#create-translation)
    - [Chat](#chat)
        - [Create chat completion](#create-chat-completion)
    - [Embeddings](#embeddings)
        - [Create embeddings](#create-embeddings)
    - [Fine-tuning](#fine-tuning)
        - [Create fine-tuning job](#create-fine-tuning-job)
        - [List fine-tuning jobs](#list-fine-tuning-jobs)
        - [List fine-tuning events](#list-fine-tuning-events)
        - [List fine-tuning checkpoints](#list-fine-tuning-checkpoints)
        - [Retrieve fine-tuning job](#retrieve-fine-tuning-job)
        - [Cancel fine-tuning](#cancel-fine-tuning)
    - [Batch](#batch)
        - [Create batch](#create-batch)
        - [Retrieve batch](#retrieve-batch)
        - [Cancel batch](#cancel-batch)
        - [List batch](#list-batch)
    - [Files](#files)
        - [Upload file](#upload-file)
        - [List files](#list-files)
        - [Retrieve file](#retrieve-file)
        - [Delete file](#delete-file)
        - [Retrieve file content](#retrieve-file-content)
    - [Images](#images)
        - [Create image](#create-image)
        - [Create image edit](#create-image-edit)
        - [Create image variation](#create-image-variation)
    - [Models](#models)
        - [List models](#list-models)
        - [Retrieve model](#retrieve-model)
        - [Delete a fine-tuned model](#delete-a-fine-tuned-model)
    - [Moderations](#moderations)
        - [Create moderation](#create-moderation)
- [ASSISTANTS](#assistants)
    - [Assistants (Beta v2)](#assistants-1)
        - [Create assistant](#create-assistant)
        - [List assistants](#list-assistants)
        - [Retrieve assistant](#retrieve-assistant)
        - [Modify assistant](#modify-assistant)
        - [Delete assistant](#delete-assistant)
    - [Threads (Beta v2)](#threads)
        - [Create thread](#create-thread)
        - [Retrieve thread](#retrieve-thread)
        - [Modify thread](#modify-thread)
        - [Delete thread](#delete-thread)
    - [Messages (Beta v2)](#messages)
        - [Create message](#create-message)
        - [List messages](#list-messages)
        - [Retrieve message](#retrieve-message)
        - [Modify message](#modify-message)
        - [Delete message](#delete-message)
    - [Runs (Beta v2)](#runs)
        - [Create run](#create-run)
        - [Create thread and run](#create-thread-and-run)
        - [List runs](#list-runs)
        - [Retrieve run](#retrieve-run)
        - [Modify run](#modify-run)
        - [Submit tool outputs to run](#submit-tool-outputs-to-run)
        - [Cancel a run](#cancel-a-run)
    - [Run Steps (Beta v2)](#run-steps)
        - [List run steps](#list-run-steps)
        - [Retrieve run step](#retrieve-run-step)
    - [Vector Stores (Beta v2)](#vector-stores)
        - [Create vector store](#create-vector-store)
        - [List vector stores](#list-vector-stores)
        - [Retrieve vector store](#retrieve-vector-store)
        - [Modify vector store](#modify-vector-store)
        - [Delete vector store](#delete-vector-store)
    - [Vector Store Files (Beta v2)](#vector-store-files)
        - [Create vector store file](#create-vector-store-file)
        - [List vector store files](#list-vector-store-files)
        - [Retrieve vector store file](#retrieve-vector-store-file)
        - [Delete vector store file](#delete-vector-store-file)
    - [Vector Store File Batches (Beta v2)](#vector-store-file-batches)
        - [Create vector store file batch](#create-vector-store-file-batch)
        - [Retrieve vector store file batch](#retrieve-vector-store-file-batch)
        - [Cancel vector store file batch](#cancel-vector-store-file-batch)
        - [List vector store files in a batch](#list-vector-store-files-in-a-batch)
- [LEGACY](#legacy)
    - [Completions](#completions)
        - [Create completion](#create-completion)

ENDPOINTS
---------

[](#endpoints)

### Audio

[](#audio)

#### Create speech

[](#create-speech)

Generates audio from the input text. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/audio/createSpeech)

```
OpenAi::audio()->createSpeech('tts-1', 'The quick brown fox jumped over the lazy dog.', 'alloy');
```

[top](#usage)

#### Create transcription

[](#create-transcription)

Transcribes audio into the input language. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/audio/createTranscription)

```
OpenAi::audio()->createTranscription(fopen('@/path/to/file/audio.mp3', 'r'), 'whisper-1');
```

[top](#usage)

#### Create translation

[](#create-translation)

Translates audio into English. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/audio/createTranslation)

```
OpenAi::audio()->createTranslation('@/path/to/file/german.m4a', 'whisper-1');
```

[top](#usage)

### Chat

[](#chat)

#### Create chat completion

[](#create-chat-completion)

Creates a model response for the given chat conversation. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/chat/create)

```
OpenAi::chat()->create(
    [
        ['role' => 'system', 'content' => 'You are a helpful assistant.',],
        [ 'role' => 'user', 'content' => 'Hello!', ],
    ],
    'gpt-4o'
);
```

[top](#usage)

### Embeddings

[](#embeddings)

#### Create embeddings

[](#create-embeddings)

Creates an embedding vector representing the input text. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/embeddings/create)

```
OpenAi::embeddings()->create(
    'The food was delicious and the waiter...',
    'text-embedding-ada-002',
    ['encoding_format' => 'float']
);
```

[top](#usage)

### Fine-tuning

[](#fine-tuning)

#### Create fine-tuning job

[](#create-fine-tuning-job)

Creates a fine-tuning job which begins the process of creating a new model from a given dataset. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/fine-tuning/create)

```
OpenAi::fineTuning()->create('gpt-3.5-turbo', 'file-BK7bzQj3FfZFXr7DbL6xJwfo');
```

[top](#usage)

#### List fine-tuning jobs

[](#list-fine-tuning-jobs)

List your organization's fine-tuning jobs. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/fine-tuning/list)

```
OpenAi::fineTuning()->list();
```

[top](#usage)

#### List fine-tuning events

[](#list-fine-tuning-events)

Get status updates for a fine-tuning job. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/fine-tuning/list-events)

```
OpenAi::fineTuning()->listEvents('ftjob-abc123');
```

[top](#usage)

#### List fine-tuning checkpoints

[](#list-fine-tuning-checkpoints)

List checkpoints for a fine-tuning job. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/fine-tuning/list-checkpoints)

```
OpenAi::fineTuning()->listCheckpoints('ftjob-abc123');
```

[top](#usage)

#### Retrieve fine-tuning job

[](#retrieve-fine-tuning-job)

Get info about a fine-tuning job. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/fine-tuning/retrieve)

```
OpenAi::fineTuning()->retrieve('ft-AF1WoRqd3aJAHsqc9NY7iL8F');
```

[top](#usage)

#### Cancel fine-tuning

[](#cancel-fine-tuning)

Immediately cancel a fine-tune job. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/fine-tuning/cancel)

```
OpenAi::fineTuning()->cancel('ftjob-abc123');
```

[top](#usage)

### Batch

[](#batch)

#### Create batch

[](#create-batch)

Creates and executes a batch from an uploaded file of requests. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/batch/create)

```
OpenAi::batch()->create('file-abc123', '/v1/chat/completions', '24h');
```

[top](#usage)

#### Retrieve batch

[](#retrieve-batch)

Retrieves a batch. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/batch/retrieve)

```
OpenAi::batch()->retrieve('batch_abc123');
```

[top](#usage)

#### Cancel batch

[](#cancel-batch)

Cancels an in-progress batch. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/batch/cancel)

```
OpenAi::batch()->cancel('batch_abc123');
```

[top](#usage)

#### List batch

[](#list-batch)

List your organization's batches. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/batch/list)

```
OpenAi::batch()->list();
```

[top](#usage)

### Files

[](#files)

#### Upload file

[](#upload-file)

Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/files/create)

```
OpenAi::files()->create(fopen('@mydata.jsonl', 'r'), 'fine-tune');
```

[top](#usage)

#### List files

[](#list-files)

Returns a list of files that belong to the user's organization. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/files/list)

```
OpenAi::files()->list();
```

[top](#usage)

#### Retrieve file

[](#retrieve-file)

Returns information about a specific file. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/files/retrieve)

```
OpenAi::files()->retrieve('file-abc123');
```

[top](#usage)

#### Delete file

[](#delete-file)

Delete a file. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/files/delete)

```
OpenAi::files()->delete('file-abc123');
```

[top](#usage)

#### Retrieve file content

[](#retrieve-file-content)

Returns the contents of the specified file. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/files/retrieve-contents)

```
OpenAi::files()->retrieveContents('file-abc123');
```

[top](#usage)

### Images

[](#images)

#### Create image

[](#create-image)

Creates an image given a prompt. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/images/create)

```
OpenAi::images()->create(
    'A cute baby sea otter',
    [
        'model' => 'dall-e-3',
        'n' => 1,
        'size' => '1024x1024',
    ]
);
```

[top](#usage)

#### Create image edit

[](#create-image-edit)

Creates an edited or extended image given an original image and a prompt. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/images/createEdit)

```
OpenAi::images()->createEdit(
    'fopen('@otter.png', 'r')',
    'A cute baby sea otter wearing a beret',
    [
        'mask' => '@mask.png',
        'n' => 2,
        'size' => '1024x1024',
    ]
);
```

[top](#usage)

#### Create image variation

[](#create-image-variation)

Creates a variation of a given image. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/images/createVariation)

```
OpenAi::images()->createVariation(
    'fopen('@otter.png', 'r')',
    [
        'n' => 2,
        'size' => '1024x1024',
    ]
);
```

[top](#usage)

### Models

[](#models)

#### List models

[](#list-models)

Lists the currently available models, and provides basic information about each one such as the owner and availability. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/models/list)

```
OpenAi::models()->list();
```

[top](#usage)

#### Retrieve model

[](#retrieve-model)

Retrieves a model instance, providing basic information about the model such as the owner and permissioning. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/models/retrieve)

```
OpenAi::models()->retrieve('gpt-3.5-turbo-instruct');
```

[top](#usage)

#### Delete a fine-tuned model

[](#delete-a-fine-tuned-model)

Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/models/delete)

```
OpenAi::models()->delete('ft:gpt-3.5-turbo:acemeco:suffix:abc123');
```

[top](#usage)

### Moderations

[](#moderations)

#### Create moderation

[](#create-moderation)

Classifies if text is potentially harmful. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/moderations/create)

```
OpenAi::moderations()->create('I want to kill them.');
```

[top](#usage)

ASSISTANTS
----------

[](#assistants)

### Assistants

[](#assistants-1)

#### Create assistant

[](#create-assistant)

Create an assistant with a model and instructions. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/assistants/createAssistant)

```
OpenAi::assistants()->create(
    'gpt-4-turbo',
    [
        'instructions' => 'You are a personal math tutor. When asked a question, write and run Python code to answer the question.',
        'name' => 'Math Tutor',
        'tools' => [['type' => 'code_interpreter']],
    ]
);
```

[top](#usage)

#### List assistants

[](#list-assistants)

Returns a list of assistants. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/assistants/listAssistants)

```
OpenAi::assistants()->list();
```

[top](#usage)

#### Retrieve assistant

[](#retrieve-assistant)

Retrieves an assistant. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/assistants/getAssistant)

```
OpenAi::assistants()->retrieve('asst_abc123');
```

[top](#usage)

#### Modify assistant

[](#modify-assistant)

Modifies an assistant. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/assistants/modifyAssistant)

```
OpenAi::assistants()->modify(
    'asst_idcmCPkquyQbqOpdJOEb6wCO',
    [
        'instructions' => 'You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.',
        'tools' => [['type' => 'file_search']],
        'model' => 'gpt-4-turbo',
    ]
);
```

[top](#usage)

#### Delete assistant

[](#delete-assistant)

Delete an assistant. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/assistants/deleteAssistant)

```
OpenAi::assistants()->delete('asst_abc123');
```

[top](#usage)

### Threads

[](#threads)

#### Create thread

[](#create-thread)

Create a thread. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/threads/createThread)

```
OpenAi::threads()->create();
```

[top](#usage)

#### Retrieve thread

[](#retrieve-thread)

Retrieves a thread. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/threads/getThread)

```
OpenAi::threads()->retrieve('thread_abc123');
```

[top](#usage)

#### Modify thread

[](#modify-thread)

Modifies a thread. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/threads/modifyThread)

```
OpenAi::threads()->modify(
    'thread_abc123',
    [
        'metadata' => [
            'modified' => 'true',
            'user' => 'abc123',
        ],
    ]
);
```

[top](#usage)

#### Delete thread

[](#delete-thread)

Delete a thread. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/threads/deleteThread)

```
OpenAi::threads()->delete('thread_abc123');
```

[top](#usage)

### Messages

[](#messages)

#### Create message

[](#create-message)

Create a message. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/messages/createMessage)

```
OpenAi::messages()->create(
    'thread_abc123',
    'user',
    'How does AI work? Explain it in simple terms.'
);
```

[top](#usage)

#### List messages

[](#list-messages)

Returns a list of messages for a given thread. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/messages/listMessages)

```
OpenAi::messages()->list('thread_abc123');
```

[top](#usage)

#### Retrieve message

[](#retrieve-message)

Retrieves a message. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/messages/getMessage)

```
OpenAi::messages()->retrieve('thread_abc123', 'msg_abc123');
```

[top](#usage)

#### Modify message

[](#modify-message)

Modifies a message. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/messages/modifyMessage)

```
OpenAi::messages()->modify(
    'thread_abc123',
    'msg_abc123',
    [
        'metadata' => [
            'modified' => 'true',
            'user' => 'abc123',
        ],
    ]
);
```

[top](#usage)

#### Delete message

[](#delete-message)

Deletes a message. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/messages/deleteMessage)

```
OpenAi::messages()->delete('thread_abc123', 'msg_abc123');
```

[top](#usage)

### Runs

[](#runs)

#### Create run

[](#create-run)

Create a run. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/runs/createRun)

```
OpenAi::runs()->create('thread_abc123', 'asst_abc123');
```

[top](#usage)

#### Create thread and run

[](#create-thread-and-run)

Create a thread and run it in one request. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/runs/createThreadAndRun)

```
OpenAi::runs()->createThreadAndRun(
    'asst_abc123',
    [
        'messages' => [
            [
                'role' => 'user',
                'content' => 'Explain deep learning to a 5 year old.',
            ],
        ],
    ]
);
```

[top](#usage)

#### List runs

[](#list-runs)

Returns a list of runs belonging to a thread. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/runs/listRuns)

```
OpenAi::runs()->list('thread_abc123');
```

[top](#usage)

#### Retrieve run

[](#retrieve-run)

Retrieves a run. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/runs/getRun)

```
OpenAi::runs()->retrieve('thread_abc123', 'run_abc123');
```

[top](#usage)

#### Modify run

[](#modify-run)

Modifies a run. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/runs/modifyRun)

```
OpenAi::runs()->modify(
    'thread_abc123',
    'run_abc123',
    [
        'metadata' => [
            'user' => 'user_abc123',
        ],
    ]
);
```

[top](#usage)

#### Submit tool outputs to run

[](#submit-tool-outputs-to-run)

When a run has the status: "requires\_action" and required\_action.type is submit\_tool\_outputs, this endpoint can be used to submit the outputs from the tool calls once they're all completed. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs)

```
OpenAi::runs()->submitToolOutputs(
    'thread_abc123',
    'run_abc123',
    [
        0 => [
            'tool_call_id' => 'call_001',
            'output' => '70 degrees and sunny.',
        ],
    ]
);
```

[top](#usage)

#### Cancel a run

[](#cancel-a-run)

Cancels a run that is in\_progress. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/runs/cancelRun)

```
OpenAi::runs()->cancel('thread_abc123', 'run_abc123');
```

[top](#usage)

### Run Steps

[](#run-steps)

#### List run steps

[](#list-run-steps)

Returns a list of run steps belonging to a run. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/run-steps/listRunSteps)

```
OpenAi::runSteps()->list('thread_abc123', 'run_abc123');
```

[top](#usage)

#### Retrieve run step

[](#retrieve-run-step)

Retrieves a run step. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/run-steps/getRunStep)

```
OpenAi::runSteps()->retrieve('thread_abc123', 'run_abc123', 'step_abc123');
```

[top](#usage)

### Vector Stores

[](#vector-stores)

#### Create vector store

[](#create-vector-store)

Create a vector store. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores/create)

```
OpenAi::vectorStores()->create(['name' => 'Support FAQ']);
```

[top](#usage)

#### List vector stores

[](#list-vector-stores)

Returns a list of vector stores. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores/list)

```
OpenAi::vectorStores()->list();
```

[top](#usage)

#### Retrieve vector store

[](#retrieve-vector-store)

Retrieves a vector store. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores/retrieve)

```
OpenAi::vectorStores()->retrieve('vs_abc123');
```

[top](#usage)

#### Modify vector store

[](#modify-vector-store)

Modifies a vector store. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores/modify)

```
OpenAi::vectorStores()->modify('vs_abc123', ['name' => 'Support FAQ']);
```

[top](#usage)

#### Delete vector store

[](#delete-vector-store)

Delete a vector store. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores/delete)

```
OpenAi::vectorStores()->delete('vs_abc123');
```

[top](#usage)

### Vector Store Files

[](#vector-store-files)

#### Create vector store file

[](#create-vector-store-file)

Create a vector store file by attaching a File to a vector store. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores-files/createFile)

```
OpenAi::vectorStoreFiles()->create('vs_abc123', 'file-abc123');
```

[top](#usage)

#### List vector store files

[](#list-vector-store-files)

Returns a list of vector store files. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores-files/listFiles)

```
OpenAi::vectorStoreFiles()->list('vs_abc123');
```

[top](#usage)

#### Retrieve vector store file

[](#retrieve-vector-store-file)

Retrieves a vector store file. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores-files/getFile)

```
OpenAi::vectorStoreFiles()->retrieve('vs_abc123', 'file-abc123');
```

[top](#usage)

#### Delete vector store file

[](#delete-vector-store-file)

Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the delete file endpoint. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores-files/deleteFile)

```
OpenAi::vectorStoreFiles()->delete('vs_abc123', 'file-abc123');
```

[top](#usage)

### Vector Store File Batches

[](#vector-store-file-batches)

#### Create vector store file batch

[](#create-vector-store-file-batch)

Create a vector store file batch. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)

```
OpenAi::vectorStoreFileBatches()->create(
    'vs_abc123',
    [
        'file_ids' => [
            'file-abc123',
            'file-abc456',
        ],
    ]
);
```

[top](#usage)

#### Retrieve vector store file batch

[](#retrieve-vector-store-file-batch)

Retrieves a vector store file batch. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/getBatch)

```
OpenAi::vectorStoreFileBatches()->retrieve('vs_abc123', 'vsfb_abc123');
```

[top](#usage)

#### Cancel vector store file batch

[](#cancel-vector-store-file-batch)

Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/cancelBatch)

```
OpenAi::vectorStoreFileBatches()->cancel('vs_abc123', 'vsfb_abc123');
```

[top](#usage)

#### List vector store files in a batch

[](#list-vector-store-files-in-a-batch)

Returns a list of vector store files in a batch. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/listBatchFiles)

```
OpenAi::vectorStoreFileBatches()->list('vs_abc123', 'vsfb_abc123');
```

[top](#usage)

LEGACY
------

[](#legacy)

### Completions

[](#completions)

#### Create completion

[](#create-completion)

Creates a completion for the provided prompt and parameters. [See official documentation for all options.](https://platform.openai.com/docs/api-reference/completions/create)

```
OpenAi::completions()->create(
    'gpt-3.5-turbo-instruct',
    'Say this is a test',
    [
        'max_tokens' => 7,
        'temperature' => 0,
    ]
);
```

[top](#usage)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance46

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.3% 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 ~57 days

Recently: every ~75 days

Total

7

Last Release

415d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88e5ff66bb85d5340eea2ace11b581931c488785420335d62fc3b00235c29256?d=identicon)[jeramyhing](/maintainers/jeramyhing)

---

Top Contributors

[![jeramyhing](https://avatars.githubusercontent.com/u/107206200?v=4)](https://github.com/jeramyhing "jeramyhing (36 commits)")[![silentrob](https://avatars.githubusercontent.com/u/15984?v=4)](https://github.com/silentrob "silentrob (1 commits)")

---

Tags

httpphpapiclientlaraveldataaiopenaigpt

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/iteks-laravel-openai/health.svg)

```
[![Health](https://phpackages.com/badges/iteks-laravel-openai/health.svg)](https://phpackages.com/packages/iteks-laravel-openai)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k8.8M83](/packages/openai-php-laravel)[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

72287.1k1](/packages/mozex-anthropic-laravel)[unopim/unopim

UnoPim Laravel PIM

10.3k2.2k](/packages/unopim-unopim)[laragear/api-manager

Manage multiple REST servers to make requests in few lines and fluently.

162.0k](/packages/laragear-api-manager)

PHPackages © 2026

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