定制 khaiphan/openai-auth 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

khaiphan/openai-auth

Composer 安装命令:

composer require khaiphan/openai-auth

包简介

A PHP library for authenticating with OpenAI

README 文档

README

OpenAIAuth is a Composer package that allows you to authenticate with OpenAI/ChatGPT using PHP code.

Languages

Installation

Requires a minimum PHP version of 7.2

Use Composer to install the package.

Run the following command in the terminal:

composer require khaiphan/openai-auth:dev-main

Usage

  1. First, include the autoloader in your PHP code:
require 'vendor/autoload.php';
  1. Next, create an instance of the Auth0 class and provide your OpenAI username and password:
use KhaiPhan\OpenAi\Auth;

$OpenAIAuth = new Auth('OpenAI_username', 'OpenAI_password');
  1. Then, call the auth() method to authenticate and obtain the access token:
$auth = $OpenAIAuth->auth();
  1. You can access the access token through the $auth['access_token'] variable. For example:
$accessToken = $auth['access_token'];
echo $accessToken;

Make sure to replace 'OpenAI_username' and 'OpenAI_password' with your actual authentication credentials.

License

This package is open source and available under the MIT License.

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-01