GPT4 OpenAI Unofficial API Project Introduction
Overview
The GPT4 OpenAI Unofficial API is an innovative solution designed for those who have applied for GPT-4 API access but are still waiting for a response from OpenAI. The project creator faced the same issue and thus developed this package, which utilizes the Selenium WebDriver to simulate user interaction on the OpenAI chat platform. By doing so, this tool allows users with a ChatGPT Plus account to leverage the powerful capabilities of GPT-4. If users do not have ChatGPT Plus, the tool defaults to using GPT-3.5.
Features
-
Model Selection: The API supports multiple models including GPT-4 and DALL-E 3. Users can select their desired model by specifying it during initialization, such as using
model='gpt-4'
ormodel='gpt-4-plugins'
. -
Disclaimer: It's crucial to recognize that this API is unofficial and not endorsed by OpenAI. It does contravene their Terms of Service, so users are advised to proceed with caution and ensure they are compliant with the platform's rules.
-
Origin: The foundational logic for GPT4 OpenAI's unofficial API stems from the Free-Auto-GPT repository.
Practical Demonstrations
The project provides various demonstration scripts to showcase its functionality:
-
Simple Query: Shows how GPT-4 can handle logical queries and compare its response to GPT-3.5.
-
Image Generation: Demonstrates the creation of images using DALL-E 3, which only works with the GPT-4 model. This includes a cute, isometric dog inside a house.
-
Browsing Capabilities: Illustrates how the GPT-4 model can access web data to provide information, such as the age difference between celebrities.
Integration with Langchain
The GPT4 OpenAI library extends its versatility through integration with the Langchain ecosystem. This compatibility allows users to set up language model chains (LLMChain) by using the Langchain's prompt templates, facilitating scenarios like translating English to pirate language seamlessly.
Retrieving Session Tokens
Accessing the API requires a session token from OpenAI's chat platform. Users can extract this token from their browser's developer tools under the 'Cookies' section.
Comparison with Other Providers
During development, alternatives such as poe.com and Bing's GPT-4 were evaluated. It was observed that these platforms offer a smaller input context window compared to OpenAI's ChatGPT, highlighting the advantages of this unofficial API.
Installation and Dependencies
To integrate this unofficial API into their setups, users can install the package via pip with pip install gpt4-openai-api
. The package relies on specific dependencies including undetected-chromedriver
for Selenium functionality, markdownify
, and langchain
.
This project offers an advanced, albeit unofficial, toolset for utilizing GPT-4 through creative web simulation techniques at a time when official access might be delayed.