GPT4Free TypeScript Version: Providing a free OpenAI GPT-4 API!

1 min

GPT4Free TypeScript Version

Providing a free OpenAI GPT-4 API!

Github logo

GPT4Free TypeScript Version is a project that aims to provide a free GPT-4 API, a powerful natural language processing model developed by OpenAI. The project is based on TypeScript, a programming language that extends JavaScript with static types and other features. The project uses TensorFlow.js, a library for machine learning in JavaScript, to implement the GPT-4 model and run it in the browser or on Node.js.

Getting Started

To get started, A file named .env is required for this project.

This step is essential for all methods of operation.

  • http_proxy: If you have trouble reaching the desired site, you may need to set up a proxy server.
  • rapid_api_key: This is a required configuration for using the forefront api. The apikey allows you to receive registration emails. get api key here
  • EMAIL_TYPE: temporary email types include temp-email temp-email44 tempmail-lol
    • temp-email: The maximum number of requests per day is 100. To increase this limit, you need to link a credit card to your account. This service is very reliable!
    • temp-email44: limited 100req/days! Stable!
    • tempmail-lol: limited to 25request/5min. Not Stable.
  • DEBUG: Valid when use forefront Set it to 1 when running locally. show reverse process
  • POOL_SIZEforefront concurrency size. Keep set=1 until you run it successfully!!! You can engage in {POOL_SIZE} conversations concurrently. A higher pool size enables more parallel conversations, but it also consumes more RAM.

Run it locally 🖥️

# install module
# start server
yarn start

Run with docker🐳(Recommended!)

docker run -p 3000:3000 --env-file .env xiangsx/gpt4free-ts:latest

Deploy with docker-compose 🎭

To run the application with docker, you need to create a .env file first. Then, follow the instructions in the “Run with docker” section.


docker-compose up --build -d

Running GPT-4

Request Parameters📝

  • prompt: your question. It can be a string or jsonstr.
    • example jsonstr:[{"role":"user","content":"你好\n"},{"role":"assistant","content":"你好!有什么我可以帮助你的吗?"},{"role":"user","content":"你是谁"}]
    • example string你是谁
  • model: default gpt3.5-turbo. model include:gpt4 gpt3.5-turbo
  • site: default you. target site, include forefront you mcbbs

Response Parameters 🔙

Response when chat ends (/ask):

interface ChatResponse {
    content: string;
    error?: string;

Response with stream like(/ask/stream):

event: message
data: {"content":"I"}

event: done
data: {"content":"'m"}

event: error
data: {"error":"some thind wrong"}


  1. request to site you with history

req:[{“role”:”user”,”content”:”hello”},{“role”:”assistant”,”content”:”Hi there! How can I assist you today?”},{“role”:”user”,”content”:”who are you”}]


  "content": "Hi there! How can I assist you today?"

Sites using this project

model support status active time gpt3.5 Active after 2023-06-03 👍GPT-4/gpt3.5 Active after 2023-06-03
aidream GPT-3.5 Active after 2023-05-12 GPT-3.5 Active after 2023-05-12 GPT-4 / Internet / good search Active GPT-4/3.5 GPT-4/3.5 GPT-3.5 / Internet GPT-3.5


This GitHub repository contains APIs from various sites without their authorization or affiliation. This project is for learning purposes only. This is a personal hobby project. Sites can contact developer to request better security or removal of their site from this repository.

Join Guidady AI Mail List

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Like it? Share with your friends!

94 shares, -3 points


Your email address will not be published. Required fields are marked *


I am an IT engineer, content creator, and proud father with a passion for innovation and excellence. In both my personal and professional life, I strive for excellence and am committed to finding innovative solutions to complex problems.
Choose A Format
Personality quiz
Series of questions that intends to reveal something about the personality
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Voting to make decisions or determine opinions
Formatted Text with Embeds and Visuals
The Classic Internet Listicles
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Upload your own images to make custom memes
Youtube and Vimeo Embeds
Soundcloud or Mixcloud Embeds
Photo or GIF
GIF format