update renew schedule
This commit is contained in:
parent
cacfa46571
commit
2b22c0427d
@ -1,11 +1,12 @@
|
||||
# ChatGPT-to-API
|
||||
Create a fake API using ChatGPT's website [中文说明](https://github.com/xqdoo00o/ChatGPT-to-API/blob/master/README_ZH.md)
|
||||
Create a fake API using ChatGPT's website
|
||||
|
||||
> ## IMPORTANT
|
||||
> You will not get free support for this repository. This was made for my own personal use and documentation will continue to be limited as I don't really need documentation. You will find more detailed documentation in the Chinese docs by a contributor.
|
||||
|
||||
**API endpoint: http://127.0.0.1:8080/v1/chat/completions.**
|
||||
|
||||
[中文文档(Chinese Docs)](https://github.com/xqdoo00o/ChatGPT-to-API/blob/master/README_ZH.md)
|
||||
## Setup
|
||||
|
||||
### Authentication
|
||||
@ -22,7 +23,7 @@ email:password
|
||||
|
||||
All authenticated access tokens will store in `access_tokens.json`
|
||||
|
||||
Auto renew access tokens after 20 days
|
||||
Auto renew access tokens after 14 days
|
||||
|
||||
Caution! please use unblocked ip for authentication, first login to `https://chat.openai.com/` to check ip availability if you can.
|
||||
|
||||
@ -52,6 +53,7 @@ go build
|
||||
- `SERVER_HOST` - Set to 127.0.0.1 by default
|
||||
- `SERVER_PORT` - Set to 8080 by default
|
||||
- `OPENAI_EMAIL` and `OPENAI_PASSWORD` - It will automatically refresh your PUID if set (requires Plus account)
|
||||
- `ENABLE_HISTORY` - Set to true by default
|
||||
|
||||
### Files (Optional)
|
||||
- `proxies.txt` - A list of proxies separated by new line
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
所有登录后的Access tokens会存放在`access_tokens.json`
|
||||
|
||||
每20天自动更新Access tokens
|
||||
每14天自动更新Access tokens
|
||||
|
||||
注意! 请使用未封锁的ip登录账号,请先打开浏览器登录`https://chat.openai.com/`以检查ip是否可用
|
||||
|
||||
|
@ -21,9 +21,10 @@ func ConvertAPIRequest(api_request official_types.APIRequest) chatgpt_types.Chat
|
||||
} else {
|
||||
fmt.Println("Error getting Arkose token: ", err)
|
||||
}
|
||||
chatgpt_request.Model = "gpt-4"
|
||||
if api_request.Model == "gpt-4-browsing" || api_request.Model == "gpt-4-mobile" || api_request.Model == "gpt-4-code-interpreter" {
|
||||
chatgpt_request.Model = api_request.Model
|
||||
chatgpt_request.Model = api_request.Model
|
||||
// Cover some models like gpt-4-32k
|
||||
if len(api_request.Model) >= 7 && api_request.Model[6] >= 48 && api_request.Model[6] <= 57 {
|
||||
chatgpt_request.Model = "gpt-4"
|
||||
}
|
||||
}
|
||||
if api_request.PluginIDs != nil {
|
||||
|
9
main.go
9
main.go
@ -20,7 +20,7 @@ var ACCESS_TOKENS tokens.AccessToken
|
||||
var proxies []string
|
||||
|
||||
func checkProxy() {
|
||||
// Check for proxies.txt
|
||||
// first check for proxies.txt
|
||||
proxies = []string{}
|
||||
if _, err := os.Stat("proxies.txt"); err == nil {
|
||||
// Each line is a proxy, put in proxies array
|
||||
@ -38,6 +38,13 @@ func checkProxy() {
|
||||
}
|
||||
}
|
||||
}
|
||||
// if no proxies, then check env http_proxy
|
||||
if len(proxies) == 0 {
|
||||
proxy := os.Getenv("http_proxy")
|
||||
if proxy != "" {
|
||||
proxies = append(proxies, proxy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
Reference in New Issue
Block a user