- Warning
- this is a very early prototype of NovaAI. Do not use it in production.
- You have been warned.
-
Python
Endpoint
To use NovaAI in your code, simply set the endpoint of NovaAI.
- It's compitable with ClosedAI's library.
+ It's compitable with the official OpenAI Python library.
import openai as novaai
-
+
novaai.api_base = 'https://api.nova-oss.com/v1'
- Keep in mind not to violate ClosedAI's terms of service, or it'll break their hearts :(
+ Keep in mind not to violate OpenAIAI's terms of service, or it'll break their hearts :(
(and maybe write you a C&D).
Anyways, set the API endpoint to https://api.nova-oss.com/v1 and don't forget to add your NovaAI API key, too.
@@ -58,7 +53,7 @@ novaai.api_base = 'https://api.nova-oss.com/v1'
diff --git a/web/templates/replit.html b/web/templates/replit.html
new file mode 100644
index 0000000..a38b7d9
--- /dev/null
+++ b/web/templates/replit.html
@@ -0,0 +1,71 @@
+{% include 'parts/begin.html' %}
+
+
+
+
Prevent your API keys and Discord bot tokens from being stolen when using replit
+
+ Everyone can see your code created using replit.
+ It's really important that you don't set your API keys and other secret credentials directly in your code.
+ This isn't just for NovaAI, but for all your projects.
+
+
How to add new secrets
+
+ It's really simple:
+
+
+ Click the lock icon in the left sidebar
+
+
+ Set key to something like NOVA_API_KEY or DISCORD_BOT_TOKEN (don't use spaces etc.)
+ and the field value to your API key/token that you want to hide.
+
+
+ Click Add new secret
+
+
+ Now, you'll need to change the code a bit. Don't worry, it's just one or two lines.
+
+
+
+
+
How to use secrets in your code
+
In the following example, we're assuming you have just created a new NOVA_API_KEY secret.
+
+
Python
+
To set the variable nova_api_key to the value of the secret, use the following code:
+
import os
+
+nova_api_key = os.environ['NOVA_API_KEY']
+
+
+
For example, if you want to use the openai Python library, your code might look a bit like this:
+
import openai as novaai
+import os
+
+novaai.api_base = 'https://api.nova-oss.com/v1'
+novaai.api_key = os.environ['NOVA_API_KEY']
+
+# ...
+
+
+
Node.js
+
To set the variable novaApiKey to the value of the secret, use the following code:
+
const novaApiKey = process.env.NOVA_API_KEY
+
+
If you're using discord.js, your code might look a bit like this: