Merge branch 'master' of https://github.com/acheong08/ChatGPT-to-API
This commit is contained in:
commit
84d16d7398
@ -53,6 +53,7 @@ echo "$START$TOKENS$END" > access_tokens.json
|
||||
- `http_proxy` - SOCKS5 or HTTP proxy. `socks5://HOST:PORT`
|
||||
- `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)
|
||||
|
||||
### Files (Optional)
|
||||
- `access_tokens.json` - A JSON array of access tokens for cycling (Alternatively, send a PATCH request to the [correct endpoint](https://github.com/acheong08/ChatGPT-to-API/blob/master/docs/admin.md))
|
||||
|
@ -1,8 +1,28 @@
|
||||
# API Documentation:
|
||||
## openaiHandler:
|
||||
|
||||
This API endpoint receives a POST request with a JSON body that contains OpenAI credentials. The API updates the environment variables "OPENAI_EMAIL" and "OPENAI_PASSWORD" with the provided credentials.
|
||||
|
||||
HTTP method: PATCH
|
||||
|
||||
Endpoint: /openai
|
||||
|
||||
Request body:
|
||||
|
||||
```json
|
||||
{
|
||||
"OpenAI_Email": "string",
|
||||
"OpenAI_Password": "string"
|
||||
}
|
||||
```
|
||||
|
||||
Response status codes:
|
||||
- 200 OK: The OpenAI credentials were successfully updated.
|
||||
- 400 Bad Request: The JSON in the request body is invalid.
|
||||
|
||||
## passwordHandler:
|
||||
|
||||
This API endpoint receives a POST request with a JSON body that contains a "password" field. The API updates the value of the ADMIN_PASSWORD variable with the value provided in the request body.
|
||||
This API endpoint receives a POST request with a JSON body that contains a new password. The API updates the global variable "ADMIN_PASSWORD" and the environment variable "ADMIN_PASSWORD" with the new password.
|
||||
|
||||
HTTP method: PATCH
|
||||
|
||||
@ -12,17 +32,37 @@ Request body:
|
||||
|
||||
```json
|
||||
{
|
||||
"password": string
|
||||
"password": "string"
|
||||
}
|
||||
```
|
||||
|
||||
Response status codes:
|
||||
- 200 OK: The ADMIN_PASSWORD variable was successfully updated.
|
||||
- 400 Bad Request: The "password" field is missing or not provided in the request body.
|
||||
- 200 OK: The password was successfully updated.
|
||||
- 400 Bad Request: The password is missing or not provided in the request body.
|
||||
|
||||
## puidHandler:
|
||||
|
||||
This API endpoint receives a POST request with a JSON body that contains a new PUID (Personal User ID). The API updates the environment variable "PUID" with the new PUID.
|
||||
|
||||
HTTP method: PATCH
|
||||
|
||||
Endpoint: /puid
|
||||
|
||||
Request body:
|
||||
|
||||
```json
|
||||
{
|
||||
"puid": "string"
|
||||
}
|
||||
```
|
||||
|
||||
Response status codes:
|
||||
- 200 OK: The PUID was successfully updated.
|
||||
- 400 Bad Request: The PUID is missing or not provided in the request body.
|
||||
|
||||
## tokensHandler:
|
||||
|
||||
This API endpoint receives a POST request with a JSON body that contains an array of request tokens. The API updates the value of the ACCESS_TOKENS variable with a new access token generated from the request tokens provided in the request body.
|
||||
This API endpoint receives a POST request with a JSON body that contains an array of request tokens. The API updates the value of the global variable "ACCESS_TOKENS" with a new access token generated from the request tokens provided in the request body.
|
||||
|
||||
HTTP method: PATCH
|
||||
|
||||
@ -39,3 +79,5 @@ Request body:
|
||||
Response status codes:
|
||||
- 200 OK: The ACCESS_TOKENS variable was successfully updated.
|
||||
- 400 Bad Request: The request tokens are missing or not provided in the request body.
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user