Access to XMLHttpRequest at ‘….’ from origin ‘http://localhost:5173’ has been blocked by CORS policy

This might be a duplicate but I tried implementing a lot of solutions and it’s not working.

I’m encountering the error while integrating the Detect Language API into my application.
This is my code.

  const apiKey = String(import.meta.env.VITE_API_KEY);
  const detectlanguage = new DetectLanguage(apiKey);

  function fetchLanguages() {
    detectlanguage.languages().then(function(result) {
    console.log(JSON.stringify(result));
   });
  }

The error

Access to XMLHttpRequest at 'https://ws.detectlanguage.com/0.2/languages' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I tried deploying the code to github, considering it was because of local environment but still the error is there.

I have another call to detect language to the same API which is working right.

Code:

function detectLanguage() {
    detectlanguage.detect(text).then(function (result) {
      const lang = result[0]?.language;
      setDetectedLanguage(lang);
      fetchTranslation(lang);
    });
  }

So I’m unable to understand why languages endpoint is not working.

Link to documentation.