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.
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:
Go to the page https://chat.openai.com/chat, open the DevTools
in your browser (F12
) and copy the cookie _puid=user-...
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。