main
1# frozen_string_literal: true
2
3module Net
4 module Llm
5 class Anthropic
6 attr_reader :api_key, :model
7
8 def initialize(api_key: ENV.fetch("ANTHROPIC_API_KEY"), model: "claude-sonnet-4-20250514", http: Net::Llm.http)
9 @api_key = api_key
10 @model = model
11 @claude = Claude.new(
12 endpoint: "https://api.anthropic.com/v1/messages",
13 headers: { "x-api-key" => api_key, "anthropic-version" => "2023-06-01" },
14 model: model,
15 http: http
16 )
17 end
18
19 def messages(...) = @claude.messages(...)
20 def fetch(...) = @claude.fetch(...)
21 end
22 end
23end