Skip to content

Example of a ChatGPT on PHP and JS: GPT-3, GPT-3.5 and GPT-4 (chat.openai.com)

Notifications You must be signed in to change notification settings

alexz006/ChatGPT-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatGPT PHP Example

A simple example of using the GPT-3 API, GPT-3.5-turbo API, and the unofficial API from chat.openai.com (GPT-3.5 and GPT-4).

This example displays a chat in the browser where you can choose a GPT model. If you selected "chat.openai.com", you can specify a chatID, and support for communicating with the AI in dialogue mode will also be available.

ChatGPT-Example

Usage

To use the official API (GPT-3 and GPT-3.5-turbo), add OPENAI_API_KEY in the openai_chat_api.php file.

Additionally, to use the unofficial API from the chat.openai.com/chat page (GPT-3.5 and GPT-4), add ACCESS_TOKEN and COOKIE_PUID (only available for ChatGPT Plus users).

ACCESS_TOKEN:

Go to the page https://chat.openai.com/api/auth/session and copy the accessToken COOKIE_PUID

COOKIE_PUID:

Go to the page https://chat.openai.com/chat, open the DevTools in your browser (F12) and copy the cookie _puid=user-... COOKIE_PUID

About

Example of a ChatGPT on PHP and JS: GPT-3, GPT-3.5 and GPT-4 (chat.openai.com)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages