Getting Started
Currently, to use this API and obtain a key, you must have a Discord account.
Gaining the power: obtaining a key
Think you're worthy to start with PurAI? We sure do! If you agree with us, simply follow the steps below!
-
Head over to the Discord server
-
Once there, click into the bots channel
-
Run the
/keycommand -
The PurAI bot will respond with your key. Do not, under any circumstance, share it with anyone! It's yours :)
Unleashing the power: using the AI
Once you have your key, the power of PurAI can be unleashed. Before moving to this step, if you wish, you may test out PurAI by chatting with it: Use the /chat command!
The way that one interacts with PurAI is, currently, through POST requests (whether that be through cURL, fetch(), or other means). This makes it easy to use and cross platform.
A simple demonstration of using PurAI, using the chat/completions endpoint model, is below:
const PurAI = require('PurAI.js');
const { OpenAIChatCompletionsMessageRole, OpenAIChatCompletionsModel } = require('PurAI.js/src/types');
const PurAI = new PurAI('YOUR API KEY');
let response = await PurAI.openAI.chat.completions({
messages: [
{
role: OpenAIChatCompletionsMessageRole.User,
content: 'Hello, PurAI!'
}
],
model: OpenAIChatCompletionsModel['GPT-3.5 Turbo'] // ANY DESIRED MODEL
});
console.log(response);Returns:
{
"id": "chatcmpl-7aW8BDCAXErPoazm2dSI1EKEUzKBQ",
"object": "chat.completion",
"created": 1688937675,
"model": "gpt-3.5-turbo-0613",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I assist you today?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 13,
"completion_tokens": 9,
"total_tokens": 22
}
}Understanding the power: how to use PurAI
PurAI is simple: all you have to do is send a POST request to a URL which, depending on your desired company (openai) and product (chat/completions), will give you your desired output.
Of course, you can't possibly be able to read our minds, so the URLs, as well as their descriptions, will be described in the next sections.