import OpenAI from "openai"; let hfInstance: OpenAI | null = null; export function getHF(): OpenAI { if (!hfInstance) { hfInstance = new OpenAI({ apiKey: process.env.HF_TOKEN, baseURL: "https://router.huggingface.co/v1", }); } return hfInstance; } // Export a getter that matches the original export name export const hf = new Proxy({} as OpenAI, { get(_target, prop, _receiver) { const client = getHF(); return Reflect.get(client, prop, client); } });