Universe bot
  • Welcome!
  • Quick Start
  • 🧩MORE
    • API Wrapper
      • Package Module
      • Manual Wrapping
        • Axios
        • Fetch
Powered by GitBook
On this page
  • Installation
  • How to use

Was this helpful?

  1. MORE
  2. API Wrapper
  3. Manual Wrapping

Axios

Universe API Wrapper using Axios

PreviousManual WrappingNextFetch

Last updated 1 year ago

Was this helpful?

TIPS

To use Axios, you'll need to install

Axios requires Node v12.20.0 or higher.

Installation

npm install axios
yarn add axios
pnpm add axios

How to use

const axios = require("axios");

const fetchData = async () => {
  try {
    const getResponse = await axios.get("https://api.universebot.space/v1/ai/openai/gpt4/model1", {
      headers: {
        Authorization: "Bearer UniverseAPI.XXXXXXXXXXXXX.XXXXXXXXXXXXX.XXXXXXXXXXXXX.XXXXXXXXXXXXX",
        "Content-Type": "application/json"
      },
      params: {
        prompt: "What is Galaxy Universe?"
      }
    });

    const getData = getResponse.data;
    console.log(getData);
  } catch (error) {
    console.error("Error fetching data:", error);
  }
};

fetchData();
import axios from "axios";

const fetchData = async () => {
  try {
    const getResponse = await axios.get("https://api.universebot.space/v1/ai/openai/gpt4/model1", {
      headers: {
        Authorization: "Bearer UniverseAPI.XXXXXXXXXXXXX.XXXXXXXXXXXXX.XXXXXXXXXXXXX.XXXXXXXXXXXXX",
        "Content-Type": "application/json"
      },
      params: {
        prompt: "What is Galaxy Universe?"
      }
    });

    const getData = getResponse.data;
    console.log(getData);
  } catch (error) {
    console.error("Error fetching data:", error);
  }
};

fetchData();
🧩
Node.js