Download the PHP package mounirrquiba/openai without Composer

On this page you can find all versions of the php package mounirrquiba/openai. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package openai

OpenAI API Client in PHP (community-maintained)

This library is a component-oriented, extensible client library for the OpenAI API. It's designed to be faster and more memory efficient than traditional PHP libraries.

Installation

You can install the package via composer:

// PHP 8.0, 8.1, 8.2

Table of Contents

Quick Start

Keys configuration

You can store you api key and organization key into your env

Powershell

Cmd

Linux or macOS

Alternatively you can set it in your code, you only need to do this once. If you have already put the variables in your env this step is not necessary

Custom API URL configuration

If you don't use OpenAI endpoint you can change it

Proxy configuration

Headers configuration

Back to top

Services

Models

Lists the currently available models, and provides basic information about each one such as the owner and availability.

Request (models)

Response (models)

Back to top

Model

Retrieves a model instance, providing basic information about the model such as the owner and permissioning.

Request (model)

Response (model)

Back to top

Completions

Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.

Create completions

Creates a completion for the provided prompt and parameters.

Request (Create completions)

Response (Create completions)

Back to top

Create stream completions

Creates a completion for the provided prompt and parameters with stream.

Request (Create stream completions)

Response (Create stream completions)

Back to top

Chat

Given a list of messages describing a conversation, the model will return a response.

Create chat completion

Creates a model response for the given chat conversation.

Request (Create chat completion)

Response (Create chat completion)

Back to top

Create stream chat completion

Creates a model response for the given chat conversation with stream.

Request (Create stream chat completion)

Response (Create stream chat completion)

Back to top

Edits

Creates a new edit for the provided input, instruction, and parameters.

Request (Edits)

Response (Edits)

Back to top

Images

Given a prompt and/or an input image, the model will generate a new image.

Images Generations

Creates an image given a prompt.

Request (Images Generations)

Response (Images Generations)

Back to top

Images Edits

Creates an edited or extended image given an original image and a prompt.

Request (Images Edits)

Response (Images Edits)

Back to top

Images Variations

Creates a variation of a given image.

Request (Images Variations)

Response (Images Variations)

Back to top

Embeddings

Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. Creates an embedding vector representing the input text.

Request (Embeddings)

Response (Embeddings)

Back to top

Audio

Creates a new edit for the provided input, instruction, and parameters.

Audio Transcriptions

Transcribes audio into the input language.

Request (Audio Transcriptions)

Response (Audio Transcriptions)

Back to top

Audio Translations

Translates audio into into English.

Request (Audio Translations)

Response (Audio Transcriptions)

Back to top

Files

Files are used to upload documents that can be used with features like Fine-tuning.

List files

Returns a list of files that belong to the user's organization.

Request (List files)

Response (List files)

Back to top

Upload file

Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.

Request (Upload file)

Response (Upload file)

Delete file

Delete a file.

Request (Delete file)

Response (Delete file)

Back to top

Retrieve file

Returns information about a specific file.

Request (Retrieve file)

Response (Retrieve file)

Back to top

Retrieve file content

Returns the contents of the specified file

Request (Retrieve file content)

Response (Retrieve file content)

Back to top

Fine-tune

Manage fine-tuning jobs to tailor a model to your specific training data.

Create fine-tune

Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.

Request (Create fine-tune)

Response (Create fine-tune)

Back to top

List fine-tunes

List your organization's fine-tuning jobs

Request (List fine-tunes)

Response (List fine-tunes)

Back to top

Retrieve fine-tune

Gets info about the fine-tune job.

Request (Retrieve fine-tune)

Response (Retrieve fine-tune)

Back to top

Cancel fine-tune

Immediately cancel a fine-tune job.

Request (Cancel fine-tune)

Response (Cancel fine-tune)

Back to top

List fine-tune events

Get fine-grained status updates for a fine-tune job.

Request (List fine-tune events)

Response (List fine-tune events)

Back to top

Delete fine-tune model

Delete a fine-tuned model. You must have the Owner role in your organization.

Request (Delete fine-tune model)

Response (Delete fine-tune model)

Back to top

Moderations

Given a input text, outputs if the model classifies it as violating OpenAI's content policy. Classifies if text violates OpenAI's Content Policy

Request (Moderations)

Response (Moderations)

Back to top

Exceptions

The provided code demonstrates a try-catch block for handling exceptions.

List of exceptions:

Back to top

Tests

Back to top

License

The MIT License (MIT)

Copyright (c) Mounir R'Quiba | https://www.linkedin.com/in/mounir-r-quiba-14aa84ba/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


All versions of openai with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
guzzlehttp/guzzle Version ^7.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mounirrquiba/openai contains the following files

Loading the files please wait ....