All files / src/providers/anthropic index.ts

83.33% Statements 5/6
50% Branches 2/4
100% Functions 2/2
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17          15x 14x 14x 14x         14x      
import { config as globalConfig } from "../../config.js";
import { providerRegistry } from "../registry.js";
import { AnthropicProvider } from "./AnthropicProvider.js";
 
export function registerAnthropicProvider() {
  providerRegistry.register("anthropic", (config) => {
    const cfg = config || globalConfig;
    const apiKey = cfg.anthropicApiKey;
    Iif (!apiKey) {
      throw new Error(
        "anthropicApiKey is not set in config or ANTHROPIC_API_KEY environment variable"
      );
    }
    return new AnthropicProvider({ apiKey: apiKey.trim() });
  });
}