Ctrl K
ComunidadGuías…

lib/anthropic.ts

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
import Anthropic from "@anthropic-ai/sdk";

let anthropicClient: Anthropic | null = null;

export function getAnthropicClient() {
  if (anthropicClient) return anthropicClient;

  const apiKey = process.env.ANTHROPIC_API_KEY;
  if (!apiKey) {
    throw new Error("AI generation is not configured.");
  }

  anthropicClient = new Anthropic({ apiKey });
  return anthropicClient;
}