AnthropicClient constructor

AnthropicClient({
  1. required String apiKey,
  2. String model = 'claude-3-5-sonnet-latest',
  3. String baseUrl = 'https://api.anthropic.com/v1/messages',
  4. String apiVersion = '2023-06-01',
  5. int maxTokens = 4096,
  6. double? temperature,
  7. void onRetry(
    1. int attempt,
    2. Duration nextDelay,
    3. dynamic error
    )?,
  8. Client? httpClient,
})

Creates an AnthropicClient.

apiKey is required. All other parameters have sensible defaults. You can swap model to any supported Claude model name, such as 'claude-3-7-sonnet-latest', 'claude-3-5-sonnet-latest', or 'claude-3-5-haiku-latest'.

Implementation

AnthropicClient({
  required this.apiKey,
  this.model = 'claude-3-5-sonnet-latest',
  this.baseUrl = 'https://api.anthropic.com/v1/messages',
  this.apiVersion = '2023-06-01',
  this.maxTokens = 4096,
  this.temperature,
  this.onRetry,
  http.Client? httpClient,
}) : _httpClient = httpClient ?? http.Client();