import Anthropic from '@anthropic-ai/sdk';

// src/llm/providers/direct.ts
var DEFAULT_MODEL = "claude-sonnet-4-6";
var DirectLlmProvider = class {
  client;
  defaultModel;
  constructor(opts) {
    this.client = new Anthropic({ apiKey: opts.apiKey });
    this.defaultModel = opts.model ?? DEFAULT_MODEL;
  }
  async complete(request) {
    const model = request.model ?? this.defaultModel;
    const maxTokens = request.maxTokens ?? 4096;
    const response = await this.client.messages.create({
      model,
      max_tokens: maxTokens,
      system: request.systemPrompt,
      messages: request.messages.map((m) => ({
        role: m.role,
        content: m.content
      }))
    });
    const content = response.content.filter((b) => b.type === "text").map((b) => b.text).join("");
    const usedTokens = (response.usage?.input_tokens ?? 0) + (response.usage?.output_tokens ?? 0);
    return { content, usedTokens };
  }
};

export { DirectLlmProvider };
