Package Module
Universe API Wrapper using official Universe API package.
TIP
To use @mgalacyber/universeapi, you'll need to install Node.js
@mgalacyber/universeapi requires Node v16.11.0 or higher.
Installation
npm install @mgalacyber/universeapi
yarn add @mgalacyber/universeapi
pnpm add @mgalacyber/universeapi
How to use
const { UniverseClient } = require("@mgalacyber/universeapi");
const uAPI = new UniverseClient("API_TOKEN");
uAPI.[version].[features].[category](parameter)
.then(result => {
console.log(result);
})
.catch(error => {
console.error(error.message);
});
import { UniverseClient } from "@mgalacyber/universeapi";
const uAPI = new UniverseClient("API_TOKEN");
uAPI.[version].[features].[category](parameter)
.then(result => {
console.log(result);
})
.catch(error => {
console.error(error.message);
});
Example
uAPI.V1.AI.OpenAI.GPT.Text({
model: "gpt4", // Type of model used
version: 1, // Model version of rest api
prompt: "What is Galaxy Universe?" // Enter Your prompt here
}).then((result) => console.log(result));
Full example code
const { UniverseClient } = require("@mgalacyber/universeapi");
const uAPI = new UniverseClient("API_TOKEN");
uAPI.V1.AI.OpenAI.GPT.Text({
model: "gpt4", // Type of model used
version: 1, // Model version of rest api
prompt: "What is Galaxy Universe?" // Enter Your prompt here
}).then((result) => console.log(result));
import { UniverseClient } from "@mgalacyber/universeapi";
const uAPI = new UniverseClient("API_TOKEN");
uAPI.V1.AI.OpenAI.GPT.Text({
model: "gpt4", // Type of model used
version: 1, // Model version of rest api
prompt: "What is Galaxy Universe?" // Enter Your prompt here
}).then((result) => console.log(result));
Response
{
"status": true,
"code": 200,
"speed": "string",
"author": "string",
"message": "string",
"data": "object"
}
{
"status": false,
"code": 403,
"speed": "string",
"author": "string",
"message": "string",
"data": null
}
{
"status": false,
"code": 404,
"speed": "string",
"author": "string",
"message": "string",
"data": null
}
{
"status": false,
"code": 429,
"speed": "string",
"author": "string",
"message": "string",
"data": null
}
{
"status": false,
"code": 500,
"speed": "string",
"author": "string",
"message": "string",
"data": null
}
Last updated