OpenAI

Configuration & usage

Fully open-source and secure community-maintained, PHP SDK for accessing the OpenAI GPT-3 API.

Installation

You can install the package via composer:

composer require orhanerday/open-ai

Configurations

OpenAI Settings

# OpenAI Settings
OPENAI_SECRET_KEY=<your-secret>
OPENAI_ORGANIZATION_ID=<your-organization-id>

Usage

// if the class is aware of injections
$openAi = $this->openAi;

// if the container is present
$openAi = $this->di->get('openAi');

// to access the shared db service
$openAi = Di::getDefault()->get('openAi');

Sources

Last updated