Class AnthropicProvider

java.lang.Object
ai.doctruth.AnthropicProvider
All Implemented Interfaces:
LlmProvider

public non-sealed class AnthropicProvider extends Object implements LlmProvider
Anthropic Messages API provider. Hand-rolled JDK-HttpClient-backed implementation per ADR 0003 — no Anthropic SDK on the classpath. Vendor wire types are confined to ai.doctruth.internal.providers.anthropic and never appear in this class's public surface.

non-sealed so that test code (and advanced users) can anonymously subclass to supply canned responses or wrap behaviour. Public API is thread-safe: the underlying AnthropicHttpClient is stateless and shares one HttpClient.

Since:
0.1.0
  • Constructor Details

    • AnthropicProvider

      public AnthropicProvider(String apiKey)
      Build a provider against the public Anthropic endpoint and "claude-sonnet-4-5".
      Parameters:
      apiKey - non-blank Anthropic API key.
    • AnthropicProvider

      public AnthropicProvider(String apiKey, URI endpoint, String model)
      Build a provider against an explicit endpoint and model name. Required for users on Bedrock / Vertex Anthropic-compat endpoints, in-cluster proxies, or test harnesses.
      Parameters:
      apiKey - non-blank Anthropic API key.
      endpoint - full Messages-API URL (typically ending in /v1/messages).
      model - Anthropic model identifier (e.g. "claude-sonnet-4-5").
  • Method Details