English / 简体中文
Concurrency has really improved this time too, I was really wrong before, but this time it really works!
Test interface: https://testgpt.iqaq.me/
Online experience: https://chat.iqaq.me/
Of course, I can't send such a long reply in 10s!
- Stream breaks after 10s. (Since the Hobby plan of Vercel lasts a maximum of 10 seconds, remember to lower the
maximum text length
to around 600 with 30 concurrency using immersivetranslation). - The refresh of the token requested from OpenAI relies on a timed task, which free users are only given to use once a day...
- Vercel Pro plan timeout is capped at 300s and comes with a cron plan skip to Pro deployment introduction.
- Otherwise timed tasks are available via cron-job or
Uptime Kuma
, etc. periodically (every 2-4 minutes) by callinghttps://[Your_domain]/api/cron
Not recommended, can't synchronise updates, and the new version requires a database now, clicking on it also still requires a database configuration step This button currently includes the Vercel KV
database, the hobby plan only needs to be paired with a little cron-job, look at Deploy below! Method 1: Step 8.
The following are recommended to bind custom domain names to resolve Vercel's domain name blocking issue
Method 1: Deploy KV
database in conjunction with Vercel (kv database has only 3k visits per day, 30k visits per month, which is only enough for low-frequency personal use)
-
fork this repository, uncheck
Copy the main branch only
when you fork it. -
Go to Vercel and import the repository you forked.
-
Click
Deploy
and wait for the deployment to complete. -
Go to the
Storage
tab and create aKV
database with a randomDatabase Name
andSan Francisco
for thePrimary Region
. -
Make sure that the
Projects
tab of theKV
database is connected to your project. -
(Optional) Bind your own domain name under
Domains
inSettings
. -
Go to the
Deployments
tab at the top andRedeploy
to redeploy your project. -
(Hobby plan users) go to cron-job and create a task that refreshes tokens on a regular visit, fill in
https://[Your_domain]/api/cron
, choose every two minutes,Create
and you're done, there are other similar Uptime Kuma as well. -
Done! Applause, after the first deployment it is recommended to manually visit
https://[Your_domain]/api/cron
to refresh the token
Method 2: Redis
database deployment with Upstash (10k visits per day) Recommended!
- Jump to
Upstash
to create and login to your account to create aRedis
database - For
Region
selectCalifornia, USA
as recommended, forEviction
tick the box and create aRedis
database. - Pay attention to
UPSTASH_REDIS_REST_URL
andUPSTASH_REDIS_REST_TOKEN
, we need to copy these two pairs of data name and data value, and these two pairs of data need to be filled in theEnvironment Variables
ofVercel
later. - fork this repository, and uncheck
Copy the main branch only
when you fork. - Import the forked repository in vercel.
- In the
Environment Variables
input box, fill in the two pairs of data from step 3. - Click
Deploy
. - (Optional) Bind your own domain name under
Domains
inSettings
. 9. - Go to the
Deployments
tab at the top andRedeploy
to redeploy your project. - (Same as above 8. Hobby plan users need to set up cron-job.org timed tasks)
- Done! Applause, after the first deployment it is recommended to manually visit
https://[Your_domain]/api/cron
to refresh the token
- the first few steps of deployment are the same as the above two plans, choose according to your needs, and do not need to set up cron schedules.
- just go to the
Git
page underSettings
and fill invercel-pro
inProduction Branch
and clickSave
before the finalRedeploy
redeployment. - Then go to the
Deployments
tab at the top, and be careful not to select any of the already deployed records below!!!! Then click on the three dots in the top right corner of the imageCreate Deployment
and selectvercel-pro
and thenCreate Deployment
! - Done! Applause, after the first deployment it is recommended to manually visit
https://[Your_domain]/api/cron
to refresh the token
You don't have to pass Authorisation, of course, you can also pass any string randomly.
curl https://[Your Vercel Domain]/v1/chat/completions \
-H "Content-Type: application/json" \\
-H "Authorization: Bearer any_string_you_like" \
-d '{
"model": "gpt-3.5-turbo", \ -d '{
"messages": [
{
"role": "user", "content": "Hello!
"content": "Hello!"
}
], "stream": true
"stream": true
}'
Key | Value | Explanation | Requirement |
---|---|---|---|
AUTH_TOKEN |
You_set_the_apikey_yourself. | The apikey you set for your own interface. | Optional |
UPSTASH_REDIS_REST_URL |
Your_Upstash_URL | The URL of your Upstash Redis database | Optional |
UPSTASH_REDIS_REST_TOKEN |
Your_Upstash_Token | Your Upstash Redis database's Token | Optional |
Default timer 4 minutes to update 16 tokens, tokens to determine the concurrency, generally enough, such as the need to adjust the upper limit should be considered in the 10s request time limit to complete the refreshing of tokens (Pro users can plan their own)
You can use it in any app, such as OpenCat, Next-Chat, Lobe-Chat, Bob, etc. Feel free to fill in an API Key with any string, for example, gptyyds
.
- Forked From: https://github.com/missuo/FreeGPT35
- Higher Upstream: https://github.com/skzhengkai/free-chatgpt-api
- Original Author: https://github.com/PawanOsman/ChatGPT
- aurora: Golang development, support for multiple deployment methods
AGPL 3.0 Licence