Share this article
Improve this guide
Install ChatGPT App Locally: Why & How to Do It
Follow the step by step guide to get this done
15 min. read
Updated onOctober 4, 2023
updated onOctober 4, 2023
Share this article
Improve this guide
Read our disclosure page to find out how can you help Windows Report sustain the editorial teamRead more
Key notes
ChatGPTis designed to provide fast responses to your queries. You can access ChatGPT online; however, if you prefer to install the app, this guide can help.
We will discuss the step-by-step method to install the ChatGPT app locally so that you can use it to get faster responses with increased privacy.
Why install the ChatGPT app locally?
There are several benefits of installing the AI model on your computer, some of which are mentioned here:
How can I install the ChatGPT app locally?
Before engaging in steps to install the ChatGPT app locally, you should consider performing the following checks:
1. Create a folder & open it in Visual Studio Code
2. Check if Node.js is installed
3. Install dependencies
4. Write code in style.css
5. Write code in Index.html
6. Run commands on the Terminal
7. Write code in the script.js file
8. Create a new folder inside the Open_AI_ChatGPT app folder and install modules
9. Generate the API key and mention it in .env
10. Create new file server.js and write a script
import express from ‘express’;import * as dotenv from ‘dotenv’;import cors from ‘cors’;import { Configuration, OpenAIApi } from ‘openai’;dotenv.config();const configuration = new Configuration({apiKey: process.env.OPENAI_API_KEY,});const openai = new OpenAIApi(configuration);const app = express();app.use(cors());app.use(express.json());app.get('/', async (req, res) => {res.status(200).send({message: ‘Hello from GPT!’,})});app.post('/', async (req, res) => {try {const prompt = req.body.prompt;const response = await openai.createCompletion({model: “text-davinci-003”,prompt: ${prompt}
,temperature: 0, // Higher values means the model will take more risks.max_tokens: 3000, // The maximum number of tokens to generate in the completion. Most models have a context length of 2048 tokens (except for the newest models, which support 4096).top_p: 1, // alternative to sampling with temperature, called nucleus samplingfrequency_penalty: 0.5, // Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model’s likelihood to repeat the same line verbatim.presence_penalty: 0, // Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model’s likelihood to talk about new topics.});res.status(200).send({bot: response.data.choices[0].text});} catch (error) {console.log(error);res.status(500).send(error || ‘Something went wrong’);}});app.listen(5000, () => console.log(‘AI server started on http://localhost:8001’));
11. Write code in the package.json
{“name”: “server”,“version”: “1.0.0”,“description”: “”,“type”: “module”,“scripts”:{“server”: “nodemon server”},“keywords”: [],“author”: “”,“license”: “ISC”,“dependencies”: {“cors”: “^2.8.5”,“dotenv”: “^16.0.3”,“express”: “^4.18.2”,“nodemon”: “^2.0.20”,“openai”: “^3.1.0”}}
12. Test the code
13. Install the Git Bash app and configure it with your GitHub account
14. Create a repository, and publish code
15. Deploy the server
16. Deploy the front end
So, these are the detailed steps to install the ChatGPT app locally on your device. Stuck somewhere? Please mention your questions or concerns in the comments section below.
More about the topics:ChatGPT
Srishti Sisodia
Windows Software Expert
Srishti Sisodia is an electronics engineer and writer with a passion for technology. She has extensive experience exploring the latest technological advancements and sharing her insights through informative blogs.
Her diverse interests bring a unique perspective to her work, and she approaches everything with commitment, enthusiasm, and a willingness to learn. That’s why she’s part of Windows Report’s Reviewers team, always willing to share the real-life experience with any software or hardware product. She’s also specialized in Azure, cloud computing, and AI.
User forum
0 messages
Sort by:LatestOldestMost Votes
Comment*
Name*
Email*
Commenting as.Not you?
Save information for future comments
Comment
Δ
Srishti Sisodia
Windows Software Expert
She is an electronics engineer and writer with a passion for technology. Srishti is specialized in Azure, cloud computing, and AI.