GPT4W
Inspiration:
"My account is linked to my identity, I need to be careful with the question I ask."
"I got banned for no reason. It might be a violation of the platform's usage policies."
"My data has been used to train AI, but due to restrictions on nationality and region, I can't even access this tool. That's unfair!"
All these concerns raised from users' AI experience highlight an unequal relationship between users and Web2 centralized platforms, also threatening users' privacy which is tied to their identity and IP address. GPT4W, a decentralized AI tool, has been developed to fundamentally break down the barriers to AI caused by the monopolistic power of Web2 centralized platforms, tech giants, and nationality restrictions.
What it does?
GPT4W-GPT for Web3, is a decentralized AI tool where Anonymity and Accessibility converge. It protects users' privacy and security through anonymity while ensuring that everyone has equal rights to use AI without any region or identity restriction.
It is built on top of UP4W, which is a decentralized network comprising a group of protocols that implements the user's complete freedom, ownership, and privacy.
How we build it:
Prerequisites
To build the project, the following prerequisites are needed:
- Node.js ≥ v16
Confirm that Node.js is installed on your system. The latest version can be obtained from the official Node.js website.
- npm/yarn/pnpm
We advise the use of npm or yarn as package management tools for the installation of project dependencies.
Recommended versions are at least npm v6 and yarn v1. Alternatively, pnpm is also an acceptable choice if it better suits your preferences.
yarn
We recommend using Yarn to install project dependencies. Yarn stands out as an efficient and reliable package manager, ensuring deterministic builds and offering superior performance compared to npm.
$ npm install -g yarnYou can install Yarn globally on your system with the following command, making it available as a command-line tool
npm
In general, when you install Node.js, npm (Node Package Manager) will automatically install as well.
pnpm
The fastest way to install pnpm is by using npm itself. You can install pnpm globally using the following command:
$ npm install -g pnpmThis will install pnpm globally on your system, making it available as a command-line tool.- Git
Git is a free and open-source distributed version control system. It's designed to handle projects of all sizes with speed and efficiency. You can download Git from the official website here.
- VS CodeWe recommend using VSCode as your code editor. You can install it from here.
Building Steps
Clone The Repository
You will need to clone the repository to your local machine as the first step:
$ cd <your_dir>
$ git clone https://github.com/0xSchneier/gpt4w
Install Dependencies
Install dependencies locally.
$ cd up4w_apps
$ yarn install // or npm install
Now you have all the prerequisites to run GPT4W locally for development.
Run Program
$ yarn start // or npm start
The application will launch automatically once the compilation process concludes.
Package Application
If you want to package this program, run package command as follows.
$ yarn package // or npm run package
The package command will package the program into a corresponding compressed file based on platform and architecture. You can find the generated zip file in the out directory.
However, to distribute this program to others, it is recommend to build a distributable following the instruction in the next section.
Build distributable
To package all work together and distribute, it is recommended to use the make script. It will create a platform-specific distributable for you to conveniently share with others.
$ yarn make // npm run make
It takes slightly longer than packaging, you can find the generated executable program in the out/make directory which is located at the same level as the current directory.
Please note:
The scripts for packaging and building are dependent on the runtime system environment. Building a distributable for another platform is not possible. (e.g. building a Mac executable is not possible on Windows, finding to a Mac dev environment in mandatory in this case.)
Architecture:
Main Process
Our application operates with a single main process, functioning as the entry point of the application. This main process executes within a Node.js environment, enabling it to utilize all Node.js APIs. In the main process, we perform the following tasks:
- Some basic application initialization operations, such as creating application windows, loading UI pages, generating random accounts, creating application trays, etc.;
- Starting the UP4W network application through sub-process, and connecting to the P2P network, as well as starting a WebSocket service with a random port;
- Providing various interfaces to preload script, so that UI processes can get the processing power of original application, such as reading and writing local databases. Code that runs in the main process is in the src/main directory.
Render Process
The rendering engine in Electron replicates a Chrome browser environment, in which a local web page is hosted. This page is developed using react, an open-source tool from Facebook, and applies the matching routing solution, react-router, to enhance the component-based development experience. For code highlighting in the chat window, we've also utilized react-highlight, ensuring a more elegant and user-friendly code presentation.
UP4W-JS
up4w-js is a JavaScript library we've developed for interacting with the UP4W network. It is designed to function within both Node.js and regular browser environments.
The library offers a collection of functions to streamline application access to the UP4W network. These functions include actions like accessing the WebSocket service from the main process, or interacting with UP4W through WebSocket connections. It facilitates a range of operations, such as anonymous ID generation and login, contact list manipulation, sending and receiving messages, and storing offline data within the P2P network. Not all these features are used in the current version yet and we plan to extend GPT4W in the future with more features.
GPT4w communicates with a chat robot that resides on another node of the UP4W network. All communication is over the P2P network provided by UP4W. Using JS API (up4w.ms.sendText), GPT4w can submit a question to the robot and receive a response from it within a short amount of time.
Check out the complete implementation in the src/page/chatroom directory
Chat Robot Service
The chat robot service is hosted on a node of the p2p network. Each message it receives is interpreted as a question. By utilizing a Node.js implemented HTTP service that is integrated with OpenAI in the background, Chat Robot is designed to provide quick and precise responses.
Note: Robot service is not included in the open source repository.
Accomplishments:
GPT4W makes three major differentiations compared to Web2 centralized AI platforms:
(1) Boundless Access: No banning regards nationality restriction.
(2) Equitable User Rights: No account bans or usage policies.
(3) No Identity Exposure Risk: No personal information is required at all.
What is next for GPT4W:
GPT4W, envision a future where the power of artificial intelligence is harnessed for the benefit of all humanity. Maximizing the potential of AI can be fully achieved through GPT4W, which is decentralized, anonymous, and resistant to overriding.


Log in or sign up for Devpost to join the conversation.