async function authFetchJson()

in scripts/inference-providers/scripts/generate.ts [70:83]


async function authFetchJson(url: string) {
  const headers = url.includes("huggingface.co") ? HEADERS : {};
  try {
    const res = await fetch(url, { headers: headers });
    if (!res.ok) {
      console.warn(`Failed to fetch ${url}: ${await res.text()}`);
      return {};
    }
    return res.json();
  } catch (e) {
    console.warn(`Failed to fetch ${url}: ${e}`);
    return {};
  }
}