mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 18:33:57 +01:00
Readme changes
This commit is contained in:
parent
d52a5b6a03
commit
42f876e208
164
README.md
164
README.md
|
@ -12,21 +12,15 @@ API server for accessing AI models.
|
||||||
![Badge showing the number of forks](https://img.shields.io/github/forks/novaoss/nova-api?style=social)
|
![Badge showing the number of forks](https://img.shields.io/github/forks/novaoss/nova-api?style=social)
|
||||||
![Badge showing the number of watchers](https://img.shields.io/github/watchers/novaoss/nova-api?style=social)
|
![Badge showing the number of watchers](https://img.shields.io/github/watchers/novaoss/nova-api?style=social)
|
||||||
|
|
||||||
|
:purple_heart: **We rely on support to keep our services free.** If you want to support us, you can donate to us using the following methods:
|
||||||
|
|
||||||
|
![Donation QR-Codes with the caption "Support open source development"](https://i.ibb.co/Xx71btm/image.png)
|
||||||
![Nova-API Conver/Banner Image - a picture of a galaxy with the caption "the core API server"](https://i.ibb.co/ZBhkS56/nova-api.png)
|
![Nova-API Conver/Banner Image - a picture of a galaxy with the caption "the core API server"](https://i.ibb.co/ZBhkS56/nova-api.png)
|
||||||
|
|
||||||
We aim to fix that! NovaAI provides several AI models for you to use for free.
|
|
||||||
|
|
||||||
## Star History
|
## Star History
|
||||||
|
|
||||||
|
![Star history chart of NovaAI](https://api.star-history.com/svg?repos=NovaOSS/nova-api&theme=dark))
|
||||||
###### *I founded FoxGPT (called *NovaGPT* back then)
|
|
||||||
<a href="https://star-history.com/#NovaOSS/nova-api&FoxGPT/gpt&Date">
|
|
||||||
<picture>
|
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=NovaOSS/nova-api,FoxGPT/gpt&type=Date&theme=dark" />
|
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=NovaOSS/nova-api,FoxGPT/gpt&type=Date" />
|
|
||||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=NovaOSS/nova-api,FoxGPT/gpt&type=Date" />
|
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
## NovaOSS APIs
|
## NovaOSS APIs
|
||||||
Our infrastructure might seem a bit confusing, but it's actually quite simple. Just the first one really matters for you, if you want to access our AI API. The other ones are just for the team.
|
Our infrastructure might seem a bit confusing, but it's actually quite simple. Just the first one really matters for you, if you want to access our AI API. The other ones are just for the team.
|
||||||
|
@ -69,5 +63,151 @@ This one's code can be found in the following repository: [github.com/novaoss/no
|
||||||
- In a different repository and with a different domain because it needs to display codes on the website.
|
- In a different repository and with a different domain because it needs to display codes on the website.
|
||||||
- Implemented in [NovaCord](https://nova-oss.com/novacord)
|
- Implemented in [NovaCord](https://nova-oss.com/novacord)
|
||||||
|
|
||||||
## Install & self-host
|
# Setup
|
||||||
See [setup.md](setup.md)
|
## Requirements
|
||||||
|
- Python 3.9+
|
||||||
|
- pip
|
||||||
|
- MongoDB database
|
||||||
|
|
||||||
|
## Recommended
|
||||||
|
- `git` (for updates)
|
||||||
|
- `screen` (for production)
|
||||||
|
- Cloudflare (for security, anti-DDoS, etc.) - we fully support Cloudflare
|
||||||
|
|
||||||
|
## Install
|
||||||
|
Assuming you have a new version of Python 3.9+ and pip installed:
|
||||||
|
```py
|
||||||
|
python -m pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
If you still get a `ModuleNotFoundError`s, you can forefully install the dependencies using:
|
||||||
|
```py
|
||||||
|
python -m pip install pipreqs
|
||||||
|
python -m pipreqs.pipreqs --force --mode no-pin
|
||||||
|
python -m pip install --upgrade -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also try installing Nova API using `setup.py`:
|
||||||
|
```py
|
||||||
|
python setup.py
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```py
|
||||||
|
pip install .
|
||||||
|
```
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Profanity checking requires:
|
||||||
|
|
||||||
|
```
|
||||||
|
pip install alt-profanity-check
|
||||||
|
# doesn't work? try
|
||||||
|
pip install git+https://github.com/dimitrismistriotis/alt-profanity-check.git
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## `.env` configuration
|
||||||
|
Create a `.env` file, make sure not to reveal any of its contents to anyone, and fill in the required values in the format `KEY=VALUE`. Otherwise, the code won't run.
|
||||||
|
|
||||||
|
### Database
|
||||||
|
Set up a MongoDB database and set `MONGO_URI` to the MongoDB database connection URI. Quotation marks are definetly recommended here!
|
||||||
|
|
||||||
|
### Proxy
|
||||||
|
- `PROXY_TYPE` (optional, defaults to `socks.PROXY_TYPE_HTTP`): the type of proxy - can be `http`, `https`, `socks4`, `socks5`, `4` or `5`, etc...
|
||||||
|
- `PROXY_HOST`: the proxy host (host domain or IP address), without port!
|
||||||
|
- `PROXY_PORT` (optional)
|
||||||
|
- `PROXY_USER` (optional)
|
||||||
|
- `PROXY_PASS` (optional)
|
||||||
|
|
||||||
|
Want to use a proxy list? See the according section!
|
||||||
|
Keep in mind to set `USE_PROXY_LIST` to `True`! Otherwise, the proxy list won't be used.
|
||||||
|
|
||||||
|
### `ACTUAL_IPS` (optional)
|
||||||
|
This is a security measure to make sure a proxy, VPN, Tor or any other IP hiding service is used by the host when accessing "Closed"AI's API.
|
||||||
|
It is a space separated list of IP addresses that are allowed to access the API.
|
||||||
|
You can also just add the *beginning* of an API address, like `12.123.` (without an asterisk!) to allow all IPs starting with `12.123.`.
|
||||||
|
> To disable the warning if you don't have this feature enabled, set `ACTUAL_IPS` to `None`.
|
||||||
|
|
||||||
|
### Timeout
|
||||||
|
`TRANSFER_TIMEOUT` seconds to wait until the program throws an exception for if the request takes too long. We recommend rather long times like `120` for two minutes.
|
||||||
|
|
||||||
|
### Core Keys
|
||||||
|
`CORE_API_KEY` specifies the **very secret key** for which need to access the entire user database etc.
|
||||||
|
`TEST_NOVA_KEY` is the API key the which is used in tests. It should be one with tons of credits.
|
||||||
|
|
||||||
|
### Webhooks
|
||||||
|
`DISCORD_WEBHOOK__USER_CREATED` is the Discord webhook URL for when a user is created.
|
||||||
|
`DISCORD_WEBHOOK__API_ISSUE` is the Discord webhook URL for when an API issue occurs.
|
||||||
|
|
||||||
|
### Other
|
||||||
|
`KEYGEN_INFIX` can be almost any string (avoid spaces or special characters) - this string will be put in the middle of every NovaAI API key which is generated. This is useful for identifying the source of the key using e.g. RegEx.
|
||||||
|
|
||||||
|
## Proxy Lists
|
||||||
|
To use proxy lists, navigate to `api/secret/proxies/` and create the following files:
|
||||||
|
- `http.txt`
|
||||||
|
- `socks4.txt`
|
||||||
|
- `socks5.txt`
|
||||||
|
|
||||||
|
Then, paste your proxies in the following format:
|
||||||
|
|
||||||
|
```
|
||||||
|
[username:password@]host:port
|
||||||
|
```
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
```
|
||||||
|
1.2.3.4:8080
|
||||||
|
user:pass@127.0.0.1:1337
|
||||||
|
```
|
||||||
|
|
||||||
|
You can use comments just like in Python.
|
||||||
|
|
||||||
|
**Important:** to use the proxy lists, you need to change the `USE_PROXY_LIST` environment variable to `True`!
|
||||||
|
|
||||||
|
## Run
|
||||||
|
> **Warning:** read the according section for production usage!
|
||||||
|
|
||||||
|
For developement:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python run
|
||||||
|
```
|
||||||
|
|
||||||
|
This will run the development server on port `2332`.
|
||||||
|
|
||||||
|
You can also specify a port, e.g.:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python run 1337
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adding a provider
|
||||||
|
|
||||||
|
## Test if it works
|
||||||
|
`python checks`
|
||||||
|
|
||||||
|
## Ports
|
||||||
|
```yml
|
||||||
|
2332: Developement (default)
|
||||||
|
2333: Production
|
||||||
|
```
|
||||||
|
|
||||||
|
## Production
|
||||||
|
Make sure your server is secure and up to date.
|
||||||
|
Check everything.
|
||||||
|
|
||||||
|
The following command will run the API __without__ a reloader!
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python run prod
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./screen.sh
|
||||||
|
```
|
148
setup.md
148
setup.md
|
@ -1,148 +0,0 @@
|
||||||
# Setup
|
|
||||||
## Requirements
|
|
||||||
- Python 3.9+
|
|
||||||
- pip
|
|
||||||
- MongoDB database
|
|
||||||
|
|
||||||
## Recommended
|
|
||||||
- `git` (for updates)
|
|
||||||
- `screen` (for production)
|
|
||||||
- Cloudflare (for security, anti-DDoS, etc.) - we fully support Cloudflare
|
|
||||||
|
|
||||||
## Install
|
|
||||||
Assuming you have a new version of Python 3.9+ and pip installed:
|
|
||||||
```py
|
|
||||||
python -m pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
If you still get a `ModuleNotFoundError`s, you can forefully install the dependencies using:
|
|
||||||
```py
|
|
||||||
python -m pip install pipreqs
|
|
||||||
python -m pipreqs.pipreqs --force --mode no-pin
|
|
||||||
python -m pip install --upgrade -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also try installing Nova API using `setup.py`:
|
|
||||||
```py
|
|
||||||
python setup.py
|
|
||||||
```
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
```py
|
|
||||||
pip install .
|
|
||||||
```
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
Profanity checking requires:
|
|
||||||
|
|
||||||
```
|
|
||||||
pip install alt-profanity-check
|
|
||||||
# doesn't work? try
|
|
||||||
pip install git+https://github.com/dimitrismistriotis/alt-profanity-check.git
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## `.env` configuration
|
|
||||||
Create a `.env` file, make sure not to reveal any of its contents to anyone, and fill in the required values in the format `KEY=VALUE`. Otherwise, the code won't run.
|
|
||||||
|
|
||||||
### Database
|
|
||||||
Set up a MongoDB database and set `MONGO_URI` to the MongoDB database connection URI. Quotation marks are definetly recommended here!
|
|
||||||
|
|
||||||
### Proxy
|
|
||||||
- `PROXY_TYPE` (optional, defaults to `socks.PROXY_TYPE_HTTP`): the type of proxy - can be `http`, `https`, `socks4`, `socks5`, `4` or `5`, etc...
|
|
||||||
- `PROXY_HOST`: the proxy host (host domain or IP address), without port!
|
|
||||||
- `PROXY_PORT` (optional)
|
|
||||||
- `PROXY_USER` (optional)
|
|
||||||
- `PROXY_PASS` (optional)
|
|
||||||
|
|
||||||
Want to use a proxy list? See the according section!
|
|
||||||
Keep in mind to set `USE_PROXY_LIST` to `True`! Otherwise, the proxy list won't be used.
|
|
||||||
|
|
||||||
### `ACTUAL_IPS` (optional)
|
|
||||||
This is a security measure to make sure a proxy, VPN, Tor or any other IP hiding service is used by the host when accessing "Closed"AI's API.
|
|
||||||
It is a space separated list of IP addresses that are allowed to access the API.
|
|
||||||
You can also just add the *beginning* of an API address, like `12.123.` (without an asterisk!) to allow all IPs starting with `12.123.`.
|
|
||||||
> To disable the warning if you don't have this feature enabled, set `ACTUAL_IPS` to `None`.
|
|
||||||
|
|
||||||
### Timeout
|
|
||||||
`TRANSFER_TIMEOUT` seconds to wait until the program throws an exception for if the request takes too long. We recommend rather long times like `120` for two minutes.
|
|
||||||
|
|
||||||
### Core Keys
|
|
||||||
`CORE_API_KEY` specifies the **very secret key** for which need to access the entire user database etc.
|
|
||||||
`TEST_NOVA_KEY` is the API key the which is used in tests. It should be one with tons of credits.
|
|
||||||
|
|
||||||
### Webhooks
|
|
||||||
`DISCORD_WEBHOOK__USER_CREATED` is the Discord webhook URL for when a user is created.
|
|
||||||
`DISCORD_WEBHOOK__API_ISSUE` is the Discord webhook URL for when an API issue occurs.
|
|
||||||
|
|
||||||
### Other
|
|
||||||
`KEYGEN_INFIX` can be almost any string (avoid spaces or special characters) - this string will be put in the middle of every NovaAI API key which is generated. This is useful for identifying the source of the key using e.g. RegEx.
|
|
||||||
|
|
||||||
## Proxy Lists
|
|
||||||
To use proxy lists, navigate to `api/secret/proxies/` and create the following files:
|
|
||||||
- `http.txt`
|
|
||||||
- `socks4.txt`
|
|
||||||
- `socks5.txt`
|
|
||||||
|
|
||||||
Then, paste your proxies in the following format:
|
|
||||||
|
|
||||||
```
|
|
||||||
[username:password@]host:port
|
|
||||||
```
|
|
||||||
|
|
||||||
e.g.
|
|
||||||
|
|
||||||
```
|
|
||||||
1.2.3.4:8080
|
|
||||||
user:pass@127.0.0.1:1337
|
|
||||||
```
|
|
||||||
|
|
||||||
You can use comments just like in Python.
|
|
||||||
|
|
||||||
**Important:** to use the proxy lists, you need to change the `USE_PROXY_LIST` environment variable to `True`!
|
|
||||||
|
|
||||||
## Run
|
|
||||||
> **Warning:** read the according section for production usage!
|
|
||||||
|
|
||||||
For developement:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python run
|
|
||||||
```
|
|
||||||
|
|
||||||
This will run the development server on port `2332`.
|
|
||||||
|
|
||||||
You can also specify a port, e.g.:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python run 1337
|
|
||||||
```
|
|
||||||
|
|
||||||
## Adding a provider
|
|
||||||
|
|
||||||
## Test if it works
|
|
||||||
`python checks`
|
|
||||||
|
|
||||||
## Ports
|
|
||||||
```yml
|
|
||||||
2332: Developement (default)
|
|
||||||
2333: Production
|
|
||||||
```
|
|
||||||
|
|
||||||
## Production
|
|
||||||
Make sure your server is secure and up to date.
|
|
||||||
Check everything.
|
|
||||||
|
|
||||||
The following command will run the API __without__ a reloader!
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python run prod
|
|
||||||
```
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./screen.sh
|
|
||||||
```
|
|
Loading…
Reference in a new issue