import { Exa } from "exa-js";
import { env } from "../env.js";

let client: Exa | null = null;

export function exaClient() {
  if (!env.EXA_API_KEY) {
    throw new Error("EXA_API_KEY not set");
  }
  if (!client) {
    client = new Exa(env.EXA_API_KEY);
  }
  return client;
}
