View Source Anthropic.Client (anthropic_community v0.5.0)
Holds connection-level configuration for the Anthropic API: credentials, base URL,
API version, retry policy, and transport pool. Built once via new/1 and passed
explicitly as the first argument to every resource function (Anthropic.Messages.create/2,
Anthropic.Models.list/1, etc.) rather than held implicitly in process/application state.
Resolution order for :api_key and :base_url
- Explicit option passed to
new/1. Application.get_env(:anthropic, key).ANTHROPIC_API_KEY/ANTHROPIC_BASE_URLenvironment variables.- For
:api_keyonly: raisesArgumentErrorif still unresolved.:base_urldefaults to"https://api.anthropic.com".
Summary
Types
@type t() :: %Anthropic.Client{ api_key: String.t(), api_version: String.t(), base_url: String.t(), default_headers: [{String.t(), String.t()}], default_model: String.t() | nil, http_pool: atom(), max_retries: non_neg_integer(), timeout: pos_integer() }